51ff3226 |
1 | <?php |
2 | |
3 | function smarty_function_getCreationByTemplateId($params,&$smarty) { |
4 | |
5 | |
6 | $template_id=$params['template_id']; |
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 (empty($params['offset'])) $offset=0; |
12 | else $offset=$params['offset']; |
13 | |
14 | global $db,$node; |
15 | if (is_numeric($params['creator_id'])) $creator_id=$params['creator_id']; |
16 | else $creator_id=$node['node_id']; |
17 | if (is_numeric($params['template_id'])) $template_id=$params['template_id']; |
18 | else $template_id=DEFAULT_TEMPLATE; |
19 | |
20 | $user_id=$_SESSION['user_id']; |
21 | |
22 | $q="select parent.node_name as |
23 | parent_name,nodes.* from nodes |
24 | left join nodes as parent on parent.node_id=nodes.node_parent |
25 | where nodes.node_creator='$creator_id' and |
26 | nodes.template_id='$template_id' and |
27 | nodes.node_system_access!='private' order by |
28 | nodes.node_created desc LIMIT $offset,$listing_amount"; |
29 | |
30 | $set=$db->query($q); |
31 | while ($set->next()) $pole[]=$set->getRecord(); |
32 | $smarty->assign('getCreationByTemplateId',$pole); |
33 | } |
34 | ?> |