From 6608f5a7c6e2ce09e21882cb8ef9a2561d08d3c1 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Mon, 19 Apr 2010 22:14:00 +0000 Subject: [PATCH] Refactoring para coding standards --- ieducar/intranet/educar_relatorio_resultado_final.php | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------ ieducar/intranet/educar_relatorio_resultado_final_proc.php | 955 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 642 insertions(+), 565 deletions(-) diff --git a/ieducar/intranet/educar_relatorio_resultado_final.php b/ieducar/intranet/educar_relatorio_resultado_final.php index 30083ad..133eb63 100644 --- a/ieducar/intranet/educar_relatorio_resultado_final.php +++ b/ieducar/intranet/educar_relatorio_resultado_final.php @@ -1,178 +1,178 @@ + * + * 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/clsCadastro.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/pmieducar/geral.inc.php'; +require_once 'include/clsPDF.inc.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 - Resultado Final" ); - $this->processoAp = "823"; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Resultado Final'); + $this->processoAp = 823; + } } +/** + * 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 clsCadastro { + var $pessoa_logada; + var $ref_cod_instituicao; + var $ref_cod_escola; + var $ref_cod_serie; + var $ref_cod_turma; - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; + var $ano; + var $ref_cod_curso; - var $ref_cod_instituicao; - var $ref_cod_escola; - var $ref_cod_serie; - var $ref_cod_turma; + function Inicializar() + { + $retorno = 'Novo'; + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); - var $ano; + return $retorno; + } - var $ref_cod_curso; + function Gerar() + { + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); + $this->campoNumero('ano', 'Ano', date('Y'), 4, 4, TRUE); - return $retorno; + $get_escola = TRUE; + $obrigatorio = TRUE; + $exibe_nm_escola = TRUE; + $get_curso = TRUE; + $get_escola_curso_serie = TRUE; + $get_turma = TRUE; - } - - function Gerar() - { - - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - - $this->campoNumero( "ano", "Ano", date("Y"), 4, 4, true ); - - $get_escola = true; - $obrigatorio = true; - $exibe_nm_escola = true; - $get_curso = true; - $get_escola_curso_serie = true; - $get_turma = true; - - include("include/pmieducar/educar_campo_lista.php"); - - $this->url_cancelar = "educar_index.php"; - $this->nome_url_cancelar = "Cancelar"; - - $this->acao_enviar = 'acao2()'; - $this->acao_executa_submit = false; - } + include 'include/pmieducar/educar_campo_lista.php'; + $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(); +// Atribui o conteúdo à página +$pagina->addForm($miolo); +// Gera o código HTML +$pagina->MakeAll(); ?> - + \ No newline at end of file diff --git a/ieducar/intranet/educar_relatorio_resultado_final_proc.php b/ieducar/intranet/educar_relatorio_resultado_final_proc.php index 51a6182..73d5f67 100644 --- a/ieducar/intranet/educar_relatorio_resultado_final_proc.php +++ b/ieducar/intranet/educar_relatorio_resultado_final_proc.php @@ -1,6 +1,6 @@ - * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL - * @package Core - * @subpackage Relatório - * @since Arquivo disponível desde a versão 1.0.0 - * @version $Id$ + * @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'; @@ -38,423 +34,498 @@ require_once 'include/clsBanco.inc.php'; require_once 'include/pmieducar/geral.inc.php'; require_once 'include/clsPDF.inc.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 - Resultado Final" ); - $this->processoAp = "823"; //alterar - $this->renderMenu = false; - $this->renderMenuSuspenso = false; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' i-Educar - Resultado Final'); + $this->processoAp = 823; + $this->renderMenu = FALSE; + $this->renderMenuSuspenso = FALSE; + } } +/** + * 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 clsCadastro { + var $pessoa_logada; + + var $ref_cod_instituicao; + var $ref_cod_escola; + var $ref_cod_serie; + var $ref_cod_turma; + var $ano; - /** - * 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 $ano; - - var $nm_escola; - var $nm_instituicao; - var $ref_cod_curso; - var $pdf; - - var $nm_turma; - var $nm_serie; - var $nm_cidade; - - var $array_modulos; - - var $is_padrao; - var $semestre; + var $nm_escola; + var $nm_instituicao; + var $ref_cod_curso; + var $pdf; - var $get_link; - - function renderHTML() - { + var $nm_turma; + var $nm_serie; + var $nm_cidade; - if($_POST){ - foreach ($_POST as $key => $value) { - $this->$key = $value; - - } - } - if($this->ref_ref_cod_serie) - $this->ref_cod_serie = $this->ref_ref_cod_serie; - - $fonte = 'arial'; - $corTexto = '#000000'; - - if(empty($this->ref_cod_turma)) - { - echo ''; - return true; - } - - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); - $det_escola = $obj_escola->detalhe(); - $this->nm_escola = $det_escola['nome']; - - $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); - $det_instituicao = $obj_instituicao->detalhe(); - $this->nm_instituicao = $det_instituicao['nm_instituicao']; - - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); - $det_turma = $obj_turma->detalhe(); - $this->nm_turma = $det_turma['nm_turma']; - - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); - $det_serie = $obj_serie->detalhe(); - $this->nm_serie = $det_serie['nm_serie']; - - $eh_multi_seriado = false; - - if (is_numeric($det_turma["ref_ref_cod_serie_mult"])) - { - $series = array(); - $series[$det_serie["cod_serie"]] = $det_serie["nm_serie"]; - $obj_serie = new clsPmieducarSerie($det_turma["ref_ref_cod_serie_mult"]); - $det_serie = $obj_serie->detalhe(); - $this->nm_serie .= " / {$det_serie["nm_serie"]}"; - $series[$det_serie["cod_serie"]] = $det_serie["nm_serie"]; - $eh_multi_seriado = true; - } - - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); - $det_curso = $obj_curso->detalhe(); - $frequencia_minima = $det_curso["frequencia_minima"]; - $hora_falta = $det_curso["hora_falta"]; - //ref_cod_tipo_avaliacao - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso["ref_cod_tipo_avaliacao"]); - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe(); - - $eh_conceitual = $det_tipo_avaliacao["conceitual"]; - - if($det_curso['padrao_ano_escolar']) - { - $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo(); - $obj_ano_letivo_modulo->setOrderby("data_inicio asc"); - $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano,$this->ref_cod_escola,null,null); - if($lst_ano_letivo_modulo) - { - foreach ($lst_ano_letivo_modulo as $modulo) { - $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']); - $det_modulo = $obj_modulo->detalhe(); - $this->array_modulos[] = $det_modulo; - } - } - } - - $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina(); - $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie, $this->ref_cod_escola, null, 1); - - $this->pdf = new clsPDF("Resultado Final", "Resultado Final", "A4", "", false, false); - - $this->pdf->OpenPage(); - - $this->addCabecalho(); - - $this->pdf->linha_relativa(30, 140, 540, 0); - $this->pdf->linha_relativa(30, 140, 0, 30); - $this->pdf->linha_relativa(570, 140, 0, 30); - $this->pdf->linha_relativa(30, 170, 540, 0); - - $this->pdf->linha_relativa(60, 140, 0, 30); - $this->pdf->linha_relativa(320, 140, 0, 30); - - $this->pdf->linha_relativa(380, 140, 0, 30); - $this->pdf->linha_relativa(490, 140, 0, 30); - - $this->pdf->linha_relativa(380, 155, 190, 0); - $this->pdf->linha_relativa(530, 155, 0, 15); - - $this->pdf->linha_relativa(450, 155, 0, 15); - - $this->pdf->escreve_relativo("Ord", 35, 150, 20, 20, null, 10); - $this->pdf->escreve_relativo("Nome do aluno", 70, 150, 160, 20, null, 10); - $this->pdf->escreve_relativo("Aprovado", 325, 150, 160, 20, null, 10); - $this->pdf->escreve_relativo("Reprovado", 410, 142, 160, 20, null, 10); - $this->pdf->escreve_relativo("Desempenho", 384, 156, 160, 20, null, 10); - $this->pdf->escreve_relativo("Faltas", 455, 156, 160, 20, null, 10); - $this->pdf->escreve_relativo("Alf.", 500, 156, 160, 20, null, 10); - $this->pdf->escreve_relativo("N. Alf.", 535, 156, 160, 20, null, 10); - - $obj_matricula = new clsPmieducarMatriculaTurma(); - $obj_matricula->setOrderby('m.ref_ref_cod_serie, nome_ascii'); - - if ($this->is_padrao || $this->ano == 2007) { - $this->semestre = null; - } - - $lst_matricula = $obj_matricula->lista(null,$this->ref_cod_turma,null,null,null,null,null,null,1,$this->ref_cod_serie,$this->ref_cod_curso,$this->ref_cod_escola,$this->ref_cod_instituicao,null,null,array(1,2,3),null,null,$this->ano,null,true,null,null,true, - null,null, null, $det_turma["ref_ref_cod_serie_mult"], $this->semestre); - //$total_alunos = 42; - $qtd_quebra = 43; - $base = 155; - $linha = 1; - - $total_aprovados = 0; - $total_reprovados_desempenho = 0; - $total_reprovados_nota = 0; - $total_analfabetos = 0; - $total_nao_analfabetos = 0; - $ordem_mostra = 0; - if(is_array($lst_matricula)) - { - foreach ($lst_matricula as $ordem => $matricula) - { - $obj_matricula = new clsPmieducarMatricula($matricula["ref_cod_matricula"]); - $det_matricula = $obj_matricula->detalhe(); - if ($det_matricula["aprovado"] == 1 || $det_matricula["aprovado"] == 2) - { - $ordem_mostra++; - $ordem_mostra = sprintf("%02d",$ordem_mostra); - if($linha % $qtd_quebra == 0) - { - //nova pagina - $this->pdf->ClosePage(); - $this->pdf->OpenPage(); - $base = 30; - $linha = 0; - $this->pdf->linha_relativa(30, 30, 540, 0); - $qtd_quebra = 51; - } - $this->pdf->linha_relativa(30, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(60, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(30, ($base+15)+($linha*15), 540, 0); - $this->pdf->linha_relativa(570, $base+($linha*15), 0, 15);//fim - $this->pdf->escreve_relativo($ordem_mostra, 40, ($base+3)+($linha*15), 15, 15, null, 8); - if ($eh_multi_seriado) - $this->pdf->escreve_relativo($matricula['nome']." ({$series[$det_matricula["ref_ref_cod_serie"]]})", 65, ($base+3)+($linha*15), 250, 15, null, 8); - else - $this->pdf->escreve_relativo($matricula['nome'], 65, ($base+3)+($linha*15), 250, 15, null, 8); - - if (!$eh_conceitual) - { - if ($det_matricula["aprovado"] == 1) - { - $this->pdf->escreve_relativo("X", 345, ($base+3)+($linha*15), 250, 15, null, 8);//aprovado - $total_aprovados++; - } - else - { - $reprovou_por_falta = false; - $reprovou_por_nota = false; - if (is_array($lst_disc_serie)) - { - foreach ($lst_disc_serie as $disciplina) { - if (!$reprovou_por_falta) - { - $obj_falta = new clsPmieducarFaltaAluno(); - if ($det_curso["padrao_ano_escolar"] == 1) - $lst_falta = $obj_falta->lista(null, null, null, $this->ref_cod_serie, $this->ref_cod_escola, $disciplina["ref_cod_disciplina"], $matricula["ref_cod_matricula"], null, null, null, null, null, 1); - else - $lst_falta = $obj_falta->lista(null, null, null, $this->ref_cod_serie, $this->ref_cod_escola, null, $matricula["ref_cod_matricula"], null, null, null, null, null, 1, null, $disciplina["ref_cod_disciplina"]); - $total_faltas = 0; - if(is_array($lst_falta)) - { - foreach ($lst_falta as $key => $value) - { - $total_faltas += $lst_falta[$key]['faltas']; - } - } - $obj_disciplina = new clsPmieducarDisciplina($disciplina["ref_cod_disciplina"]); - $det_disciplina = $obj_disciplina->detalhe(); - $carga_horaria_disciplina = $det_disciplina["carga_horaria"]; - $max_falta = ($carga_horaria_disciplina * $frequencia_minima)/100; - $max_falta = $carga_horaria_disciplina - $max_falta; - $total_faltas *= $hora_falta; - if ($total_faltas > $max_falta) - { - $this->pdf->escreve_relativo("X", 465, ($base+3)+($linha*15), 250, 15, null, 8);//faltas - $reprovou_por_falta = true; - $total_reprovados_desempenho++; - } - } - if (!$reprovou_por_nota) - { - $obj_nota = new clsPmieducarNotaAluno(); - $obj_nota->setOrderby("modulo asc"); - if($det_curso['padrao_ano_escolar'] == 1) - $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null); - else - $det_nota = $obj_nota->lista(null,nul,null,$this->ref_cod_serie,$this->ref_cod_escola,null,$matricula['ref_cod_matricula'],null,null,null,null,null,null,1,null,$disciplina['ref_cod_disciplina']); - - if (is_array($det_nota)) - { - // usort($det_nota, "cmp"); - - $soma_notas = 0; - foreach ($det_nota as $key => $nota) { - - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota['ref_ref_cod_tipo_avaliacao'],$nota['ref_sequencial'],null,null,null,null); - $det_tipo_av_val = $obj_tipo_av_val->detalhe(); - - if ( count($this->array_modulos) == count($det_nota) ) - { - $frequencia_minima = $det_curso["frequencia_minima"]; - $hora_falta = $det_curso["hora_falta"]; - $carga_horaria_curso = $det_curso["carga_horaria"]; - } - if (!dbBool($det_serie["ultima_nota_define"])) - { - if($key < (count($this->array_modulos)) ) - { - $soma_notas += $det_tipo_av_val['valor']; - $media_sem_exame = true; - } - else - { - $media_sem_exame = false; - $nota_exame = true; - $exame_nota = $det_nota[$key]["nota"]; - } - } - else - { - $media_sem_exame = true; - $soma_notas = $det_tipo_av_val["valor"]; - } - } - } - if (!dbBool($det_serie["ultima_nota_define"])) - { - if (!$nota_exame) - { - $media = $soma_notas / count($det_nota); //soh esta parte eh do codigo original - // $media_ = $media; - } - else - { - $media = ($soma_notas + $exame_nota * 2) / (count($det_nota)+1); - } - } - else - { - $media = $soma_notas; - } - - $obj_media = new clsPmieducarTipoAvaliacaoValores(); - $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],$det_curso['ref_sequencial'],null,null,$media,$media); - if($det_media) - { - $det_media = array_shift($det_media); - $media = $det_media['valor']; - $media = sprintf("%01.1f",$media); - $media = str_replace(".",",",$media); - } - if($media_sem_exame) - $media_curso_ = $det_curso['media']; - else - $media_curso_ = $det_curso['media_exame']; - if (str_replace(",", ".", $media) < $media_curso_) - { - $this->pdf->escreve_relativo("X", 410, ($base+3)+($linha*15), 250, 15, null, 8);//desempenho - $reprovou_por_nota = true; - $total_reprovados_nota++; - } - } - if ($reprovou_por_falta && $reprovou_por_nota) - break; - } - } - } - } - else - { - if ($det_matricula["aprovado"] == 1) - { - $this->pdf->escreve_relativo("X", 345, ($base+3)+($linha*15), 250, 15, null, 8);//aprovado - $total_aprovados++; - } - else - { - $this->pdf->escreve_relativo("X", 410, ($base+3)+($linha*15), 250, 15, null, 8);//desempenho - $reprovou_por_nota = true; - $total_reprovados_nota++; - } - } - /*analfabeto*/ - $obj_aluno = new clsPmieducarAluno($det_matricula["ref_cod_aluno"]); - $obj_aluno->setCamposLista("analfabeto"); - $det_aluno = $obj_aluno->detalhe(); - if ($det_aluno["analfabeto"] == 0) { - $this->pdf->escreve_relativo("X", 507, ($base+3)+($linha*15), 250, 15, null, 8);//nao alfabetizado - $total_analfabetos++; - } - else { - $this->pdf->escreve_relativo("X", 545, ($base+3)+($linha*15), 250, 15, null, 8);//alfabetizado - $total_nao_analfabetos++; - } - $this->pdf->linha_relativa(320, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(380, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(490, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(530, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(450, $base+($linha*15), 0, 15); - - - $linha++; - } - } - } - //escrever total - $this->pdf->linha_relativa(30, $base+($linha*15), 0, 15); - - $this->pdf->escreve_relativo("Total", 35, ($base+3)+($linha*15), 20, 15, null, 8); - - $this->pdf->escreve_relativo($total_aprovados, 345, ($base+3)+($linha*15), 250, 15, null, 8);//aprovado - $this->pdf->escreve_relativo($total_reprovados_desempenho, 465, ($base+3)+($linha*15), 250, 15, null, 8);//desempenho - $this->pdf->escreve_relativo($total_reprovados_nota, 410, ($base+3)+($linha*15), 250, 15, null, 8);//faltas - $this->pdf->escreve_relativo($total_analfabetos, 507, ($base+3)+($linha*15), 250, 15, null, 8);//nao alfabetizado - $this->pdf->escreve_relativo($total_nao_analfabetos, 545, ($base+3)+($linha*15), 250, 15, null, 8);//alfabetizado - - $this->pdf->linha_relativa(60, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(320, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(380, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(490, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(530, $base+($linha*15), 0, 15); - $this->pdf->linha_relativa(450, $base+($linha*15), 0, 15); - - - $this->pdf->linha_relativa(570, $base+($linha*15), 0, 15); - - $this->pdf->linha_relativa(30, $base+(($linha+1)*15), 540, 0); - - $this->pdf->ClosePage(); - $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

