Ejemplo n.º 1
0
 function show()
 {
     $data['_action'] = 'manage';
     $this->verify_content_prms($data);
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 10;
     $limit = " limit {$offset}, {$count}";
     $orders = array('id');
     $descasc = strtoupper($this->input['hgupdn']);
     if ($descasc != 'ASC') {
         $descasc = 'DESC';
     }
     if (in_array($this->input['hgorder'], $orders)) {
         $orderby = ' ORDER BY ' . $this->input['hgorder'] . ' ' . $descasc;
     } else {
         $orderby = ' ORDER BY r.id desc ';
     }
     $condition = $this->get_condition();
     $obj = new Reply();
     $res = $obj->show($condition, $orderby, $limit);
     if (count($res)) {
         foreach ($res as $k => $v) {
             if ($v['state'] == '1') {
                 $v['state'] = '已审核';
             } else {
                 if ($v['state'] == '2') {
                     $v['state'] = '打回';
                 } else {
                     $v['state'] = '待审核';
                 }
             }
             if (!$v['answerer']) {
                 $v['answerer'] = $v['ip'];
             }
             $this->addItem($v);
         }
     }
     $this->output();
 }