big commit
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_k_filtred_nodes.php
CommitLineData
b42b2bf9
H
1<?php
2function smarty_function_get_k_filtred_nodes($params,&$smarty) {
3
4global $db,$node;
5
6$user_id = $_SESSION['user_id'];
7$node_id = 2472165;
8$q="select src from neurons where synapse_creator='$user_id' and dst='$node_id'";
9
10$set=$db->query($q);
11while ($set->next()) {
12$k_filtred_nodes_array[0][]=$set->getRecord();
13}
14
15// get k
16
17if (is_numeric($params['offset'])) $offset=$params['offset'];
18else $offset=0;
19if (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount'];
20else $listing_amount=DEFAULT_LISTING_AMOUNT;
21if (!is_numeric($_POST['interval'])) $interval=1;
22else $interval = $_POST['interval'];
23if ($params['vector']) {
24$vector=$params['vector'];
25$interval=365;
26}
27else $vector="00";
28
29$q="select node_content.node_content,nodes.*,parent.node_name as parent_name,users.login as creator
30from nodes left join node_content on node_content.node_id=nodes.node_id left join nodes as parent on nodes.node_parent=parent.node_id
31left join users on users.user_id=nodes.node_creator where nodes.node_created>now()-interval $interval day
32and nodes.node_vector like '$vector%' and nodes.k>0 and nodes.node_system_access!='private' order by nodes.k desc limit $offset,$listing_amount";
33
34$set=$db->query($q);
35while ($set->next()) {
36$k_filtred_nodes_array[1][]=$set->getRecord();
37}
38
39$smarty->assign('get_k_filtred_nodes',$k_filtred_nodes_array);
40
41}
42?>
This page took 0.228244 seconds and 4 git commands to generate.