Exemplo n.º 1
0
 function dadosupplyAction()
 {
     $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");
     $supplyModel = new SupplyModel();
     $supply = $supplyModel->fetchALL();
     $count = count($supply);
     if ($count > 0 && $limit > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $supply = $supplyModel->fetchALL($supplyModel->getAllSupplyGrid($sidx, $sord, $limit, $page));
     $responce = new stdClass();
     $responce->page = $page;
     $responce->total = $total_pages;
     $responce->records = $count;
     $i = 0;
     foreach ($supply as $row) {
         $responce->rows[$i]['cdsupply'] = $row->cdsupply;
         $responce->rows[$i]['cell'] = array($row->nmsupply, $row->nmsupplytype, $row->idnotation, $row->cdsupply);
         $i++;
     }
     $this->view->dadosupply = $responce;
 }