Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_bookmarks.php
CommitLineData
e586807d 1<?php
b42b2bf9 2
e586807d
H
3function smarty_function_get_bookmarks($brawco,&$smarty) {
4
b42b2bf9
H
5if (is_numeric($brawco['node_id'])) $bookcat=$brawco['node_id'];
6if (is_numeric($brawco['user_id'])) $user_id=$brawco['user_id'];
7global $db;
8
9//returning user specific bookmarks
10if ($user_id) {
11$q="select * from node_access left join nodes on node_access.node_id=nodes.node_id where user_id='$user_id' and node_bookmark='yes' and nodes.node_system_access='public'";
12$set=$db->query($q);
13while ($set->next()) {
14$array[]=$set->getRecord();
15}
16$smarty->assign('get_bookmarks',$array);
17return false;
18}
19
20//returning my own bookmarks divided in categories
21$q="select distinct bookmark_category,nodes.* from node_access left join nodes on node_access.bookmark_category=nodes.node_id where user_id='".$_SESSION['user_id']."' and node_bookmark='yes' order by node_name";
22$result=$db->query($q);
23while ($result->next()) {
24$categories[$result->getString('node_id')]=$result->getRecord();
25}
26
27$q="select * from node_access left join nodes on node_access.node_id=nodes.node_id where user_id='".$_SESSION['user_id']."' and node_bookmark='yes' and node_name is not NULL ";
28if ($bookcat) $q.=" and (bookmark_category='$bookcat' or bookmark_category=0 or bookmark_category IS NULL) order by node_name desc";
29if ($bookcat && $_SESSION['user_id']==548) echo $q;
30
31else $q.="order by node_name";
32$result=$db->query($q);
33if (!$bookcat) {
34while ($result->next()) {
35if (!$result->getString('bookmark_category')) {
36$categories['unsorted']['children'][]=$result->getRecord();
37$categories['unsorted']['sum']+=$result->getString('node_user_subchild_count');
38}
39else {
40$categories[$result->getString('bookmark_category')]['children'][]=$result->getRecord();
41$categories[$result->getString('bookmark_category')]['sum']+=$result->getString('node_user_subchild_count');
42}
43}
44
45$smarty->assign('get_bookmarks',$categories);
46}
47
48else {
49while ($result->next()) {
50$bookmarks[]=$result->getRecord();
51}
52$smarty->assign('get_bookmarks',$bookmarks);
53}
e586807d
H
54}
55?>
This page took 0.157267 seconds and 4 git commands to generate.