-
-
-
"; - } - - public function addCabecalho() + var $array_modulos; + + var $is_padrao; + var $semestre; + + var $get_link; + + function renderHTML() + { + if ($_POST) { + foreach ($_POST as $key => $value) { + $this->$key = $value; + } + } + + if ($this->ref_ref_cod_serie) { + $this->ref_cod_serie = $this->ref_ref_cod_serie; + } + + $fonte = 'arial'; + $corTexto = '#000000'; + + if (empty($this->ref_cod_turma)) { + echo ' + '; + return TRUE; + } + + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola); + $det_escola = $obj_escola->detalhe(); + $this->nm_escola = $det_escola['nome']; + + $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']); + $det_instituicao = $obj_instituicao->detalhe(); + $this->nm_instituicao = $det_instituicao['nm_instituicao']; + + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma); + $det_turma = $obj_turma->detalhe(); + $this->nm_turma = $det_turma['nm_turma']; + + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie); + $det_serie = $obj_serie->detalhe(); + $this->nm_serie = $det_serie['nm_serie']; + + $eh_multi_seriado = FALSE; + + if (is_numeric($det_turma['ref_ref_cod_serie_mult'])) { + $series = array(); + $series[$det_serie['cod_serie']] = $det_serie['nm_serie']; + + $obj_serie = new clsPmieducarSerie($det_turma['ref_ref_cod_serie_mult']); + $det_serie = $obj_serie->detalhe(); + + $this->nm_serie .= ' / ' . $det_serie['nm_serie']; + + $series[$det_serie['cod_serie']] = $det_serie['nm_serie']; + $eh_multi_seriado = TRUE; + } + + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); + $det_curso = $obj_curso->detalhe(); + + $frequencia_minima = $det_curso["frequencia_minima"]; + $hora_falta = $det_curso["hora_falta"]; + + $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso["ref_cod_tipo_avaliacao"]); + $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe(); + + $eh_conceitual = $det_tipo_avaliacao["conceitual"]; + + if ($det_curso['padrao_ano_escolar']) { + $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo(); + $obj_ano_letivo_modulo->setOrderby('data_inicio asc'); + + $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano, + $this->ref_cod_escola, NULL, NULL); + + if ($lst_ano_letivo_modulo) { + foreach ($lst_ano_letivo_modulo as $modulo) { + $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']); + $det_modulo = $obj_modulo->detalhe(); + $this->array_modulos[] = $det_modulo; + } + } + } + + $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina(); + $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); + + $this->pdf = new clsPDF('Resultado Final', 'Resultado Final', 'A4', '', FALSE, FALSE); + + $this->pdf->OpenPage(); + + $this->addCabecalho(); + + $this->pdf->linha_relativa(30, 140, 540, 0); + $this->pdf->linha_relativa(30, 140, 0, 30); + $this->pdf->linha_relativa(570, 140, 0, 30); + $this->pdf->linha_relativa(30, 170, 540, 0); + + $this->pdf->linha_relativa(60, 140, 0, 30); + $this->pdf->linha_relativa(320, 140, 0, 30); + + $this->pdf->linha_relativa(380, 140, 0, 30); + $this->pdf->linha_relativa(490, 140, 0, 30); + + $this->pdf->linha_relativa(380, 155, 190, 0); + $this->pdf->linha_relativa(530, 155, 0, 15); + + $this->pdf->linha_relativa(450, 155, 0, 15); + + $this->pdf->escreve_relativo('Ord', 35, 150, 20, 20, NULL, 10); + $this->pdf->escreve_relativo('Nome do aluno', 70, 150, 160, 20, NULL, 10); + $this->pdf->escreve_relativo('Aprovado', 325, 150, 160, 20, NULL, 10); + $this->pdf->escreve_relativo('Reprovado', 410, 142, 160, 20, NULL, 10); + $this->pdf->escreve_relativo('Desempenho', 384, 156, 160, 20, NULL, 10); + $this->pdf->escreve_relativo('Faltas', 455, 156, 160, 20, NULL, 10); + $this->pdf->escreve_relativo('Alf.', 500, 156, 160, 20, NULL, 10); + $this->pdf->escreve_relativo('N. Alf.', 535, 156, 160, 20, NULL, 10); + + $obj_matricula = new clsPmieducarMatriculaTurma(); + $obj_matricula->setOrderby('m.ref_ref_cod_serie, nome_ascii'); + + // @todo 2007? Que diabo de condição é essa? + if ($this->is_padrao || $this->ano == 2007) { + $this->semestre = NULL; + } + + $lst_matricula = $obj_matricula->lista(NULL, $this->ref_cod_turma, NULL, + NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, $this->ref_cod_curso, + $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, NULL, array(1, 2, 3), + NULL, NULL, $this->ano, NULL, TRUE, NULL, NULL,TRUE, NULL,NULL, NULL, + $det_turma['ref_ref_cod_serie_mult'], $this->semestre); + + $qtd_quebra = 43; + $base = 155; + $linha = 1; + + $total_aprovados = 0; + $total_reprovados_desempenho = 0; + $total_reprovados_nota = 0; + $total_analfabetos = 0; + $total_nao_analfabetos = 0; + $ordem_mostra = 0; + + if (is_array($lst_matricula)) { + foreach ($lst_matricula as $ordem => $matricula) { + $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']); + $det_matricula = $obj_matricula->detalhe(); + + if ($det_matricula['aprovado'] == 1 || $det_matricula['aprovado'] == 2) { + $ordem_mostra++; + $ordem_mostra = sprintf('%02d', $ordem_mostra); + + if ($linha % $qtd_quebra == 0) { + //nova pagina + $this->pdf->ClosePage(); + $this->pdf->OpenPage(); + + $base = 30; + $linha = 0; + + $this->pdf->linha_relativa(30, 30, 540, 0); + $qtd_quebra = 51; + } + + $this->pdf->linha_relativa(30, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(60, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(30, ($base + 15) + ($linha * 15), 540, 0); + $this->pdf->linha_relativa(570, $base + ($linha * 15), 0, 15); // fim + + $this->pdf->escreve_relativo($ordem_mostra, 40, ($base + 3) + ($linha * 15), + 15, 15, NULL, 8); + + if ($eh_multi_seriado) { + $this->pdf->escreve_relativo($matricula['nome'] . ' (' . $series[$det_matricula['ref_ref_cod_serie']] . ')', + 65, ($base + 3) + ($linha * 15), 250, 15, NULL, 8); + } + else { + $this->pdf->escreve_relativo($matricula['nome'], 65, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); + } + + if (!$eh_conceitual) { + if ($det_matricula['aprovado'] == 1) { + $this->pdf->escreve_relativo('X', 345, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); + $total_aprovados++; + } + else { + $reprovou_por_falta = FALSE; + $reprovou_por_nota = FALSE; + + if (is_array($lst_disc_serie)) { + foreach ($lst_disc_serie as $disciplina) { + if (!$reprovou_por_falta) { + $obj_falta = new clsPmieducarFaltaAluno(); + + if ($det_curso['padrao_ano_escolar'] == 1) { + $lst_falta = $obj_falta->lista(NULL, NULL, NULL, + $this->ref_cod_serie, $this->ref_cod_escola, + $disciplina['ref_cod_disciplina'], + $matricula['ref_cod_matricula'], NULL, NULL, NULL, + NULL, NULL, 1); + } + else { + $lst_falta = $obj_falta->lista(NULL, NULL, NULL, + $this->ref_cod_serie, $this->ref_cod_escola, NULL, + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL, + NULL, 1, NULL, $disciplina['ref_cod_disciplina']); + } + + $total_faltas = 0; + if (is_array($lst_falta)) { + foreach ($lst_falta as $key => $value) { + $total_faltas += $lst_falta[$key]['faltas']; + } + } + + $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']); + $det_disciplina = $obj_disciplina->detalhe(); + $carga_horaria_disciplina = $det_disciplina['carga_horaria']; + + $max_falta = ($carga_horaria_disciplina * $frequencia_minima) / 100; + $max_falta = $carga_horaria_disciplina - $max_falta; + + $total_faltas *= $hora_falta; + if ($total_faltas > $max_falta) { + $this->pdf->escreve_relativo('X', 465, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); + + $reprovou_por_falta = TRUE; + $total_reprovados_desempenho++; + } + } + + if (!$reprovou_por_nota) { + $obj_nota = new clsPmieducarNotaAluno(); + $obj_nota->setOrderby('modulo asc'); + + if ($det_curso['padrao_ano_escolar'] == 1) { + $det_nota = $obj_nota->lista(NULL, NULL, NULL, + $this->ref_cod_serie, $this->ref_cod_escola, + $disciplina['ref_cod_disciplina'], $matricula['ref_cod_matricula'], + NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL); + } + else { + $det_nota = $obj_nota->lista(NULL, NULL, NULL, + $this->ref_cod_serie, $this->ref_cod_escola, NULL, + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL, + NULL, NULL, 1, NULL, $disciplina['ref_cod_disciplina']); + } + + if (is_array($det_nota)) { + $soma_notas = 0; + + foreach ($det_nota as $key => $nota) { + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores( + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'], + NULL, NULL, NULL, NULL + ); + + $det_tipo_av_val = $obj_tipo_av_val->detalhe(); + + if (count($this->array_modulos) == count($det_nota)) { + $frequencia_minima = $det_curso['frequencia_minima']; + $hora_falta = $det_curso['hora_falta']; + $carga_horaria_curso = $det_curso['carga_horaria']; + } + + if (!dbBool($det_serie['ultima_nota_define'])) { + if ($key < (count($this->array_modulos))) { + $soma_notas += $det_tipo_av_val['valor']; + $media_sem_exame = TRUE; + } + else { + $media_sem_exame = FALSE; + $nota_exame = TRUE; + $exame_nota = $det_nota[$key]['nota']; + } + } + else { + $media_sem_exame = TRUE; + $soma_notas = $det_tipo_av_val['valor']; + } + } + } + + if (!dbBool($det_serie['ultima_nota_define'])) { + if (!$nota_exame) { + $media = $soma_notas / count($det_nota); + // soh esta parte eh do codigo original + // $media_ = $media; + } + else { + $media = ($soma_notas + $exame_nota * 2) / (count($det_nota) + 1); + } + } + else { + $media = $soma_notas; + } + + $obj_media = new clsPmieducarTipoAvaliacaoValores(); + $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'], + $det_curso['ref_sequencial'], NULL, NULL, $media, $media); + + if ($det_media) { + $det_media = array_shift($det_media); + $media = $det_media['valor']; + $media = sprintf('%01.1f',$media); + $media = str_replace('.', ',', $media); + } + + if ($media_sem_exame) { + $media_curso_ = $det_curso['media']; + } + else { + $media_curso_ = $det_curso['media_exame']; + } + + if (str_replace(',', '.', $media) < $media_curso_) { + $this->pdf->escreve_relativo('X', 410, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); + $reprovou_por_nota = TRUE; + $total_reprovados_nota++; + } + } + + if ($reprovou_por_falta && $reprovou_por_nota) { + break; + } + } + } + } + } + else { + if ($det_matricula['aprovado'] == 1) { + $this->pdf->escreve_relativo('X', 345, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); // aprovado + + $total_aprovados++; + } + else { + $this->pdf->escreve_relativo('X', 410, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); // desempenho + + $reprovou_por_nota = TRUE; + $total_reprovados_nota++; + } + } + + // analfabeto + $obj_aluno = new clsPmieducarAluno($det_matricula['ref_cod_aluno']); + $obj_aluno->setCamposLista('analfabeto'); + $det_aluno = $obj_aluno->detalhe(); + + if ($det_aluno['analfabeto'] == 0) { + $this->pdf->escreve_relativo('X', 507, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); // não alfabetizado + + $total_analfabetos++; + } + else { + $this->pdf->escreve_relativo('X', 545, ($base + 3) + ($linha * 15), + 250, 15, NULL, 8); // alfabetizado + + $total_nao_analfabetos++; + } + + $this->pdf->linha_relativa(320, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(380, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(490, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(530, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(450, $base + ($linha * 15), 0, 15); + + $linha++; + } + } + } + + // Escrever total + $this->pdf->linha_relativa(30, $base + ($linha * 15), 0, 15); + + $this->pdf->escreve_relativo("Total", 35, ($base + 3) + ($linha * 15), 20, + 15, NULL, 8); + + $this->pdf->escreve_relativo($total_aprovados, 345, ($base + 3) + ($linha * 15), + 250, 15, null, 8); // aprovado + + $this->pdf->escreve_relativo($total_reprovados_desempenho, 465, + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // desempenho + + $this->pdf->escreve_relativo($total_reprovados_nota, 410, + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // faltas + + $this->pdf->escreve_relativo($total_analfabetos, 507, + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // não alfabetizado + + $this->pdf->escreve_relativo($total_nao_analfabetos, 545, + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // alfabetizado + + $this->pdf->linha_relativa(60, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(320, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(380, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(490, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(530, $base + ($linha * 15), 0, 15); + $this->pdf->linha_relativa(450, $base + ($linha * 15), 0, 15); + + $this->pdf->linha_relativa(570, $base + ($linha * 15), 0, 15); + + $this->pdf->linha_relativa(30, $base + (($linha + 1) * 15), 540, 0); + + $this->pdf->ClosePage(); + $this->pdf->CloseFile(); + $this->get_link = $this->pdf->GetLink(); + + echo sprintf(' + ', $this->get_link); + + echo sprintf(' + +
+ 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

