public function dadosexaminationdepartmentAction() { $this->_helper->layout->disableLayout(); $page = $this->_request->getParam("page", 1); $limit = $this->_request->getParam("rows"); $sidx = $this->_request->getParam("sidx", 1); $sord = $this->_request->getParam("sord"); $cdexamination = $this->_request->getParam("cdexamination"); $examinationModel = new ExaminationModel(); $examinationData = $examinationModel->fetchAll($examinationModel->getByExaminationDepartment($cdexamination)); $count = count($examinationData); if ($count > 0 && $limit != 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } //$examinationData = $examinationModel->fetchAll(null, "$sidx $sord", $limit, ($page*$limit-$limit)); $responce = new stdClass(); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i = 0; foreach ($examinationData as $row) { $responce->rows[$i]['cdexamination'] = $row->cdexamination; $responce->rows[$i]['cell'] = array($row->nmdepartment, $row->cddepartment); $i++; } $this->view->dadosexaminationdepartment = $responce; }