/** * Método listarComunicados() * @access public * @param void * @return List */ public function listarComunicadosAction() { //header("Content-Type: text/html; charset=ISO-8859-1"); $this->_helper->layout->disableLayout(); $post = Zend_Registry::get('post'); $this->intTamPag = 1; $tbComunicados = new tbComunicados(); $where = array(); $periodo1 = $this->_request->getParam("periodo1"); $periodo2 = $this->_request->getParam("periodo2"); $stEstado = $this->_request->getParam("stEstado"); $stOpcao = $this->_request->getParam("stOpcao"); if (!empty($periodo1) && !empty($periodo1)) { $where['dtInicioVigencia >= ?'] = $periodo1; $where['dtTerminoVigencia <= ?'] = $periodo2; } if ($stEstado != '') { $where['stEstado = ?'] = $stEstado; } if ($stOpcao != '') { $where['stOpcao = ?'] = $stOpcao; } $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; $total = $tbComunicados->listarComunicados($where, 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("6 DESC"); $rs = $tbComunicados->listarComunicados($where, $ordem, $tamanho, $inicio); $this->view->registros = $rs; $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; }
/** * Método editar() * @access public * @param void * @return List */ public function editarAction() { $tbComunicados = new tbComunicados(); $idComunicado = $this->_request->getParam("idComunicado"); $where['idComunicado = ?'] = $idComunicado; $comunicado = $tbComunicados->listarComunicados($where); $this->view->comunicado = $comunicado; }