e19b77f99eeb5b070b9d56bab7bb825747594411
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / smarty / node_methodz / function.get_poll.php
1 <?php
2 // bugfix. Opravuje zobrazovanie ankiet v nadparentoch kde nemaju byt.
3 function smarty_function_get_poll($params,&$smarty) {
4 global $db,$node;
5 $user_id=$_SESSION['user_id'];
6 $node_vector=$node['node_vector'];
7 if (!is_numeric($params['poll_id'])) $poll_id=$node['node_id'];
8 else $poll_id=$params['poll_id'];
9
10 if (is_array($params['poll'])) {
11 $array=$params['poll'];
12 $voted='yes';
13 }
14
15 else {
16 $set=$db->query("select nodes.*,node_access.node_permission from nodes left join node_access on (nodes.node_id=node_access.node_id and node_access.user_id='$user_id') where node_parent='$poll_id' and template_id='1549834' order by node_id desc limit 1");
17
18 $set->next();
19 $array=$set->getRecord();
20 if ($array['node_permission']=='ban') $voted='yes';
21 else $voted='no';
22 }
23
24 $option_array=unserialize($array['node_content']);
25 $permission=$array['node_permission'];
26
27 $poll=Array("voted"=>$voted,"node_id"=>$array['node_id'],"question"=>$array['node_name'],"total"=>$array['node_views'],"options"=>$option_array);
28 $smarty->assign('get_poll',$poll);
29
30 }
31 ?>
This page took 0.298717 seconds and 3 git commands to generate.