From fad0303bbbcc4c39f338cb0ebb10402adad27f41 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Thu, 3 Sep 2009 06:15:26 +0000 Subject: [PATCH] Refactoring para coding standards --- ieducar/intranet/educar_relatorio_registro_transferencias.php | 236 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/educar_relatorio_registro_transferencias_proc.php | 396 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 322 insertions(+), 310 deletions(-) diff --git a/ieducar/intranet/educar_relatorio_registro_transferencias.php b/ieducar/intranet/educar_relatorio_registro_transferencias.php index ba9ea94..1bc325f 100644 --- a/ieducar/intranet/educar_relatorio_registro_transferencias.php +++ b/ieducar/intranet/educar_relatorio_registro_transferencias.php @@ -1,144 +1,136 @@ + * + * 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í + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage pmieducar + * @subpackage Matricula + * @subpackage SolicitacaoTransferencia + * @subpackage Relatorio + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsCadastro.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/pmieducar/geral.inc.php'; +require_once 'include/clsPDF.inc.php'; class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} i-Educar - Registro de Matrículas" ); - $this->processoAp = "693"; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Registro de Matrículas'); + $this->processoAp = '693'; + } } class indice extends clsCadastro { - - - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - - var $ref_cod_instituicao; - var $ref_cod_escola; - - - var $ano; - - var $nm_escola; - var $nm_instituicao; - - var $pdf; - - - var $page_y = 139; - - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - return $retorno; - } - - function Gerar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - if($_POST){ - foreach ($_POST as $key => $value) { - $this->$key = $value; - - } - } - - $this->ano = $ano_atual = date("Y"); - - $this->campoNumero( "ano", "Ano", $this->ano, 4, 4, true ); - - $get_escola = true; - $obrigatorio = false; - $instituicao_obrigatorio = true; - $escola_obrigatorio = true; - - include("include/pmieducar/educar_campo_lista.php"); - - if($this->ref_cod_escola) - $this->ref_ref_cod_escola = $this->ref_cod_escola; - - $this->url_cancelar = "educar_index.php"; - $this->nome_url_cancelar = "Cancelar"; - - $this->acao_enviar = 'acao2()'; - $this->acao_executa_submit = false; - - } - - - + /** + * Referência a usuário da sessão. + * @var int + */ + var $pessoa_logada; + + var $ref_cod_instituicao; + var $ref_cod_escola; + var $ano; + var $nm_escola; + var $nm_instituicao; + + var $pdf; + var $page_y = 139; + + function Inicializar() + { + $retorno = 'Novo'; + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + return $retorno; + } + + function Gerar() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + if ($_POST) { + foreach ($_POST as $key => $value) { + $this->$key = $value; + } + } + + $this->ano = $ano_atual = date('Y'); + $this->campoNumero('ano', 'Ano', $this->ano, 4, 4, TRUE); + + $get_escola = TRUE; + $obrigatorio = FALSE; + $instituicao_obrigatorio = TRUE; + $escola_obrigatorio = TRUE; + + include 'include/pmieducar/educar_campo_lista.php'; + + if ($this->ref_cod_escola) { + $this->ref_ref_cod_escola = $this->ref_cod_escola; + } + + $this->url_cancelar = 'educar_index.php'; + $this->nome_url_cancelar = 'Cancelar'; + + $this->acao_enviar = 'acao2()'; + $this->acao_executa_submit = FALSE; + } } -// 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 diff --git a/ieducar/intranet/educar_relatorio_registro_transferencias_proc.php b/ieducar/intranet/educar_relatorio_registro_transferencias_proc.php index 1790691..b62896a 100644 --- a/ieducar/intranet/educar_relatorio_registro_transferencias_proc.php +++ b/ieducar/intranet/educar_relatorio_registro_transferencias_proc.php @@ -1,6 +1,6 @@ * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL * @package Core - * @subpackage Relatório + * @subpackage pmieducar + * @subpackage Matricula + * @subpackage SolicitacaoTransferencia + * @subpackage Relatorio * @since Arquivo disponível desde a versão 1.0.0 * @version $Id$ */ @@ -43,150 +42,140 @@ class clsIndexBase extends clsBase { function Formular() { - $this->SetTitulo( "{$this->_instituicao} i-Educar - Registro de Matrículas" ); - $this->processoAp = "693"; - $this->renderMenu = false; - $this->renderMenuSuspenso = false; + $this->SetTitulo($this->_instituicao . ' i-Educar - Registro de Matrículas'); + $this->processoAp = '916'; + $this->renderMenu = FALSE; + $this->renderMenuSuspenso = FALSE; } } class indice extends clsCadastro { - - /** - * Referencia pega da session para o idpes do usuario atual - * + * Referência a usuário da sessão. * @var int */ var $pessoa_logada; - var $ref_cod_instituicao; var $ref_cod_escola; var $ref_cod_serie; var $ref_cod_curso; - var $ano; - var $nm_escola; var $nm_instituicao; var $nm_curso; var $pdf; - var $page_y = 139; - var $get_link; - var $campo_assinatura; - var $total = 0; var $meses_do_ano = array( - "1" => "JANEIRO" - ,"2" => "FEVEREIRO" - ,"3" => "MARÇO" - ,"4" => "ABRIL" - ,"5" => "MAIO" - ,"6" => "JUNHO" - ,"7" => "JULHO" - ,"8" => "AGOSTO" - ,"9" => "SETEMBRO" - ,"10" => "OUTUBRO" - ,"11" => "NOVEMBRO" - ,"12" => "DEZEMBRO" - ); + '1' => 'JANEIRO', + '2' => 'FEVEREIRO', + '3' => 'MARÇO', + '4' => 'ABRIL', + '5' => 'MAIO', + '6' => 'JUNHO', + '7' => 'JULHO', + '8' => 'AGOSTO', + '9' => 'SETEMBRO', + '10' => 'OUTUBRO', + '11' => 'NOVEMBRO', + '12' => 'DEZEMBRO' + ); function renderHTML() { + $this->ref_cod_instituicao = $_POST['ref_cod_instituicao']; + $this->ref_cod_escola = $_POST['ref_cod_escola']; + $this->ano = $_POST['ano']; - $this->ref_cod_instituicao = $_POST["ref_cod_instituicao"]; - $this->ref_cod_escola = $_POST["ref_cod_escola"]; - $this->ano = $_POST['ano']; - - $fonte = 'arial'; + $fonte = 'arial'; $corTexto = '#000000'; - if (is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola)) - { - + if (is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola)) { $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao); $det_instituicao = $obj_instituicao->detalhe(); $this->nm_instituicao = $det_instituicao["nm_instituicao"]; - $sql = " SELECT - fantasia as nome - FROM - pmieducar.escola - , cadastro.juridica - WHERE - ref_cod_instituicao = {$this->ref_cod_instituicao} - AND idpes = ref_idpes - AND cod_escola = {$this->ref_cod_escola} - AND ativo = 1 - UNION - SELECT - nm_escola - FROM - pmieducar.escola - , pmieducar.escola_complemento - WHERE - ref_cod_instituicao = {$this->ref_cod_instituicao} - AND cod_escola = ref_cod_escola - AND cod_escola = {$this->ref_cod_escola} - AND escola.ativo = 1"; + $sql = " + SELECT + fantasia as nome + FROM + pmieducar.escola, + cadastro.juridica + WHERE + ref_cod_instituicao = {$this->ref_cod_instituicao} + AND idpes = ref_idpes + AND cod_escola = {$this->ref_cod_escola} + AND ativo = 1 + UNION + SELECT + nm_escola + FROM + pmieducar.escola, + pmieducar.escola_complemento + WHERE + ref_cod_instituicao = {$this->ref_cod_instituicao} + AND cod_escola = ref_cod_escola + AND cod_escola = {$this->ref_cod_escola} + AND escola.ativo = 1"; + $db = new clsBanco(); $this->nm_escola = $db->CampoUnico($sql); - $sql = "SELECT - cod_matricula, - m.ref_cod_aluno, - (SELECT nome FROM cadastro.pessoa p, pmieducar.aluno a WHERE - a.cod_aluno = m.ref_cod_aluno AND a.ref_idpes = p.idpes) as nome_aluno, - to_char(data_transferencia,'DD/MM/YYYY') as dt_transferencia, - s.nm_serie, - t.nm_turma, - ts.ref_cod_matricula_entrada - FROM - pmieducar.matricula m, - pmieducar.matricula_turma mt, - pmieducar.turma t, - pmieducar.serie s, - pmieducar.transferencia_solicitacao ts - WHERE - m.ref_ref_cod_escola = {$this->ref_cod_escola} - AND ref_cod_matricula_saida = cod_matricula - AND ts.ativo = 1 - AND mt.ref_cod_matricula = m.cod_matricula - AND mt.ref_cod_turma = t.cod_turma - AND t.ref_ref_cod_serie = s.cod_serie - AND m.ano = {$this->ano} - - ORDER BY - nm_turma, - nm_serie, - dt_transferencia"; - //AND data_transferencia IS NOT NULL - //AND EXTRACT (YEAR FROM data_transferencia) = {$this->ano} - $db->Consulta($sql); + $sql = " + SELECT + cod_matricula, + m.ref_cod_aluno, + (SELECT + nome + FROM + cadastro.pessoa p, pmieducar.aluno a + WHERE + a.cod_aluno = m.ref_cod_aluno AND a.ref_idpes = p.idpes) + as nome_aluno, + to_char(data_transferencia,'DD/MM/YYYY') as dt_transferencia, + s.nm_serie, + t.nm_turma, + ts.ref_cod_matricula_entrada + FROM + pmieducar.matricula m, + pmieducar.matricula_turma mt, + pmieducar.turma t, + pmieducar.serie s, + pmieducar.transferencia_solicitacao ts + WHERE + m.ref_ref_cod_escola = {$this->ref_cod_escola} + AND ref_cod_matricula_saida = cod_matricula + AND ts.ativo = 1 + AND mt.ref_cod_matricula = m.cod_matricula + AND mt.ref_cod_turma = t.cod_turma + AND t.ref_ref_cod_serie = s.cod_serie + AND m.ano = {$this->ano} + ORDER BY + nm_turma, + nm_serie, + dt_transferencia"; - if ($db->Num_Linhas()) - { + $db->Consulta($sql); + if ($db->Num_Linhas()) { $dados = array(); - while ($db->ProximoRegistro()) - { + + while ($db->ProximoRegistro()) { $dados[] = $db->Tupla(); $this->total++; } $this->pdf = new clsPDF("Registro de Matrículas - {$this->ano}", "Registro de Matrículas", "A4", "", false, false); - $obj_instituicao = new clsPmieducarInstituicao(); $this->pdf->largura = 842.0; - $this->pdf->altura = 595.0; + $this->pdf->altura = 595.0; $this->page_y = 125; @@ -194,72 +183,86 @@ class indice extends clsCadastro $this->addCabecalho(); - $esquerda = 30; - $altura = 130 + 18*2; - $direita = 782; + $esquerda = 30; + $altura = 130 + 18 * 2; + $direita = 782; $tam_texto = 8; - $altura = 130; + $altura = 130; $altura_escrita = 3; - foreach ($dados as $dado_transferencia) - { - list($cod_matricula, $ref_cod_aluno, $nome_aluno, $dt_transferencia, $nm_serie, $nm_turma, $ref_cod_matricula_entrada) = $dado_transferencia; - $this->pdf->linha_relativa($esquerda, $altura+=18, 0, 18); + foreach ($dados as $dado_transferencia) { + list($cod_matricula, $ref_cod_aluno, $nome_aluno, $dt_transferencia, + $nm_serie, $nm_turma, $ref_cod_matricula_entrada) = $dado_transferencia; + + $this->pdf->linha_relativa($esquerda, $altura += 18, 0, 18); $this->pdf->linha_relativa($esquerda, $altura, $direita, 0); - $this->pdf->escreve_relativo($cod_matricula, $esquerda + 3, $altura + $altura_escrita, 55, 30, $fonte, $tam_texto, $corTexto, 'center'); + $this->pdf->escreve_relativo($cod_matricula, $esquerda + 3, + $altura + $altura_escrita, 55, 30, $fonte, $tam_texto, $corTexto, 'center'); + $this->pdf->linha_relativa($esquerda + 55, $altura, 0, 18); + $this->pdf->escreve_relativo($nome_aluno, $esquerda + 58, + $altura + $altura_escrita, 300, 30, $fonte, $tam_texto); - $this->pdf->escreve_relativo($nome_aluno, $esquerda + 58, $altura + $altura_escrita, 300, 30, $fonte, $tam_texto); $this->pdf->linha_relativa($esquerda + 317 - 18, $altura, 0, 18); + $this->pdf->escreve_relativo($dt_transferencia, $esquerda + 320 - 18, + $altura + $altura_escrita, 150, 30, $fonte, $tam_texto, $corTexto); - $this->pdf->escreve_relativo($dt_transferencia, $esquerda + 320 - 18, $altura + $altura_escrita, 150, 30, $fonte, $tam_texto, $corTexto); $this->pdf->linha_relativa($esquerda + 365-11, $altura, 0, 18); + $this->pdf->escreve_relativo($nm_serie, $esquerda + 365 - 9, + $altura + $altura_escrita, 72, 30, $fonte, $tam_texto, $corTexto, 'center'); - $this->pdf->escreve_relativo($nm_serie, $esquerda + 365 - 9, $altura + $altura_escrita, 72, 30, $fonte, $tam_texto, $corTexto, 'center'); $this->pdf->linha_relativa($esquerda + 410+19, $altura, 0, 18); + $this->pdf->escreve_relativo($nm_turma, $esquerda + 408 + 10 + 13, + $altura + $altura_escrita, 35, 30, $fonte, $tam_texto, $corTexto, 'center'); - $this->pdf->escreve_relativo($nm_turma, $esquerda + 408 + 10+13, $altura + $altura_escrita, 35, 30, $fonte, $tam_texto, $corTexto, 'center'); $this->pdf->linha_relativa($esquerda + 449 + 34, $altura, 0, 18); - $estabelecimento_destino = null; - if (is_numeric($ref_cod_matricula_entrada)) + $estabelecimento_destino = NULL; + if (is_numeric($ref_cod_matricula_entrada)) { $estabelecimento_destino = $this->getNomeEscola($ref_cod_matricula_entrada); - else - $this->pdf->escreve_relativo("Escola Externa ao Sistema", $esquerda + 452 + 34, $altura + $altura_escrita, 300, 30, $fonte, $tam_texto); - if (!empty($estabelecimento_destino)) - $this->pdf->escreve_relativo($estabelecimento_destino, $esquerda + 452 + 34, $altura + $altura_escrita, 300, 30, $fonte, $tam_texto); + } + else { + $this->pdf->escreve_relativo('Escola Externa ao Sistema', $esquerda + 452 + 34, + $altura + $altura_escrita, 300, 30, $fonte, $tam_texto); + } + + if (!empty($estabelecimento_destino)) { + $this->pdf->escreve_relativo($estabelecimento_destino, $esquerda + 452 + 34, + $altura + $altura_escrita, 300, 30, $fonte, $tam_texto); + } $this->pdf->linha_relativa($esquerda + 757, $altura, 0, 18); - $this->pdf->escreve_relativo(empty($estabelecimento_destino) ? "" : "SC", $esquerda + 763, $altura + $altura_escrita, 50, 30, $fonte, $tam_texto); + $this->pdf->escreve_relativo(empty($estabelecimento_destino) ? '' : 'SC', + $esquerda + 763, $altura + $altura_escrita, 50, 30, $fonte, $tam_texto); + $this->pdf->linha_relativa($esquerda + 782, $altura, 0, 18); $this->pdf->linha_relativa($esquerda, $altura, $direita, 0); $this->pdf->linha_relativa($esquerda, $altura + 18, $direita, 0); - if ($altura > $this->pdf->altura - 50) - { + + if ($altura > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); - $esquerda = 30; - $altura = 130 + 18*2; - $direita = 782; + $esquerda = 30; + $altura = 130 + 18 * 2; + $direita = 782; $tam_texto = 8; - $altura = 130; + $altura = 130; $altura_escrita = 5; } } - if ($altura > $this->pdf->altura - 50) - { + if ($altura > $this->pdf->altura - 50) { $this->pdf->ClosePage(); $this->pdf->OpenPage(); $this->addCabecalho(); - $esquerda = 30; - $altura = 130 + 18*2; - $direita = 782; + $esquerda = 30; + $altura = 130 + 18 * 2; + $direita = 782; $tam_texto = 8; - $altura = 130; + $altura = 130; $altura_escrita = 5; } @@ -267,33 +270,40 @@ class indice extends clsCadastro $this->pdf->CloseFile(); $this->get_link = $this->pdf->GetLink(); - echo ""; - echo "
Se o download não iniciar automaticamente
clique aqui!

- Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.
- - Clique na Imagem para Baixar o instalador

-
-
-
"; + echo " + +
+ Se o download não iniciar automaticamente
+ clique aqui!

+ + Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.
+ Clique na Imagem para Baixar o instalador

+
+ +
+
+
"; } - else - { - echo ''; - return true; + else { + echo ' + '; + + return TRUE; } } - else - { - echo ''; - return true; + else { + echo ' + '; + + return TRUE; } } @@ -381,52 +391,62 @@ class indice extends clsCadastro function getNomeEscola($ref_cod_matricula_entrada) { $nome_escola = null; - if (is_numeric($ref_cod_matricula_entrada)) - { - $sql = " SELECT - fantasia as nome - FROM - pmieducar.escola - , cadastro.juridica - WHERE - ref_cod_instituicao = {$this->ref_cod_instituicao} - AND idpes = ref_idpes - AND cod_escola = (SELECT ref_ref_cod_escola FROM pmieducar.matricula WHERE cod_matricula = {$ref_cod_matricula_entrada}) - AND ativo = 1 - UNION - SELECT - nm_escola - FROM - pmieducar.escola - , pmieducar.escola_complemento - WHERE - ref_cod_instituicao = {$this->ref_cod_instituicao} - AND cod_escola = ref_cod_escola - AND cod_escola = (SELECT ref_ref_cod_escola FROM pmieducar.matricula WHERE cod_matricula = {$ref_cod_matricula_entrada}) - AND escola.ativo = 1;"; + + if (is_numeric($ref_cod_matricula_entrada)) { + $sql = " + SELECT + fantasia as nome + FROM + pmieducar.escola, + cadastro.juridica + WHERE + ref_cod_instituicao = {$this->ref_cod_instituicao} + AND idpes = ref_idpes + AND cod_escola = (SELECT ref_ref_cod_escola FROM pmieducar.matricula WHERE cod_matricula = {$ref_cod_matricula_entrada}) + AND ativo = 1 + UNION + SELECT + nm_escola + FROM + pmieducar.escola, + pmieducar.escola_complemento + WHERE + ref_cod_instituicao = {$this->ref_cod_instituicao} + AND cod_escola = ref_cod_escola + AND cod_escola = + (SELECT + ref_ref_cod_escola + FROM + pmieducar.matricula + WHERE + cod_matricula = {$ref_cod_matricula_entrada}) + AND escola.ativo = 1;"; + $db = new clsBanco(); $nome_escola = $db->CampoUnico($sql); } + return $nome_escola; } - function Editar() - { - return false; + function Editar() { + return FALSE; } - function Excluir() - { - return false; + function Excluir() { + return FALSE; } } -// 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 + +// 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