| 1 | <?php |
| 2 | // extracts number of users who have execute permission on K |
| 3 | // that means they are cittizens |
| 4 | |
| 5 | function smarty_function_get_citizen_count($params,&$smarty) { |
| 6 | global $db, $error, $node; |
| 7 | // $node_handle=$node['node_id']; |
| 8 | |
| 9 | $q="select count(user_id) as citizens from nodes left join node_access on nodes.node_id=node_access.node_id where nodes.node_id=1961061 and node_access.node_permission='execute'"; |
| 10 | $set=$db->query($q); |
| 11 | |
| 12 | if ($set->next()) { |
| 13 | $count=$set->getString('citizens'); |
| 14 | }else{ |
| 15 | $count="error?!?"; |
| 16 | } |
| 17 | $need=1+floor(log($count,"1.42")); |
| 18 | $smarty->assign('get_citizen_count',$count); |
| 19 | $smarty->assign('get_citizen_count_need',$need); |
| 20 | } |
| 21 | |
| 22 | ?> |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |