public function gridAction() { //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('NomeProjeto'); $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(); if (isset($_POST['pronac']) && !empty($_POST['pronac']) || isset($_GET['pronac']) && !empty($_GET['pronac'])) { $where['pr.AnoProjeto+pr.Sequencial = ?'] = isset($_POST['pronac']) ? $_POST['pronac'] : $_GET['pronac']; $this->view->pronacProjeto = isset($_POST['pronac']) ? $_POST['pronac'] : $_GET['pronac']; } if ($this->grupoAtivo == 134 && (isset($_POST['tipoFiltro']) || isset($_GET['tipoFiltro']))) { //Coordenador $filtro = isset($_POST['tipoFiltro']) ? $_POST['tipoFiltro'] : $_GET['tipoFiltro']; $this->view->filtro = $filtro; switch ($filtro) { case '': $where['b.stFiscalizacaoProjeto in (?)'] = array('0', '1'); break; case 'analisados': $where['b.stFiscalizacaoProjeto = ?'] = '2'; $this->view->nmPagina = 'Fiscalização concluída pelo técnico'; break; case 'concluidos': $where['b.stFiscalizacaoProjeto = ?'] = '3'; $this->view->nmPagina = 'Fiscalização concluída pelo coordenador'; break; } } else { //Técnico $where['b.stFiscalizacaoProjeto in (?)'] = array('0', '1'); //$where['b.stFiscalizacaoProjeto in (?)'] = array('1'); //$where['b.idUsuarioInterno = ?'] = $this->codUsuario; } if ((isset($_POST['tecFiltro']) || isset($_GET['tecFiltro'])) && (!empty($_POST['tecFiltro']) || !empty($_GET['tecFiltro']))) { $tecnico = isset($_POST['tecFiltro']) ? $_POST['tecFiltro'] : $_GET['tecFiltro']; $this->view->tecnico = $tecnico; $where['b.idUsuarioInterno = ?'] = $tecnico; } $projetos = new Projetos(); $total = $projetos->painelFiscalizacaoProjetos($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 = $projetos->painelFiscalizacaoProjetos($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->qntdProjetos = $total; $this->view->dados = $busca; $this->view->intTamPag = $this->intTamPag; $pa = new paUsuariosDoPerfil(); $usuarios = $pa->buscarUsuarios(134, $this->codOrgao); $this->view->Usuarios = $usuarios; }