+
+
+
+ ', $this->get_link); + } + + function addCabecalho() { /** * Variável global com objetos do CoreExt. @@ -478,49 +549,55 @@ class indice extends clsCadastro // Título principal $titulo = $config->get($config->titulo, 'i-Educar'); + $this->pdf->escreve_relativo($titulo, 30, 30, 535, 80, $fonte, 18, $corTexto, 'center'); + $this->pdf->escreve_relativo(date("d/m/Y"), 500, 30, 100, 80, $fonte, 12, $corTexto, 'left'); // Dados escola - $this->pdf->escreve_relativo("Instituição: {$this->nm_instituicao}", 120, + $this->pdf->escreve_relativo('Instituição: ' . $this->nm_instituicao, 120, 58, 300, 80, $fonte, 10, $corTexto, 'left'); - $this->pdf->escreve_relativo("Escola: {$this->nm_escola}",138, 70, 300, 80, + + $this->pdf->escreve_relativo('Escola: ' . $this->nm_escola,138, 70, 300, 80, $fonte, 10, $corTexto, 'left'); - $this->pdf->escreve_relativo("Turma/Série: {$this->nm_turma} - {$this->nm_serie}", + + $this->pdf->escreve_relativo('Turma/Série: ' . $this->nm_turma . ' - ' . $this->nm_serie, 112, 82, 300, 80, $fonte, 10, $corTexto, 'left'); // Título - $this->pdf->escreve_relativo("RESULTADO FINAL I", 30, 95, 535, 80, $fonte, + $this->pdf->escreve_relativo('RESULTADO FINAL I', 30, 95, 535, 80, $fonte, 14, $corTexto, 'center'); - $this->pdf->escreve_relativo("Ano Referência: {$this->ano}", 45, 100, 535, - 80, $fonte, 10, $corTexto, 'left' ); + $this->pdf->escreve_relativo('Ano Referência: ' . $this->ano, 45, 100, 535, + 80, $fonte, 10, $corTexto, 'left'); } - function Editar() - { - return false; - } - - function Excluir() - { - return false; - } + function Editar() + { + return FALSE; + } + function Excluir() + { + return FALSE; + } } function cmp($a, $b) { - return $a["modulo"] > $b["modulo"]; + return $a['modulo'] > $b['modulo']; } -// 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