From fc43375ef62a16e9e4a9e964a72ac6e96740fcc0 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Thu, 30 Jul 2009 18:19:35 +0000 Subject: [PATCH] Corrigido bug na Emissão de documento de reserva de vaga que não criava o PDF (faltava receber parâmetro $_GET identificador) --- ieducar/intranet/educar_relatorio_solicitacao_transferencia.php | 416 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 file changed, 217 insertions(+), 199 deletions(-) diff --git a/ieducar/intranet/educar_relatorio_solicitacao_transferencia.php b/ieducar/intranet/educar_relatorio_solicitacao_transferencia.php index 850ebfd..b138073 100644 --- a/ieducar/intranet/educar_relatorio_solicitacao_transferencia.php +++ b/ieducar/intranet/educar_relatorio_solicitacao_transferencia.php @@ -1,6 +1,6 @@ * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL * @package Core - * @subpackage Relatório + * @subpackage Relatorio + * @subpackage ReservaVaga * @since Arquivo disponível desde a versão 1.0.0 * @version $Id$ */ @@ -41,175 +38,190 @@ require_once 'include/clsPDF.inc.php'; class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} i-Educar - Diário de Classe - Avaliações" ); - $this->processoAp = "670"; - $this->renderMenu = false; - $this->renderMenuSuspenso = false; - } + function Formular() { + $this->SetTitulo($this->_instituicao . ' i-Educar - Diário de Classe - Avaliações'); + $this->processoAp = '670'; + $this->renderMenu = FALSE; + $this->renderMenuSuspenso = FALSE; + } } +/** + * Cria um documento PDF com o atesto de reserva de vaga. + * + * @author Prefeitura Municipal de Itajaí + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage Relatorio + * @subpackage ReservaVaga + * @since Classe disponível desde a versão 1.0.0 + * @version $Id$ + */ class indice extends clsCadastro { + /** + * Referência a usuário da sessão + * @var int + */ + var $pessoa_logada; + + // Atributos para referências a tabelas relacionadas. + var + $ref_cod_instituicao, + $ref_cod_escola, + $ref_cod_serie, + $ref_cod_turma, + $ref_cod_matricula; + + // Atributos utilizados na criação do documento. + var + $nm_escola, + $nm_instituicao, + $ref_cod_curso, + $pdf, + $nm_turma, + $nm_serie, + $nm_aluno, + $nm_ensino, + $nm_curso, + $data_solicitacao, + $escola_municipio; + + /** + * Distância horizontal da página (eixo y). + * @var int + */ + var $page_y = 139; + + /** + * Caminho para o download do arquivo. + * @var string + */ + var $get_link; + + /** + * Array associativo com os meses do ano. + * @var array + */ + 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' + ); + + /** + * Sobrescreve clsCadastro::renderHTML(). + * @see clsCadastro::renderHTML() + */ + function renderHTML() + { + $ok = FALSE; + $obj_reserva_vaga = new clsPmieducarReservaVaga(); + $this->cod_reserva_vaga = $_GET['cod_reserva_vaga']; + $lst_reserva_vaga = $obj_reserva_vaga->lista($this->cod_reserva_vaga); + $registro = array_shift($lst_reserva_vaga); + + if (is_numeric($_GET['cod_reserva_vaga']) && is_array($registro)) { + $this->data_solicitacao = $registro['data_cadastro']; + $ok = TRUE; + } + + if (!$ok) { + echo ""; + die('Não é possível gerar documento para reserva de vaga para esta matrícula'); + } + + // Nome do aluno + if ($registro['nm_aluno']) { + $this->nm_aluno = $registro['nm_aluno']; + } + elseif ($registro['ref_cod_aluno']) { + $obj_aluno = new clsPmieducarAluno(); + $det_aluno = array_shift($obj_aluno->lista($registro['ref_cod_aluno'])); + $this->nm_aluno = $det_aluno['nome_aluno']; + } + + // Nome da escola + $obj_escola = new clsPmieducarEscola($registro['ref_ref_cod_escola']); + $det_escola = $obj_escola->detalhe(); + $this->nm_escola = $det_escola['nome']; + + // Cidade da escola + $escolaComplemento = new clsPmieducarEscolaComplemento($registro['ref_ref_cod_escola']); + $escolaComplemento = $escolaComplemento->detalhe(); + $this->escola_municipio = $escolaComplemento['municipio']; + + // Nome da série + $obj_serie = new clsPmieducarSerie($registro['ref_ref_cod_serie']); + $det_serie = $obj_serie->detalhe(); + $this->nm_serie = $det_serie['nm_serie']; + + // Nome do curso + $obj_curso = new clsPmieducarCurso($registro['ref_cod_curso']); + $det_curso = $obj_curso->detalhe(); + $this->nm_curso = $det_curso['nm_curso']; + + $fonte = 'arial'; + $corTexto = '#000000'; + + $this->pdf = new clsPDF('Diário de Classe - '. $this->ano, + "Diário de Classe - {$this->meses_do_ano[$this->mes]} e {$this->meses_do_ano[$prox_mes]} de {$this->ano}", + 'A4', '', FALSE, FALSE); + + $this->pdf->OpenPage(); + $this->addCabecalho(); + + // Título + $this->pdf->escreve_relativo('Reserva de Vaga', 30, 220, 535, 80, $fonte, 16, + $corTexto, 'justify'); + + $texto = "Atesto para os devidos fins que o aluno {$this->nm_aluno}, solicitou reserva de vaga na escola {$this->nm_escola}, para o curso {$this->nm_curso}, na série {$this->nm_serie} e que a mesma possui a validade de 48 horas a partir da data de solicitação da mesma, " . dataFromPgToBr($this->data_solicitacao) . "."; + $this->pdf->escreve_relativo($texto, 30, 350, 535, 80, $fonte, 14, $corTexto, 'center'); + + $mes = date('n'); + $mes = strtolower($this->meses_do_ano["{$mes}"]); + $data = date('d') . " de $mes de " . date('Y'); + $this->pdf->escreve_relativo($this->escola_municipio . ', ' . $data, 30, 600, 535, 80, $fonte, 14, $corTexto, 'center'); + $this->rodape(); + $this->pdf->CloseFile(); + $this->get_link = $this->pdf->GetLink(); - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - - var $ref_cod_instituicao; - var $ref_cod_escola; - var $ref_cod_serie; - var $ref_cod_turma; - var $ref_cod_matricula; - - var $nm_escola; - var $nm_instituicao; - var $ref_cod_curso; - var $pdf; - var $nm_turma; - var $nm_serie; - var $nm_aluno; - var $nm_ensino; - var $nm_curso; - var $data_solicitacao; - - var $page_y = 139; - - - var $get_link; - - - - 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" - ); - - - function renderHTML() - { - - $ok = false; - $obj_reserva_vaga = new clsPmieducarReservaVaga(); - $lst_reserva_vaga = $obj_reserva_vaga->lista($this->cod_reserva_vaga); - $registro = array_shift($lst_reserva_vaga); - if(is_numeric($_GET['cod_reserva_vaga']) && is_array($registro)) - { - $this->data_solicitacao = $registro['data_cadastro']; - - $ok = true; - } - if(!$ok) - { - echo ""; - die('Não é possível gerar documento para reserva de vaga para esta matrícula'); - } - - $obj_aluno = new clsPmieducarAluno(); - $det_aluno = array_shift($obj_aluno->lista($registro['ref_cod_aluno'])); - $this->nm_aluno = $det_aluno['nome_aluno']; - - - if( class_exists( "clsPmieducarEscola" ) ) - { - $obj_escola = new clsPmieducarEscola( $registro["ref_ref_cod_escola"] ); - $det_escola = $obj_escola->detalhe(); - $this->nm_escola = $registro["ref_ref_cod_escola"] = $det_escola["nome"]; - } - else - { - $registro["ref_ref_cod_escola"] = "Erro na geracao"; - echo ""; - } - if( class_exists( "clsPmieducarSerie" ) ) - { - $obj_serie = new clsPmieducarSerie( $registro["ref_ref_cod_serie"] ); - $det_serie = $obj_serie->detalhe(); - $this->nm_serie = $registro["ref_ref_cod_serie"] = $det_serie["nm_serie"]; - } - else - { - $registro["ref_ref_cod_serie"] = "Erro na geração"; - echo ""; - } - if( class_exists( "clsPmieducarCurso" ) ) - { - $obj_curso = new clsPmieducarCurso( $registro["ref_cod_curso"] ); - $det_curso = $obj_curso->detalhe(); - $this->nm_curso = $registro["ref_cod_curso"] = $det_curso["nm_curso"]; - } - else - { - $registro["ref_cod_curso"] = "Erro na geração"; - echo ""; - } - - $fonte = 'arial'; - $corTexto = '#000000'; - - $this->pdf = new clsPDF("Diário de Classe - {$this->ano}", "Diário de Classe - {$this->meses_do_ano[$this->mes]} e {$this->meses_do_ano[$prox_mes]} de {$this->ano}", "A4", "", false, false); - - $this->pdf->OpenPage(); - $this->addCabecalho(); - - - //titulo - $this->pdf->escreve_relativo( "Reserva de Vaga", 30, 220, 535, 80, $fonte, 16, $corTexto, 'justify' ); - - $texto = "Atesto para os devidos fins que o aluno {$this->nm_aluno}, solicitou reserva de vaga na escola {$this->nm_escola}, para o curso {$this->nm_curso}, na série {$this->nm_serie} e que a mesma possui a validade de 48 horas a partir da data de solicitação da mesma, ".dataFromPgToBr($this->data_solicitacao)."."; - $this->pdf->escreve_relativo( $texto, 30, 350, 535, 80, $fonte, 14, $corTexto, 'center' ); - $mes = date('n'); - $mes = strtolower($this->meses_do_ano["{$mes}"]); - $data = date('d')." de $mes de ".date('Y'); - $this->pdf->escreve_relativo( "Brasilia, $data", 30, 600, 535, 80, $fonte, 14, $corTexto, 'center' ); - $this->rodape(); - $this->pdf->CloseFile(); - - $this->get_link = $this->pdf->GetLink(); - - //$down = new download($this->get_link); - //echo ""; - echo ""; - - echo "
Clique aqui para visualizar o arquivo!

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

-
-
-
"; - - - //echo "location:download.php?filename=".$this->get_link;die; - - return; - - - } - - function Novo() - { - - return true; - } - - public function addCabecalho() + echo ""; + + echo " +
Clique aqui para visualizar o arquivo!

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

+
+
+
"; + + return; + } + + /** + * Sobrescreve clsCadastro::Novo(). + * @see clsCadastro::Novo() + */ + function Novo() + { + return TRUE; + } + + /** + * Adiciona um cabeçalho ao documento. + */ + function addCabecalho() { /** * Variável global com objetos do CoreExt. @@ -228,7 +240,7 @@ class indice extends clsCadastro // Cabeçalho $logo = $config->get($config->logo, 'imagens/brasao.gif'); - $this->pdf->quadrado_relativo( 30, $altura, 535, 85 ); + $this->pdf->quadrado_relativo(30, $altura, 535, 85); $this->pdf->insertImageScaled('gif', $logo, 50, 95, 41); // Título principal @@ -243,43 +255,49 @@ class indice extends clsCadastro $lista_serie_curso = $obj->lista(NULL, NULL, NULL, $this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao); - $dataAtual = date("d/m/Y"); - $this->pdf->escreve_relativo("Data: " . $dataAtual, 480, 100, 535, 80, + $dataAtual = date('d/m/Y'); + $this->pdf->escreve_relativo('Data: ' . $dataAtual, 480, 100, 535, 80, $fonte, 10, $corTexto, 'left'); } + /** + * Adiciona uma linha para assinatura do documento. + */ + function rodape() + { + $corTexto = '#000000'; + $this->pdf->escreve_relativo('Assinatura do(a) secretário(a)', 398, 715, + 150, 50, $fonte, 9, $corTexto, 'left'); + $this->pdf->linha_relativa(385, 710, 140, 0); + } - function rodape() - { - $corTexto = '#000000'; - - - $this->pdf->escreve_relativo( "Assinatura do secretário(a)", 398,715, 150, 50, $fonte, 9, $corTexto, 'left' ); - $this->pdf->linha_relativa(385,710,140,0); - } - - function Editar() - { - return false; - } - - function Excluir() - { - return false; - } + /** + * Sobrescreve clsCadastro::Editar(). + * @see clsCadastro::Editar() + */ + function Editar() + { + return FALSE; + } + /** + * Sobrescreve clsCadastro::Excluir(). + * @see clsCadastro::Excluir() + */ + function Excluir() + { + return FALSE; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo -$miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html - -$pagina->MakeAll(); +// Instancia objeto de conteúdo +$miolo = new indice(); +// 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