function pollAction() { $this->_helper->layout->setLayout('layout-polling'); $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/polling/layouts')); $pollId = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblPolling = new Pandamp_Modules_Misc_Poll_Model_Poll(); $time = time(); $date = date("Y-m-d H:i:s", $time); $rowPoll = $tblPolling->fetchAll("guid NOT IN('{$pollId}') AND checkedTime < '{$date}'", "checkedTime DESC"); $this->view->rowPoll = $rowPoll; $this->view->pollId = $pollId; }
public function fetchPollingAction() { $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $tblPoll = new Pandamp_Modules_Misc_Poll_Model_Poll(); $rowset = $tblPoll->fetchAll(null, null, $end, $start); $a = array(); $a['totalCount'] = count($rowset); $i = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $a['poll'][$i]['guid'] = $row->guid; $a['poll'][$i]['title'] = $row->title; $i++; } } if ($a['totalCount'] == 0) { $a['poll'][$i]['guid'] = ''; $a['poll'][$i]['title'] = ''; } echo Zend_Json::encode($a); }