function Gerar() { $this->campoOculto('cod_servidor', $this->cod_servidor); $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao); $obj_categoria = new clsPmieducarCategoriaNivel(); $lst_categoria = $obj_categoria->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); $opcoes = array('' => 'Selecione uma categoria'); if ($lst_categoria) { foreach ($lst_categoria as $categoria) { $opcoes[$categoria['cod_categoria_nivel']] = $categoria['nm_categoria_nivel']; } } $this->campoLista('ref_cod_categoria', 'Categoria', $opcoes, $this->ref_cod_categoria); $opcoes = array('' => 'Selecione uma categoria'); if ($this->ref_cod_categoria) { $obj_nivel = new clsPmieducarNivel(); $lst_nivel = $obj_nivel->buscaSequenciaNivel($this->ref_cod_categoria); if ($lst_nivel) { foreach ($lst_nivel as $nivel) { $opcoes[$nivel['cod_nivel']] = $nivel['nm_nivel']; } } } $this->campoLista('ref_cod_nivel', 'Nível', $opcoes, $this->ref_cod_nivel, '', TRUE); $opcoes = array('' => 'Selecione um nível'); if ($this->ref_cod_nivel) { $obj_nivel = new clsPmieducarSubnivel(); $lst_nivel = $obj_nivel->buscaSequenciaSubniveis($this->ref_cod_nivel); if ($lst_nivel) { foreach ($lst_nivel as $subnivel) { $opcoes[$subnivel['cod_subnivel']] = $subnivel['nm_subnivel']; } } } $this->campoLista('ref_cod_subnivel', 'Subnível', $opcoes, $this->ref_cod_subnivel, '', FALSE, '', '', FALSE, TRUE); }
public function Gerar() { session_start(); $this->__pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->__titulo = 'Categoria Nivel - Listagem'; // passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { $this->{$var} = $val === "" ? NULL : $val; } $this->addBanner('imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->addCabecalhos(array('Nome Categoria Nivel')); // Filtros $this->campoTexto('nm_categoria_nivel', 'Nome Categoria Nivel', $this->nm_categoria_nivel, 30, 255, FALSE); // Paginador $this->__limite = 20; $this->__offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->__limite - $this->__limite : 0; $obj_categoria_nivel = new clsPmieducarCategoriaNivel(); $obj_categoria_nivel->setOrderby('nm_categoria_nivel ASC'); $obj_categoria_nivel->setLimite($this->__limite, $this->__offset); $lista = $obj_categoria_nivel->lista(NULL, NULL, $this->nm_categoria_nivel, NULL, NULL, NULL, NULL, NULL, 1); $total = $obj_categoria_nivel->_total; // Monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { // muda os campos data $registro['data_cadastro_time'] = strtotime(substr($registro['data_cadastro'], 0, 16)); $registro['data_cadastro_br'] = date('d/m/Y H:i', $registro['data_cadastro_time']); $registro['data_exclusao_time'] = strtotime(substr($registro['data_exclusao'], 0, 16)); $registro['data_exclusao_br'] = date('d/m/Y H:i', $registro['data_exclusao_time']); // pega detalhes de foreign_keys if (class_exists('clsPmieducarUsuario')) { $obj_ref_usuario_cad = new clsPmieducarUsuario($registro['ref_usuario_cad']); $det_ref_usuario_cad = $obj_ref_usuario_cad->detalhe(); $registro['ref_usuario_cad'] = $det_ref_usuario_cad['data_cadastro']; } else { $registro['ref_usuario_cad'] = 'Erro na geracao'; } if (class_exists('clsPmieducarUsuario')) { $obj_ref_usuario_exc = new clsPmieducarUsuario($registro['ref_usuario_exc']); $det_ref_usuario_exc = $obj_ref_usuario_exc->detalhe(); $registro['ref_usuario_exc'] = $det_ref_usuario_exc['data_cadastro']; } else { $registro['ref_usuario_exc'] = 'Erro na geracao'; } $this->addLinhas(array(sprintf('<a href="educar_categoria_nivel_det.php?cod_categoria_nivel=%s">%s</a>', $registro['cod_categoria_nivel'], $registro['nm_categoria_nivel']))); } } $this->addPaginador2('educar_categoria_nivel_lst.php', $total, $_GET, $this->nome, $this->__limite); $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(829, $this->__pessoa_logada, 3, NULL, TRUE)) { $this->acao = 'go("educar_categoria_nivel_cad.php")'; $this->nome_acao = 'Novo'; } $this->largura = '100%'; }