37e003b7e892b4c3c095f5fa87cb6757ba17ca3c
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / smarty / node_methodz / function.get_linked_nodes.php
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 $db, $error, $node;
6
7 if ($params['listing_amount']=='all') $listing_amount='23232323232323323';
8 elseif (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount'];
9 else $listing_amount=DEFAULT_LISTING_AMOUNT;
10
11 if (is_numeric($params['offset'])) $offset=$params['offset'];
12 elseif (is_numeric($_POST['offset'])) $offset=$_POST['offset'];
13 else $offset=0;
14
15
16
17 if ($params['node_id']) {
18 $node_id=$params['node_id'];
19 }
20
21 else {
22 $node_id=$node['node_id'];
23 }
24
25 if ($params['orderby']='synapse') {
26 $orderby='synapse_created';
27 }
28
29 else {
30 $orderby='node_id';
31 }
32
33
34
35 $q="select neurons.synapse_created,node_content,author.login,linker.login as linker,nodes.* from neurons left join nodes on neurons.src=nodes.node_id left join users as linker on neurons.synapse_creator=linker.user_id left join users as author on nodes.node_creator=author.user_id where dst='$node_id' and link in ('hard','bookmark') order by $orderby desc limit $offset , $listing_amount";
36 $result=$db->query($q);
37 while ($result->next()) {
38 $array=$result->getRecord();
39 transport_process_node($array);
40 $array['node_status']="linked";
41 $array['node_created']=$array['synapse_created'];
42 $get_linked_nodes[]=$array;
43 }
44 $smarty->assign('get_linked_nodes',$get_linked_nodes);
45
46 }
47
48 ?>
49
This page took 0.295277 seconds and 3 git commands to generate.