function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->ref_cod_servidor = $_GET['ref_cod_servidor']; $this->ref_cod_instituicao = $_GET['ref_cod_instituicao']; $this->titulo = 'Servidor Formacao - 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 Formação', 'Tipo')); $this->campoOculto('ref_cod_servidor', $this->ref_cod_servidor); $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao); // Filtros $this->campoTexto('nm_formacao', 'Nome da Formação', $this->nm_formacao, 30, 255, FALSE); $opcoes = array('' => 'Selecione', 'C' => 'Cursos', 'T' => 'Títulos', 'O' => 'Concursos'); $this->campoLista('tipo', 'Tipo de Formação', $opcoes, $this->tipo); // Paginador $this->limite = 20; $this->offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; $obj_servidor_formacao = new clsPmieducarServidorFormacao(); $obj_servidor_formacao->setOrderby('nm_formacao ASC'); $obj_servidor_formacao->setLimite($this->limite, $this->offset); if (!isset($this->tipo)) { $this->tipo = NULL; } $lista = $obj_servidor_formacao->lista(NULL, NULL, NULL, $this->ref_cod_servidor, $this->nm_formacao, $this->tipo, NULL, NULL, NULL, 1); $total = $obj_servidor_formacao->_total; // UrlHelper $url = CoreExt_View_Helper_UrlHelper::getInstance(); $path = 'educar_servidor_formacao_det.php'; // Monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { // Pega detalhes de foreign_keys 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'; } if (class_exists('clsPmieducarServidor')) { $obj_ref_cod_servidor = new clsPmieducarServidor($registro['ref_cod_servidor']); $det_ref_cod_servidor = $obj_ref_cod_servidor->detalhe(); $registro['ref_cod_servidor'] = $det_ref_cod_servidor['cod_servidor']; } else { $registro['ref_cod_servidor'] = 'Erro na geracao'; } if ($registro['tipo'] == 'C') { $registro['tipo'] = 'Curso'; } elseif ($registro['tipo'] == 'T') { $registro['tipo'] = 'Título'; } else { $registro['tipo'] = 'Concurso'; } $options = array('query' => array('cod_formacao' => $registro['cod_formacao'])); $this->addLinhas(array($url->l($registro['nm_formacao'], $path, $options), $url->l($registro['tipo'], $path, $options))); $this->tipo = ''; } } $this->addPaginador2('educar_servidor_formacao_lst.php', $total, $_GET, $this->nome, $this->limite); $obj_permissoes = new clsPermissoes(); if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7)) { $this->array_botao[] = 'Novo'; $this->array_botao_url[] = sprintf('educar_servidor_formacao_cad.php?ref_cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao); } $this->array_botao[] = 'Voltar'; $this->array_botao_url[] = sprintf('educar_servidor_det.php?cod_servidor=%d&ref_cod_instituicao=%d', $this->ref_cod_servidor, $this->ref_cod_instituicao); $this->largura = '100%'; }