public function indexAction() { //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); //Dt. Solicitacao $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.stPedidoAlteracao = ?'] = 'I'; $where['a.siVerificacao in (?)'] = array(0, 1); $where['e.tpAlteracaoProjeto = ?'] = 1; //Nome do Proponente if ($this->getIdOrgao == 166) { $where['b.Area = ?'] = 2; // quando for SAV/CGAV/CAP pega somente os projetos da área de Audiovisual } elseif ($this->getIdOrgao == 272) { $where['b.Area <> ?'] = 2; // quando for SEFIC/GEAR/SACAV pega somente os projetos das áreas que não sejam de Audiovisual } else { $where['b.Area = ?'] = 0; // quando for diferente de SAV/CGAV/CAP e SAV/CGAV/CAP pega somente os projetos da área de Audiovisual } $stCombo = 'A'; //Aguardando Análise if (isset($_GET['tipoFiltro']) && !empty($_GET['tipoFiltro'])) { $comboView = explode(':', $_GET['tipoFiltro']); $this->view->filtro = $_GET['tipoFiltro']; $where['e.tpAlteracaoProjeto = ?'] = $comboView[0]; if ($comboView[1] == 'd') { $stCombo = 'D'; //Devolvidos Após Análise } } if (isset($_POST['pronac']) && !empty($_POST['pronac']) || isset($_GET['pronac']) && !empty($_GET['pronac'])) { $where['b.AnoProjeto+b.Sequencial = ?'] = isset($_POST['pronac']) ? $_POST['pronac'] : $_GET['pronac']; $this->view->pronacProjeto = isset($_POST['pronac']) ? $_POST['pronac'] : $_GET['pronac']; } $tbPedidoAlteracaoProjeto = new tbPedidoAlteracaoProjeto(); if ($stCombo == 'A') { $where['e.stVerificacao = 0 or e.stVerificacao is null'] = ''; $total = $tbPedidoAlteracaoProjeto->painelCoordAcomp($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 = $tbPedidoAlteracaoProjeto->painelCoordAcomp($where, $order, $tamanho, $inicio); } else { $where['e.stVerificacao in (?)'] = array(2, 3); $where['f.stAvaliacaoItemPedidoAlteracao in (?)'] = array('AP', 'IN'); $where['g.stAtivo = ?'] = 0; $where['g.idTipoAgente = ?'] = 3; $total = $tbPedidoAlteracaoProjeto->painelCoordAcompDev($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 = $tbPedidoAlteracaoProjeto->painelCoordAcompDev($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); $db = Zend_Registry::get('db'); $db->setFetchMode(Zend_DB::FETCH_OBJ); // Chama o SQL da lista de Entidades Vinculadas - Técnico $sqllistasDeEntidadesVinculadas = ReadequacaoProjetos::retornaSQLlista("listasDeEntidadesVinculadas", $this->getIdOrgao); $listaEntidades = $db->fetchAll($sqllistasDeEntidadesVinculadas); // Chama o SQL da lista de Entidades Vinculadas - Parecerista $sqllistasDeEntidadesVinculadasPar = ReadequacaoProjetos::retornaSQLlista("listasDeEntidadesVinculadasPar", "NULL"); $listaEntidadesPar = $db->fetchAll($sqllistasDeEntidadesVinculadasPar); $this->view->paginacao = $paginacao; $this->view->qtdDocumentos = $total; $this->view->dados = $busca; $this->view->intTamPag = $this->intTamPag; $this->view->listaEntidades = $listaEntidades; $this->view->listaEntidadesPar = $listaEntidadesPar; $this->view->statusCombo = $stCombo; }