public function indexAction() { $pag = 1; $get = Zend_Registry::get('get'); if (isset($get->pag)) { $pag = $get->pag; } if (isset($get->tamPag)) { $this->intTamPag = $get->tamPag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; $tblreuniao = new tbreuniao(); $total = $tblreuniao->pegaTotal(); $tamanho = $inicio + $this->intTamPag <= $total ? $this->intTamPag : $total - ($inicio + $this->intTamPag); $fim = $inicio + $this->intTamPag; $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag; $campo = !empty($_GET['campo']) ? $_GET['campo'] : "NrReuniao"; $ordem = !empty($_GET['ordem']) ? $_GET['ordem'] : "desc"; $this->view->ordemlista = $ordem; $order = array($campo . " " . $ordem); $reunioes = $tblreuniao->listar(array(), $order, $tamanho, $inicio); $this->view->reunioies = $reunioes; if ($fim > $total) { $fim = $total; } $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1); $paginacao = array("pag" => $pag, "total" => $total, "inicio" => $inicio + 1, "fim" => $fim, "totalPag" => $totalPag, "Itenspag" => $this->intTamPag, "tamanho" => $tamanho); $this->view->paginacao = $paginacao; if (!empty($_POST['colunasFim'])) { $ordem = $_POST['colunasFim']; //xd($ordem); } else { $ordem = array("N.Reuniao", "Dt.Inicio", "Dt.Final", "Dt.Fechamento", "Mecanismo", "Status"); } //xd($ordem); $this->view->ordem = $ordem; }