return 0;
}
-// XXX TODO
-//
+// Get nodes sorted by weight_k specific to user
function getKNeurons($user_id,$interval) {
global $db,$node,$error,$error_messages;
$q="call k_neurons('$user_id','$interval')";
$set=$db->query($q);
-// $set->next();
- return $set;
-}
-
+ while ($set->next()) {
+ $k_array[]=$set->getRecord();
+ }
+ return $k_array;
}
+}
create procedure k_neurons ( IN user_id INT, IN day_int INT)
BEGIN
if day_int = NULL or day_int = 0 then set day_int=20; end if;
- select *,(k_get_node_weigth(node_id,user_id)*k) as weight_k from nodes where k>0
+ select *,(k_get_node_weigth(node_id,user_id)*k) as weight_k,'test1' as creator,'test2' as parent from nodes where k>0
and node_created>now()-interval day_int day order by weight_k desc;
END//
} else {$vector="00";}
- $set=nodes::getKNeurons($params['user_id'],20); // XXX offset
+ // XXX offset + id $params['user_id']
+ $k_array=nodes::getKNeurons(904,20);
- while ($set->next()) {
- $k_array[]=$set->getRecord();
- }
$smarty->assign('get_k_neurons',$k_array);
}