public function dadosmethodAction() { $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"); $methodModel = new MethodModel(); $methodData = $methodModel->fetchAll($methodModel->getMethodByEachSupply()); $count = count($methodData); if ($count > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $methodData = $methodModel->fetchAll(null, "{$sidx} {$sord}", $limit, $page * $limit - $limit); $responce = new stdClass(); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i = 0; var_dump($methodData); foreach ($methodData as $row) { $responce->rows[$i]['cdmethod'] = $row->cdmethod; $responce->rows[$i]['cell'] = array($row->cdmethod, $row->nmmethod, $row->cdequipment, '', $row->cddocument); $i++; } $this->view->dadosmethod = $responce; }