/** * * @return array */ public function listAction() { $this->view->page = $page = $this->getRequest()->getParam('page') ?: 1; if ($this->getRequest()->isPost()) { $this->view->post = $post = $this->getRequest()->getParams(); } $total = PollResponseQuery::create()->filter($post)->count(); $this->view->pollResponses = $pollResponses = PollResponseQuery::create()->filter($post)->page($page, $this->getMaxPerPage())->find(); $this->view->paginator = $this->createPaginator($total, $page); $this->view->polls = \Application\Query\PollQuery::create()->find()->toCombo(); $this->view->questions = \Application\Query\QuestionQuery::create()->find()->toCombo(); $this->view->npdSheets = \Application\Query\NpdSheetQuery::create()->find()->toCombo(); $this->view->respondents = \Application\Query\RespondentQuery::create()->find()->toCombo(); }
/** * */ public function getListResultsAction() { $params = $this->getRequest()->getParams(); $params['name'] = !empty($params['name']) ? "%" . $params['name'] . "%" : null; $polls = PollQuery::create()->filter($params)->page($params['page'], $this->getMaxPerPage())->find(); while ($poll = $polls->read()) { $poll->setName(utf8_encode($poll->getName())); } die(json_encode($polls->toArray())); }
/** * */ public function exportToExcelAction() { $focusGroups = FocusGroupQuery::create()->find(); $i = 0; while ($focusGroup = $focusGroups->read()) { $content[$i][] = $focusGroup->getIdFocusGroups(); $content[$i][] = $focusGroup->getName(); $content[$i][] = PollQuery::create()->findByPK($focusGroup->getIdPoll())->getName(); $i++; } $title = $this->i18n->_('Focus Group Report'); $filename = 'focus_group_report'; $headers = array('Id Focus Group', 'Name', 'Poll'); $report = new SimpleListReport(); $report->setTableContent($content); $report->setTableHeaders($headers); $report->setTableTitle($title); $report->setFilename($filename); $report->createSpreadsheet(); }