示例#1
0
             $chart_data .= '\\n';
         }
         $chart_data .= $v['title'] . ';' . $v['polls'];
     }
     include tpl('poll_stats', $module);
     break;
 case 'item':
     $pollid = isset($pollid) ? intval($pollid) : 0;
     $pollid or msg();
     $menus = array(array('选项管理', '?moduleid=' . $moduleid . '&file=' . $file . '&pollid=' . $pollid . '&action=item'), array('投票记录', '?moduleid=' . $moduleid . '&file=' . $file . '&pollid=' . $pollid . '&action=record'), array('统计报表', '?moduleid=' . $moduleid . '&file=' . $file . '&pollid=' . $pollid . '&action=stats'));
     $itemid = $pollid;
     $do->itemid = $itemid;
     $P = $do->get_one();
     $P or msg('票选不存在');
     if ($submit) {
         $do->item_update($post);
         $t = $db->get_one("SELECT SUM(polls) AS total FROM {$DT_PRE}poll_item WHERE pollid={$itemid}");
         if ($t['total'] != $P['poll']) {
             $db->query("UPDATE {$DT_PRE}poll SET polls={$t['total']} WHERE itemid={$itemid}");
         }
         dmsg('更新成功', '?moduleid=' . $moduleid . '&file=' . $file . '&action=' . $action . '&pollid=' . $itemid);
     } else {
         $sorder = array('结果排序方式', '投票次数降序', '投票次数升序');
         $dorder = array('listorder DESC,itemid DESC', 'polls DESC', 'polls ASC');
         $sfields = array('标题', '简介', '链接');
         $dfields = array('title', 'introduce', 'linkurl');
         isset($fields) && isset($dfields[$fields]) or $fields = 0;
         isset($order) && isset($dorder[$order]) or $order = 0;
         $fields_select = dselect($sfields, 'fields', '', $fields);
         $order_select = dselect($sorder, 'order', '', $order);
         $condition = "pollid={$itemid}";