From dfefcf11676a06a1a71c2c65ec7d118dec48a1a3 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Tue, 15 Jun 2010 15:04:58 +0000 Subject: [PATCH] Refactoring para coding standards --- ieducar/intranet/educar_servidor_lst.php | 410 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 file changed, 211 insertions(+), 199 deletions(-) diff --git a/ieducar/intranet/educar_servidor_lst.php b/ieducar/intranet/educar_servidor_lst.php index 9cbc518..f0000b7 100644 --- a/ieducar/intranet/educar_servidor_lst.php +++ b/ieducar/intranet/educar_servidor_lst.php @@ -1,210 +1,222 @@ + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsListagem.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/pmieducar/geral.inc.php'; + +require_once 'CoreExt/View/Helper/UrlHelper.php'; + +/** + * clsIndexBase class. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Classe disponível desde a versão 1.0.0 + * @version @@package_version@@ + */ class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor" ); - $this->processoAp = "635"; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Servidor'); + $this->processoAp = 635; + } } +/** + * indice class. + * + * @author Prefeitura Municipal de Itajaí + * @category i-Educar + * @license @@license@@ + * @package iEd_Pmieducar + * @since Classe disponível desde a versão 1.0.0 + * @version @@package_version@@ + */ class indice extends clsListagem { - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - /** - * Titulo no topo da pagina - * - * @var int - */ - var $titulo; - - /** - * Quantidade de registros a ser apresentada em cada pagina - * - * @var int - */ - var $limite; - - /** - * Inicio dos registros a serem exibidos (limit) - * - * @var int - */ - var $offset; - - var $cod_servidor; - var $ref_cod_deficiencia; - var $ref_idesco; - var $ref_cod_funcao; - var $carga_horaria; - var $data_cadastro; - var $data_exclusao; - var $ativo; - - var $ref_cod_instituicao; - - function Gerar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - session_write_close(); - - $this->titulo = "Servidor - Listagem"; - - foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto - $this->$var = ( $val === "" ) ? null: $val; - - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); - - $this->addCabecalhos( array( - "Nome do Servidor", - "Matrícula", - "Instituição" - ) ); - -// $get_escola = true; - include("include/pmieducar/educar_campo_lista.php"); - $opcoes = array( "" => "Pesquise o funcionario clicando na lupa ao lado" ); - if( $this->cod_servidor ) - { - $objTemp = new clsFuncionario( $this->cod_servidor ); - $detalhe = $objTemp->detalhe(); - $detalhe = $detalhe["idpes"]->detalhe(); - $opcoes["{$detalhe["idpes"]}"] = $detalhe["nome"]; - } - $parametros = new clsParametrosPesquisas(); - $parametros->setSubmit( 0 ); - $parametros->adicionaCampoSelect( "cod_servidor", "ref_cod_pessoa_fj", "nome" ); - $this->campoListaPesq( "cod_servidor", "Servidor", $opcoes, $this->cod_servidor, "pesquisa_funcionario_lst.php", "", false, "", "", null, null, "", false, $parametros->serializaCampos()."&com_matricula=false", true ); - - - // Paginador - $this->limite = 20; - $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; - - $obj_servidor = new clsPmieducarServidor(); - $obj_servidor->setOrderby( "carga_horaria ASC" ); - $obj_servidor->setLimite( $this->limite, $this->offset ); - - $lista = $obj_servidor->lista( - $this->cod_servidor, - $this->ref_cod_deficiencia, - $this->ref_idesco, - $this->carga_horaria, - null, - null, - null, - null, - 1, - $this->ref_cod_instituicao - ,null - ,null - ,null - ,null - ,null - ,null - ,true - ); - - $total = $obj_servidor->_total; - - // monta a lista - if( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista AS $registro ) - { - - // pega detalhes de foreign_keys - if( class_exists( "clsPmieducarInstituicao" ) ) - { - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"]; - } - else - { - $registro["ref_cod_instituicao"] = "Erro na geração"; - echo ""; - } - - if( class_exists( "clsFuncionario" ) ) - { - $obj_cod_servidor = new clsFuncionario( $registro["cod_servidor"] ); - $det_cod_servidor = $obj_cod_servidor->detalhe(); - $registro["matricula"] = $det_cod_servidor['matricula']; - $det_cod_servidor = $det_cod_servidor["idpes"]->detalhe(); - $registro["nome"] = $det_cod_servidor["nome"]; - - } - else - { - $registro["cod_servidor"] = "Erro na geracao"; - echo ""; - } - - $this->addLinhas( array( - "{$registro["nome"]}", - "{$registro["matricula"]}", - "{$registro["ref_cod_instituicao"]}" - - ) ); - } - } - $this->addPaginador2( "educar_servidor_lst.php", $total, $_GET, $this->nome, $this->limite ); - $obj_permissoes = new clsPermissoes(); - - - if( $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 3 ) ) - { - $this->acao = "go(\"educar_servidor_cad.php\")"; - $this->nome_acao = "Novo"; - } - - $this->largura = "100%"; - } + var $pessoa_logada; + var $titulo; + var $limite; + var $offset; + + var $cod_servidor; + var $ref_cod_deficiencia; + var $ref_idesco; + var $ref_cod_funcao; + var $carga_horaria; + var $data_cadastro; + var $data_exclusao; + var $ativo; + + var $ref_cod_instituicao; + + function Gerar() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $this->titulo = 'Servidor - 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 do Servidor', + 'Matrícula', + 'Instituição' + )); + + include 'include/pmieducar/educar_campo_lista.php'; + + $opcoes = array('' => 'Pesquise o funcionario clicando na lupa ao lado'); + + if ($this->cod_servidor) { + $objTemp = new clsFuncionario($this->cod_servidor); + $detalhe = $objTemp->detalhe(); + $detalhe = $detalhe['idpes']->detalhe(); + + $opcoes[$detalhe['idpes']] = $detalhe['nome']; + } + + $parametros = new clsParametrosPesquisas(); + $parametros->setSubmit(0); + $parametros->adicionaCampoSelect( 'cod_servidor', 'ref_cod_pessoa_fj', 'nome'); + + $this->campoListaPesq( 'cod_servidor', 'Servidor', $opcoes, $this->cod_servidor, + 'pesquisa_funcionario_lst.php', '', FALSE, '', '', NULL, NULL, '', FALSE, + $parametros->serializaCampos() . '&com_matricula=false', TRUE); + + // Paginador + $this->limite = 20; + $this->offset = ($_GET['pagina_' . $this->nome]) ? + $_GET['pagina_' . $this->nome] * $this->limite - $this->limite : 0; + + $obj_servidor = new clsPmieducarServidor(); + $obj_servidor->setOrderby('carga_horaria ASC'); + $obj_servidor->setLimite($this->limite, $this->offset); + + $lista = $obj_servidor->lista( + $this->cod_servidor, + $this->ref_cod_deficiencia, + $this->ref_idesco, + $this->carga_horaria, + NULL, + NULL, + NULL, + NULL, + 1, + $this->ref_cod_instituicao, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + TRUE + ); + + $total = $obj_servidor->_total; + + // UrlHelper + $url = CoreExt_View_Helper_UrlHelper::getInstance(); + + // Monta a lista + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + // Pega detalhes de foreign_keys + if (class_exists('clsPmieducarInstituicao')) { + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); + + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao']; + } + else { + $registro['ref_cod_instituicao'] = 'Erro na geração'; + } + + if (class_exists('clsFuncionario')) { + $obj_cod_servidor = new clsFuncionario($registro['cod_servidor']); + $det_cod_servidor = $obj_cod_servidor->detalhe(); + $registro['matricula'] = $det_cod_servidor['matricula']; + $det_cod_servidor = $det_cod_servidor['idpes']->detalhe(); + $registro['nome'] = $det_cod_servidor['nome']; + } + else { + $registro['cod_servidor'] = 'Erro na geracao'; + } + + $path = 'educar_servidor_det.php'; + $options = array( + 'query' => array( + 'cod_servidor' => $registro['cod_servidor'], + 'ref_cod_instituicao' => $det_ref_cod_instituicao['cod_instituicao'], + )); + + $this->addLinhas(array( + $url->l($registro['nome'], $path, $options), + $url->l($registro['matricula'], $path, $options), + $url->l($registro['ref_cod_instituicao'], $path, $options), + )); + } + } + + $this->addPaginador2('educar_servidor_lst.php', $total, $_GET, $this->nome, $this->limite); + $obj_permissoes = new clsPermissoes(); + + if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 3)) { + $this->acao = 'go("educar_servidor_cad.php")'; + $this->nome_acao = 'Novo'; + } + + $this->largura = '100%'; + } } -// cria uma extensao da classe base + +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html -$pagina->MakeAll(); -?> \ No newline at end of file + +// Atribui o conteúdo à  página +$pagina->addForm($miolo); + +// Gera o código HTML +$pagina->MakeAll(); \ No newline at end of file -- libgit2 0.21.2