public function analisarReadequacoesCnicAction() { if ($this->idPerfil != 118) { parent::message("Você não tem permissão para acessar essa área do sistema!", "principal", "ALERT"); } //DEFINE PARAMETROS DE ORDENACAO / QTDE. REG POR PAG. / PAGINACAO if ($this->_request->getParam("qtde")) { $this->intTamPag = $this->_request->getParam("qtde"); } $order = array(); //==== parametro de ordenacao ======// if ($this->_request->getParam("ordem")) { $ordem = $this->_request->getParam("ordem"); if ($ordem == "ASC") { $novaOrdem = "DESC"; } else { $novaOrdem = "ASC"; } } else { $ordem = "ASC"; $novaOrdem = "ASC"; } //==== campo de ordenacao ======// if ($this->_request->getParam("campo")) { $campo = $this->_request->getParam("campo"); $order = array($campo . " " . $ordem); $ordenacao = "&campo=" . $campo . "&ordem=" . $ordem; } else { $campo = null; $order = array(2); //idReadequacao $ordenacao = null; } $pag = 1; $get = Zend_Registry::get('get'); if (isset($get->pag)) { $pag = $get->pag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; /* ================== PAGINACAO ======================*/ $where = array(); $where['a.stEstado = ?'] = 0; // 0=Atual; 1=Historico $where['a.siEncaminhamento = ?'] = 7; // 7=Encaminhar para ao Componente da Comissão $where['d.idUnidade = ?'] = 400; // CNIC $where['d.idAvaliador = ?'] = $this->idUsuario; if (isset($_GET['pronac']) && !empty($_GET['pronac'])) { $where['b.AnoProjeto+b.Sequencial = ?'] = $_GET['pronac']; $this->view->pronac = $_GET['pronac']; } $tbReadequacao = new tbReadequacao(); $total = $tbReadequacao->painelReadequacoesComponente($where, $order, null, null, true); $fim = $inicio + $this->intTamPag; $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1); $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag; $busca = $tbReadequacao->painelReadequacoesComponente($where, $order, $tamanho, $inicio); $paginacao = array("pag" => $pag, "qtde" => $this->intTamPag, "campo" => $campo, "ordem" => $ordem, "ordenacao" => $ordenacao, "novaOrdem" => $novaOrdem, "total" => $total, "inicio" => $inicio + 1, "fim" => $fim, "totalPag" => $totalPag, "Itenspag" => $this->intTamPag, "tamanho" => $tamanho); $this->view->paginacao = $paginacao; $this->view->qtdRegistros = $total; $this->view->dados = $busca; $this->view->intTamPag = $this->intTamPag; }