Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_matrix_from_tree.php
1 <?php
2 function smarty_function_get_matrix_from_tree($params,&$smarty) {
3 global $db , $node;
4
5 if (!is_numeric($params['dimensions'])) return false;
6
7 //in the very moment IM2tired4going meta-dimensional
8 for ($i=0; $i<$params['dimensions']; $i++ ) {}
9
10 $q="select node_content.node_content,nodes.*
11 from nodes left join node_content
12 on nodes.node_id=node_content.node_id
13 where node_vector like '".$node['node_vector']."%' and
14 nodes.node_id!='".$node['node_id']."' and
15 node_system_access !='private'
16 order by rand() ";
17 $set=$db->query($q);
18
19 $size = floor(sqrt($set->getNumRows()));
20
21 $x=0;
22 $y=0;
23
24 while ($set->next()) {
25 if ($x<$size) {
26 $x++;
27 }
28 else {
29 $y++;
30 $x=0;
31 }
32
33 $matrix[$x][$y] = $set->getRecord();
34
35 }
36
37 $smarty->assign('get_matrix_from_tree',$matrix);
38 }
39 ?>
This page took 0.253268 seconds and 4 git commands to generate.