| 1 | <?php |
| 2 | //returns array of linked nodes, possible args listing_amount,offset,node_id,orderby=synapse |
| 3 | |
| 4 | function smarty_function_get_linked_nodes($params,&$smarty) { |
| 5 | global $error, $node; |
| 6 | |
| 7 | if ($params['listing_amount']=='all') $listing_amount=DEF_MAX_LISTING_AMMOUNT; |
| 8 | elseif (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount']; |
| 9 | else $listing_amount=DEFAULT_LISTING_AMOUNT; |
| 10 | |
| 11 | if (isset($params['offset']) && is_numeric($params['offset'])) $offset=$params['offset']; |
| 12 | elseif (isset($_POST['offset']) && is_numeric($_POST['offset'])) $offset=$_POST['offset']; |
| 13 | else $offset=0; |
| 14 | |
| 15 | if (isset($params['node_id'])) { |
| 16 | $node_id=$params['node_id']; |
| 17 | } else { |
| 18 | $node_id=$node['node_id']; |
| 19 | } |
| 20 | |
| 21 | if ($params['orderby']='synapse') { |
| 22 | $orderby='synapse_created'; |
| 23 | } else { |
| 24 | $orderby='node_id'; |
| 25 | } |
| 26 | |
| 27 | $get_linked_nodes=nodes::getLinkedNodes($node_id,$orderby,$offset,$listing_amount); |
| 28 | $smarty->assign('get_linked_nodes',$get_linked_nodes); |
| 29 | } |
| 30 | |
| 31 | ?> |
| 32 | |