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