public function listarProjetosProponenteAction() { header("Content-Type: text/html; charset=ISO-8859-1"); $this->_helper->layout->disableLayout(); $post = Zend_Registry::get('post'); $this->intTamPag = 30; $cpfCnpj = $this->_request->getParam("CgcCpf"); $pag = 1; //$get = Zend_Registry::get('get'); if (isset($post->pag)) { $pag = $post->pag; } if (isset($post->tamPag)) { $this->intTamPag = $post->tamPag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; $fim = $inicio + $this->intTamPag; $arrBusca = array(); $arrBusca['p.CgcCpf = ?'] = $cpfCnpj; $tblProjetos = new Projetos(); $total = $tblProjetos->buscarProjetosProponente($arrBusca, array(), null, null, true); //xd($total); $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1); $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag; if ($fim > $total) { $fim = $total; } $ordem = array("7", "8"); if (!empty($post->ordenacao)) { $ordem[] = "{$post->ordenacao} {$post->tipoOrdenacao}"; } $rsProjetos = $tblProjetos->buscarProjetosProponente($arrBusca, $ordem, $tamanho, $inicio); $arrProjetos = array(); $arrValores = array(); foreach ($rsProjetos as $projeto) { $arrProjetos[$projeto->stEstado][$projeto->Situacao][] = $projeto; $arrValores[$projeto->stEstado]['vlSolicitado'][] = $projeto->Solicitado; $arrValores[$projeto->stEstado]['vlAprovado'][] = $projeto->Aprovado; $arrValores[$projeto->stEstado]['vlCaptado'][] = $projeto->Captado; } $this->view->CgcCpf = $cpfCnpj; $this->view->registros = $arrProjetos; $this->view->valores = $arrValores; $this->view->pag = $pag; $this->view->total = $total; $this->view->inicio = $inicio + 1; $this->view->fim = $fim; $this->view->totalPag = $totalPag; $this->view->parametrosBusca = $_POST; }