Commit 6608f5a7c6e2ce09e21882cb8ef9a2561d08d3c1

Authored by Eriksen Costa Paixão
1 parent b4b07401
Exists in master

Refactoring para coding standards

ieducar/intranet/educar_relatorio_resultado_final.php
1 1 <?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsCadastro.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once( "include/pmieducar/geral.inc.php" );
31   -require_once ("include/clsPDF.inc.php");
32 2  
  3 +/**
  4 + * i-Educar - Sistema de gestão escolar
  5 + *
  6 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  7 + * <ctima@itajai.sc.gov.br>
  8 + *
  9 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  10 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  11 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  12 + * qualquer versão posterior.
  13 + *
  14 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  15 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  16 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  17 + * do GNU para mais detalhes.
  18 + *
  19 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  20 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  21 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  22 + *
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  24 + * @category i-Educar
  25 + * @license @@license@@
  26 + * @package iEd_Pmieducar
  27 + * @since Arquivo disponível desde a versão 1.0.0
  28 + * @version $Id$
  29 + */
  30 +
  31 +require_once 'include/clsBase.inc.php';
  32 +require_once 'include/clsCadastro.inc.php';
  33 +require_once 'include/clsBanco.inc.php';
  34 +require_once 'include/pmieducar/geral.inc.php';
  35 +require_once 'include/clsPDF.inc.php';
  36 +
  37 +/**
  38 + * clsIndexBase class.
  39 + *
  40 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  41 + * @category i-Educar
  42 + * @license @@license@@
  43 + * @package iEd_Pmieducar
  44 + * @since Classe disponível desde a versão 1.0.0
  45 + * @version @@package_version@@
  46 + */
33 47 class clsIndexBase extends clsBase
34 48 {
35   - function Formular()
36   - {
37   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Resultado Final" );
38   - $this->processoAp = "823";
39   - }
  49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Resultado Final');
  52 + $this->processoAp = 823;
  53 + }
40 54 }
41 55  
  56 +/**
  57 + * indice class.
  58 + *
  59 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  60 + * @category i-Educar
  61 + * @license @@license@@
  62 + * @package iEd_Pmieducar
  63 + * @since Classe disponível desde a versão 1.0.0
  64 + * @version @@package_version@@
  65 + */
42 66 class indice extends clsCadastro
43 67 {
  68 + var $pessoa_logada;
44 69  
  70 + var $ref_cod_instituicao;
  71 + var $ref_cod_escola;
  72 + var $ref_cod_serie;
  73 + var $ref_cod_turma;
45 74  
46   - /**
47   - * Referencia pega da session para o idpes do usuario atual
48   - *
49   - * @var int
50   - */
51   - var $pessoa_logada;
  75 + var $ano;
52 76  
  77 + var $ref_cod_curso;
53 78  
54   - var $ref_cod_instituicao;
55   - var $ref_cod_escola;
56   - var $ref_cod_serie;
57   - var $ref_cod_turma;
  79 + function Inicializar()
  80 + {
  81 + $retorno = 'Novo';
  82 + @session_start();
  83 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  84 + @session_write_close();
58 85  
59   - var $ano;
  86 + return $retorno;
  87 + }
60 88  
61   - var $ref_cod_curso;
  89 + function Gerar()
  90 + {
  91 + @session_start();
  92 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  93 + @session_write_close();
62 94  
63   - function Inicializar()
64   - {
65   - $retorno = "Novo";
66   - @session_start();
67   - $this->pessoa_logada = $_SESSION['id_pessoa'];
68   - @session_write_close();
  95 + $this->campoNumero('ano', 'Ano', date('Y'), 4, 4, TRUE);
69 96  
70   - return $retorno;
  97 + $get_escola = TRUE;
  98 + $obrigatorio = TRUE;
  99 + $exibe_nm_escola = TRUE;
  100 + $get_curso = TRUE;
  101 + $get_escola_curso_serie = TRUE;
  102 + $get_turma = TRUE;
71 103  
72   - }
73   -
74   - function Gerar()
75   - {
76   -
77   - @session_start();
78   - $this->pessoa_logada = $_SESSION['id_pessoa'];
79   - @session_write_close();
80   -
81   -
82   - $this->campoNumero( "ano", "Ano", date("Y"), 4, 4, true );
83   -
84   - $get_escola = true;
85   - $obrigatorio = true;
86   - $exibe_nm_escola = true;
87   - $get_curso = true;
88   - $get_escola_curso_serie = true;
89   - $get_turma = true;
90   -
91   - include("include/pmieducar/educar_campo_lista.php");
92   -
93   - $this->url_cancelar = "educar_index.php";
94   - $this->nome_url_cancelar = "Cancelar";
95   -
96   - $this->acao_enviar = 'acao2()';
97   - $this->acao_executa_submit = false;
98   - }
  104 + include 'include/pmieducar/educar_campo_lista.php';
99 105  
  106 + $this->url_cancelar = 'educar_index.php';
  107 + $this->nome_url_cancelar = 'Cancelar';
100 108  
  109 + $this->acao_enviar = 'acao2()';
  110 + $this->acao_executa_submit = FALSE;
  111 + }
101 112 }
102 113  
103   -// cria uma extensao da classe base
  114 +// Instancia objeto de página
104 115 $pagina = new clsIndexBase();
105   -// cria o conteudo
  116 +
  117 +// Instancia objeto de conteúdo
106 118 $miolo = new indice();
107   -// adiciona o conteudo na clsBase
108   -$pagina->addForm( $miolo );
109   -// gera o html
110   -$pagina->MakeAll();
111 119  
  120 +// Atribui o conteúdo à página
  121 +$pagina->addForm($miolo);
112 122  
  123 +// Gera o código HTML
  124 +$pagina->MakeAll();
113 125 ?>
114   -<script>
115   -
  126 +<script type="text/javascript">
116 127 function acao2()
117 128 {
118   - if(!acao())
119   - return false;
  129 + if (!acao()) {
  130 + return false;
  131 + }
120 132  
121   - showExpansivelImprimir(400, 200,'',[], "Diário de Classe");
122   -
123   - document.formcadastro.target = 'miolo_'+(DOM_divs.length-1);
124   -
125   - document.formcadastro.submit();
  133 + showExpansivelImprimir(400, 200, '', [], 'Diário de Classe');
  134 + document.formcadastro.target = 'miolo_' + (DOM_divs.length - 1);
  135 + document.formcadastro.submit();
126 136 }
127 137  
128 138 document.formcadastro.action = 'educar_relatorio_resultado_final_proc.php';
129 139  
130 140 document.getElementById('ref_cod_escola').onchange = function()
131 141 {
132   - getEscolaCurso();
133   - document.getElementById('ref_cod_curso').onchange();
134   -
  142 + getEscolaCurso();
  143 + document.getElementById('ref_cod_curso').onchange();
135 144 }
136 145  
137   -
138 146 document.getElementById('ref_cod_curso').onchange = function()
139 147 {
140   - getEscolaCursoSerie();
  148 + getEscolaCursoSerie();
141 149 }
142 150  
143   -
144 151 document.getElementById('ref_ref_cod_serie').onchange = function()
145 152 {
146   - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;
147   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
  153 + var campoEscola = document.getElementById('ref_cod_escola').value;
  154 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
148 155  
149   - var xml1 = new ajax(getTurma_XML);
150   - strURL = "educar_turma_xml.php?esc="+campoEscola+"&ser="+campoSerie;
151   - xml1.envia(strURL);
  156 + var xml1 = new ajax(getTurma_XML);
  157 + strURL = 'educar_turma_xml.php?esc=' + campoEscola + '&ser=' + campoSerie;
  158 + xml1.envia(strURL);
152 159 }
153 160  
154 161 function getTurma_XML(xml)
155 162 {
  163 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
  164 + var campoTurma = document.getElementById('ref_cod_turma');
  165 + var turma = xml.getElementsByTagName('turma');
156 166  
  167 + campoTurma.length = 1;
  168 + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false);
157 169  
158   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
159   -
160   - var campoTurma = document.getElementById( 'ref_cod_turma' );
161   -
162   - var turma = xml.getElementsByTagName( "turma" );
163   -
164   - campoTurma.length = 1;
165   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
166   - for ( var j = 0; j < turma.length; j++ )
167   - {
168   -
169   - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );
170   -
171   - }
172   - if ( campoTurma.length == 1 && campoSerie != '' ) {
173   - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false );
174   - }
  170 + for (var j = 0; j < turma.length; j++) {
  171 + campoTurma.options[campoTurma.options.length] = new Option(turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false);
  172 + }
175 173  
  174 + if (campoTurma.length == 1 && campoSerie != '') {
  175 + campoTurma.options[0] = new Option('A série não possui nenhuma turma', '', false, false);
  176 + }
176 177 }
177   -
178   -</script>
  178 +</script>
179 179 \ No newline at end of file
... ...
ieducar/intranet/educar_relatorio_resultado_final_proc.php
1 1 <?php
2 2  
3   -/*
  3 +/**
4 4 * i-Educar - Sistema de gestão escolar
5 5 *
6 6 * Copyright (C) 2006 Prefeitura Municipal de Itajaí
... ... @@ -19,17 +19,13 @@
19 19 * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
20 20 * com este programa; se não, escreva para a Free Software Foundation, Inc., no
21 21 * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
22   - */
23   -
24   -/**
25   - * Relatório de Resultado final de turma.
26 22 *
27   - * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
28   - * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
29   - * @package Core
30   - * @subpackage Relatório
31   - * @since Arquivo disponível desde a versão 1.0.0
32   - * @version $Id$
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  24 + * @category i-Educar
  25 + * @license @@license@@
  26 + * @package iEd_Pmieducar
  27 + * @since Arquivo disponível desde a versão 1.0.0
  28 + * @version $Id$
33 29 */
34 30  
35 31 require_once 'include/clsBase.inc.php';
... ... @@ -38,423 +34,498 @@ require_once &#39;include/clsBanco.inc.php&#39;;
38 34 require_once 'include/pmieducar/geral.inc.php';
39 35 require_once 'include/clsPDF.inc.php';
40 36  
41   -
  37 +/**
  38 + * clsIndexBase class.
  39 + *
  40 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  41 + * @category i-Educar
  42 + * @license @@license@@
  43 + * @package iEd_Pmieducar
  44 + * @since Classe disponível desde a versão 1.0.0
  45 + * @version @@package_version@@
  46 + */
42 47 class clsIndexBase extends clsBase
43 48 {
44   - function Formular()
45   - {
46   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Resultado Final" );
47   - $this->processoAp = "823"; //alterar
48   - $this->renderMenu = false;
49   - $this->renderMenuSuspenso = false;
50   - }
  49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Resultado Final');
  52 + $this->processoAp = 823;
  53 + $this->renderMenu = FALSE;
  54 + $this->renderMenuSuspenso = FALSE;
  55 + }
51 56 }
52 57  
  58 +/**
  59 + * indice class.
  60 + *
  61 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  62 + * @category i-Educar
  63 + * @license @@license@@
  64 + * @package iEd_Pmieducar
  65 + * @since Classe disponível desde a versão 1.0.0
  66 + * @version @@package_version@@
  67 + */
53 68 class indice extends clsCadastro
54 69 {
  70 + var $pessoa_logada;
  71 +
  72 + var $ref_cod_instituicao;
  73 + var $ref_cod_escola;
  74 + var $ref_cod_serie;
  75 + var $ref_cod_turma;
55 76  
  77 + var $ano;
56 78  
57   - /**
58   - * Referencia pega da session para o idpes do usuario atual
59   - *
60   - * @var int
61   - */
62   - var $pessoa_logada;
63   -
64   -
65   - var $ref_cod_instituicao;
66   - var $ref_cod_escola;
67   - var $ref_cod_serie;
68   - var $ref_cod_turma;
69   -
70   - var $ano;
71   -
72   - var $nm_escola;
73   - var $nm_instituicao;
74   - var $ref_cod_curso;
75   - var $pdf;
76   -
77   - var $nm_turma;
78   - var $nm_serie;
79   - var $nm_cidade;
80   -
81   - var $array_modulos;
82   -
83   - var $is_padrao;
84   - var $semestre;
  79 + var $nm_escola;
  80 + var $nm_instituicao;
  81 + var $ref_cod_curso;
  82 + var $pdf;
85 83  
86   - var $get_link;
87   -
88   - function renderHTML()
89   - {
  84 + var $nm_turma;
  85 + var $nm_serie;
  86 + var $nm_cidade;
90 87  
91   - if($_POST){
92   - foreach ($_POST as $key => $value) {
93   - $this->$key = $value;
94   -
95   - }
96   - }
97   - if($this->ref_ref_cod_serie)
98   - $this->ref_cod_serie = $this->ref_ref_cod_serie;
99   -
100   - $fonte = 'arial';
101   - $corTexto = '#000000';
102   -
103   - if(empty($this->ref_cod_turma))
104   - {
105   - echo '<script>
106   - alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");
107   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
108   - </script>';
109   - return true;
110   - }
111   -
112   - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
113   - $det_escola = $obj_escola->detalhe();
114   - $this->nm_escola = $det_escola['nome'];
115   -
116   - $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']);
117   - $det_instituicao = $obj_instituicao->detalhe();
118   - $this->nm_instituicao = $det_instituicao['nm_instituicao'];
119   -
120   - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
121   - $det_turma = $obj_turma->detalhe();
122   - $this->nm_turma = $det_turma['nm_turma'];
123   -
124   - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
125   - $det_serie = $obj_serie->detalhe();
126   - $this->nm_serie = $det_serie['nm_serie'];
127   -
128   - $eh_multi_seriado = false;
129   -
130   - if (is_numeric($det_turma["ref_ref_cod_serie_mult"]))
131   - {
132   - $series = array();
133   - $series[$det_serie["cod_serie"]] = $det_serie["nm_serie"];
134   - $obj_serie = new clsPmieducarSerie($det_turma["ref_ref_cod_serie_mult"]);
135   - $det_serie = $obj_serie->detalhe();
136   - $this->nm_serie .= " / {$det_serie["nm_serie"]}";
137   - $series[$det_serie["cod_serie"]] = $det_serie["nm_serie"];
138   - $eh_multi_seriado = true;
139   - }
140   -
141   - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
142   - $det_curso = $obj_curso->detalhe();
143   - $frequencia_minima = $det_curso["frequencia_minima"];
144   - $hora_falta = $det_curso["hora_falta"];
145   - //ref_cod_tipo_avaliacao
146   - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso["ref_cod_tipo_avaliacao"]);
147   - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
148   -
149   - $eh_conceitual = $det_tipo_avaliacao["conceitual"];
150   -
151   - if($det_curso['padrao_ano_escolar'])
152   - {
153   - $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
154   - $obj_ano_letivo_modulo->setOrderby("data_inicio asc");
155   - $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano,$this->ref_cod_escola,null,null);
156   - if($lst_ano_letivo_modulo)
157   - {
158   - foreach ($lst_ano_letivo_modulo as $modulo) {
159   - $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']);
160   - $det_modulo = $obj_modulo->detalhe();
161   - $this->array_modulos[] = $det_modulo;
162   - }
163   - }
164   - }
165   -
166   - $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina();
167   - $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie, $this->ref_cod_escola, null, 1);
168   -
169   - $this->pdf = new clsPDF("Resultado Final", "Resultado Final", "A4", "", false, false);
170   -
171   - $this->pdf->OpenPage();
172   -
173   - $this->addCabecalho();
174   -
175   - $this->pdf->linha_relativa(30, 140, 540, 0);
176   - $this->pdf->linha_relativa(30, 140, 0, 30);
177   - $this->pdf->linha_relativa(570, 140, 0, 30);
178   - $this->pdf->linha_relativa(30, 170, 540, 0);
179   -
180   - $this->pdf->linha_relativa(60, 140, 0, 30);
181   - $this->pdf->linha_relativa(320, 140, 0, 30);
182   -
183   - $this->pdf->linha_relativa(380, 140, 0, 30);
184   - $this->pdf->linha_relativa(490, 140, 0, 30);
185   -
186   - $this->pdf->linha_relativa(380, 155, 190, 0);
187   - $this->pdf->linha_relativa(530, 155, 0, 15);
188   -
189   - $this->pdf->linha_relativa(450, 155, 0, 15);
190   -
191   - $this->pdf->escreve_relativo("Ord", 35, 150, 20, 20, null, 10);
192   - $this->pdf->escreve_relativo("Nome do aluno", 70, 150, 160, 20, null, 10);
193   - $this->pdf->escreve_relativo("Aprovado", 325, 150, 160, 20, null, 10);
194   - $this->pdf->escreve_relativo("Reprovado", 410, 142, 160, 20, null, 10);
195   - $this->pdf->escreve_relativo("Desempenho", 384, 156, 160, 20, null, 10);
196   - $this->pdf->escreve_relativo("Faltas", 455, 156, 160, 20, null, 10);
197   - $this->pdf->escreve_relativo("Alf.", 500, 156, 160, 20, null, 10);
198   - $this->pdf->escreve_relativo("N. Alf.", 535, 156, 160, 20, null, 10);
199   -
200   - $obj_matricula = new clsPmieducarMatriculaTurma();
201   - $obj_matricula->setOrderby('m.ref_ref_cod_serie, nome_ascii');
202   -
203   - if ($this->is_padrao || $this->ano == 2007) {
204   - $this->semestre = null;
205   - }
206   -
207   - $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,
208   - null,null, null, $det_turma["ref_ref_cod_serie_mult"], $this->semestre);
209   - //$total_alunos = 42;
210   - $qtd_quebra = 43;
211   - $base = 155;
212   - $linha = 1;
213   -
214   - $total_aprovados = 0;
215   - $total_reprovados_desempenho = 0;
216   - $total_reprovados_nota = 0;
217   - $total_analfabetos = 0;
218   - $total_nao_analfabetos = 0;
219   - $ordem_mostra = 0;
220   - if(is_array($lst_matricula))
221   - {
222   - foreach ($lst_matricula as $ordem => $matricula)
223   - {
224   - $obj_matricula = new clsPmieducarMatricula($matricula["ref_cod_matricula"]);
225   - $det_matricula = $obj_matricula->detalhe();
226   - if ($det_matricula["aprovado"] == 1 || $det_matricula["aprovado"] == 2)
227   - {
228   - $ordem_mostra++;
229   - $ordem_mostra = sprintf("%02d",$ordem_mostra);
230   - if($linha % $qtd_quebra == 0)
231   - {
232   - //nova pagina
233   - $this->pdf->ClosePage();
234   - $this->pdf->OpenPage();
235   - $base = 30;
236   - $linha = 0;
237   - $this->pdf->linha_relativa(30, 30, 540, 0);
238   - $qtd_quebra = 51;
239   - }
240   - $this->pdf->linha_relativa(30, $base+($linha*15), 0, 15);
241   - $this->pdf->linha_relativa(60, $base+($linha*15), 0, 15);
242   - $this->pdf->linha_relativa(30, ($base+15)+($linha*15), 540, 0);
243   - $this->pdf->linha_relativa(570, $base+($linha*15), 0, 15);//fim
244   - $this->pdf->escreve_relativo($ordem_mostra, 40, ($base+3)+($linha*15), 15, 15, null, 8);
245   - if ($eh_multi_seriado)
246   - $this->pdf->escreve_relativo($matricula['nome']." ({$series[$det_matricula["ref_ref_cod_serie"]]})", 65, ($base+3)+($linha*15), 250, 15, null, 8);
247   - else
248   - $this->pdf->escreve_relativo($matricula['nome'], 65, ($base+3)+($linha*15), 250, 15, null, 8);
249   -
250   - if (!$eh_conceitual)
251   - {
252   - if ($det_matricula["aprovado"] == 1)
253   - {
254   - $this->pdf->escreve_relativo("X", 345, ($base+3)+($linha*15), 250, 15, null, 8);//aprovado
255   - $total_aprovados++;
256   - }
257   - else
258   - {
259   - $reprovou_por_falta = false;
260   - $reprovou_por_nota = false;
261   - if (is_array($lst_disc_serie))
262   - {
263   - foreach ($lst_disc_serie as $disciplina) {
264   - if (!$reprovou_por_falta)
265   - {
266   - $obj_falta = new clsPmieducarFaltaAluno();
267   - if ($det_curso["padrao_ano_escolar"] == 1)
268   - $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);
269   - else
270   - $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"]);
271   - $total_faltas = 0;
272   - if(is_array($lst_falta))
273   - {
274   - foreach ($lst_falta as $key => $value)
275   - {
276   - $total_faltas += $lst_falta[$key]['faltas'];
277   - }
278   - }
279   - $obj_disciplina = new clsPmieducarDisciplina($disciplina["ref_cod_disciplina"]);
280   - $det_disciplina = $obj_disciplina->detalhe();
281   - $carga_horaria_disciplina = $det_disciplina["carga_horaria"];
282   - $max_falta = ($carga_horaria_disciplina * $frequencia_minima)/100;
283   - $max_falta = $carga_horaria_disciplina - $max_falta;
284   - $total_faltas *= $hora_falta;
285   - if ($total_faltas > $max_falta)
286   - {
287   - $this->pdf->escreve_relativo("X", 465, ($base+3)+($linha*15), 250, 15, null, 8);//faltas
288   - $reprovou_por_falta = true;
289   - $total_reprovados_desempenho++;
290   - }
291   - }
292   - if (!$reprovou_por_nota)
293   - {
294   - $obj_nota = new clsPmieducarNotaAluno();
295   - $obj_nota->setOrderby("modulo asc");
296   - if($det_curso['padrao_ano_escolar'] == 1)
297   - $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);
298   - else
299   - $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']);
300   -
301   - if (is_array($det_nota))
302   - {
303   - // usort($det_nota, "cmp");
304   -
305   - $soma_notas = 0;
306   - foreach ($det_nota as $key => $nota) {
307   -
308   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota['ref_ref_cod_tipo_avaliacao'],$nota['ref_sequencial'],null,null,null,null);
309   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
310   -
311   - if ( count($this->array_modulos) == count($det_nota) )
312   - {
313   - $frequencia_minima = $det_curso["frequencia_minima"];
314   - $hora_falta = $det_curso["hora_falta"];
315   - $carga_horaria_curso = $det_curso["carga_horaria"];
316   - }
317   - if (!dbBool($det_serie["ultima_nota_define"]))
318   - {
319   - if($key < (count($this->array_modulos)) )
320   - {
321   - $soma_notas += $det_tipo_av_val['valor'];
322   - $media_sem_exame = true;
323   - }
324   - else
325   - {
326   - $media_sem_exame = false;
327   - $nota_exame = true;
328   - $exame_nota = $det_nota[$key]["nota"];
329   - }
330   - }
331   - else
332   - {
333   - $media_sem_exame = true;
334   - $soma_notas = $det_tipo_av_val["valor"];
335   - }
336   - }
337   - }
338   - if (!dbBool($det_serie["ultima_nota_define"]))
339   - {
340   - if (!$nota_exame)
341   - {
342   - $media = $soma_notas / count($det_nota); //soh esta parte eh do codigo original
343   - // $media_ = $media;
344   - }
345   - else
346   - {
347   - $media = ($soma_notas + $exame_nota * 2) / (count($det_nota)+1);
348   - }
349   - }
350   - else
351   - {
352   - $media = $soma_notas;
353   - }
354   -
355   - $obj_media = new clsPmieducarTipoAvaliacaoValores();
356   - $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],$det_curso['ref_sequencial'],null,null,$media,$media);
357   - if($det_media)
358   - {
359   - $det_media = array_shift($det_media);
360   - $media = $det_media['valor'];
361   - $media = sprintf("%01.1f",$media);
362   - $media = str_replace(".",",",$media);
363   - }
364   - if($media_sem_exame)
365   - $media_curso_ = $det_curso['media'];
366   - else
367   - $media_curso_ = $det_curso['media_exame'];
368   - if (str_replace(",", ".", $media) < $media_curso_)
369   - {
370   - $this->pdf->escreve_relativo("X", 410, ($base+3)+($linha*15), 250, 15, null, 8);//desempenho
371   - $reprovou_por_nota = true;
372   - $total_reprovados_nota++;
373   - }
374   - }
375   - if ($reprovou_por_falta && $reprovou_por_nota)
376   - break;
377   - }
378   - }
379   - }
380   - }
381   - else
382   - {
383   - if ($det_matricula["aprovado"] == 1)
384   - {
385   - $this->pdf->escreve_relativo("X", 345, ($base+3)+($linha*15), 250, 15, null, 8);//aprovado
386   - $total_aprovados++;
387   - }
388   - else
389   - {
390   - $this->pdf->escreve_relativo("X", 410, ($base+3)+($linha*15), 250, 15, null, 8);//desempenho
391   - $reprovou_por_nota = true;
392   - $total_reprovados_nota++;
393   - }
394   - }
395   - /*analfabeto*/
396   - $obj_aluno = new clsPmieducarAluno($det_matricula["ref_cod_aluno"]);
397   - $obj_aluno->setCamposLista("analfabeto");
398   - $det_aluno = $obj_aluno->detalhe();
399   - if ($det_aluno["analfabeto"] == 0) {
400   - $this->pdf->escreve_relativo("X", 507, ($base+3)+($linha*15), 250, 15, null, 8);//nao alfabetizado
401   - $total_analfabetos++;
402   - }
403   - else {
404   - $this->pdf->escreve_relativo("X", 545, ($base+3)+($linha*15), 250, 15, null, 8);//alfabetizado
405   - $total_nao_analfabetos++;
406   - }
407   - $this->pdf->linha_relativa(320, $base+($linha*15), 0, 15);
408   - $this->pdf->linha_relativa(380, $base+($linha*15), 0, 15);
409   - $this->pdf->linha_relativa(490, $base+($linha*15), 0, 15);
410   - $this->pdf->linha_relativa(530, $base+($linha*15), 0, 15);
411   - $this->pdf->linha_relativa(450, $base+($linha*15), 0, 15);
412   -
413   -
414   - $linha++;
415   - }
416   - }
417   - }
418   - //escrever total
419   - $this->pdf->linha_relativa(30, $base+($linha*15), 0, 15);
420   -
421   - $this->pdf->escreve_relativo("Total", 35, ($base+3)+($linha*15), 20, 15, null, 8);
422   -
423   - $this->pdf->escreve_relativo($total_aprovados, 345, ($base+3)+($linha*15), 250, 15, null, 8);//aprovado
424   - $this->pdf->escreve_relativo($total_reprovados_desempenho, 465, ($base+3)+($linha*15), 250, 15, null, 8);//desempenho
425   - $this->pdf->escreve_relativo($total_reprovados_nota, 410, ($base+3)+($linha*15), 250, 15, null, 8);//faltas
426   - $this->pdf->escreve_relativo($total_analfabetos, 507, ($base+3)+($linha*15), 250, 15, null, 8);//nao alfabetizado
427   - $this->pdf->escreve_relativo($total_nao_analfabetos, 545, ($base+3)+($linha*15), 250, 15, null, 8);//alfabetizado
428   -
429   - $this->pdf->linha_relativa(60, $base+($linha*15), 0, 15);
430   - $this->pdf->linha_relativa(320, $base+($linha*15), 0, 15);
431   - $this->pdf->linha_relativa(380, $base+($linha*15), 0, 15);
432   - $this->pdf->linha_relativa(490, $base+($linha*15), 0, 15);
433   - $this->pdf->linha_relativa(530, $base+($linha*15), 0, 15);
434   - $this->pdf->linha_relativa(450, $base+($linha*15), 0, 15);
435   -
436   -
437   - $this->pdf->linha_relativa(570, $base+($linha*15), 0, 15);
438   -
439   - $this->pdf->linha_relativa(30, $base+(($linha+1)*15), 540, 0);
440   -
441   - $this->pdf->ClosePage();
442   - $this->pdf->CloseFile();
443   - $this->get_link = $this->pdf->GetLink();
444   -
445   -
446   - echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>";
447   -
448   - echo "<html><center>Se o download não iniciar automaticamente <br /><a target='blank' href='" . $this->get_link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>clique aqui!</a><br><br>
449   - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
450   -
451   - Clique na Imagem para Baixar o instalador<br><br>
452   - <a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br><img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\"></a>
453   - </span>
454   - </center>";
455   - }
456   -
457   - public function addCabecalho()
  88 + var $array_modulos;
  89 +
  90 + var $is_padrao;
  91 + var $semestre;
  92 +
  93 + var $get_link;
  94 +
  95 + function renderHTML()
  96 + {
  97 + if ($_POST) {
  98 + foreach ($_POST as $key => $value) {
  99 + $this->$key = $value;
  100 + }
  101 + }
  102 +
  103 + if ($this->ref_ref_cod_serie) {
  104 + $this->ref_cod_serie = $this->ref_ref_cod_serie;
  105 + }
  106 +
  107 + $fonte = 'arial';
  108 + $corTexto = '#000000';
  109 +
  110 + if (empty($this->ref_cod_turma)) {
  111 + echo '
  112 + <script>
  113 + alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");
  114 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  115 + </script>';
  116 + return TRUE;
  117 + }
  118 +
  119 + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
  120 + $det_escola = $obj_escola->detalhe();
  121 + $this->nm_escola = $det_escola['nome'];
  122 +
  123 + $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']);
  124 + $det_instituicao = $obj_instituicao->detalhe();
  125 + $this->nm_instituicao = $det_instituicao['nm_instituicao'];
  126 +
  127 + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
  128 + $det_turma = $obj_turma->detalhe();
  129 + $this->nm_turma = $det_turma['nm_turma'];
  130 +
  131 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  132 + $det_serie = $obj_serie->detalhe();
  133 + $this->nm_serie = $det_serie['nm_serie'];
  134 +
  135 + $eh_multi_seriado = FALSE;
  136 +
  137 + if (is_numeric($det_turma['ref_ref_cod_serie_mult'])) {
  138 + $series = array();
  139 + $series[$det_serie['cod_serie']] = $det_serie['nm_serie'];
  140 +
  141 + $obj_serie = new clsPmieducarSerie($det_turma['ref_ref_cod_serie_mult']);
  142 + $det_serie = $obj_serie->detalhe();
  143 +
  144 + $this->nm_serie .= ' / ' . $det_serie['nm_serie'];
  145 +
  146 + $series[$det_serie['cod_serie']] = $det_serie['nm_serie'];
  147 + $eh_multi_seriado = TRUE;
  148 + }
  149 +
  150 + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
  151 + $det_curso = $obj_curso->detalhe();
  152 +
  153 + $frequencia_minima = $det_curso["frequencia_minima"];
  154 + $hora_falta = $det_curso["hora_falta"];
  155 +
  156 + $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso["ref_cod_tipo_avaliacao"]);
  157 + $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
  158 +
  159 + $eh_conceitual = $det_tipo_avaliacao["conceitual"];
  160 +
  161 + if ($det_curso['padrao_ano_escolar']) {
  162 + $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
  163 + $obj_ano_letivo_modulo->setOrderby('data_inicio asc');
  164 +
  165 + $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano,
  166 + $this->ref_cod_escola, NULL, NULL);
  167 +
  168 + if ($lst_ano_letivo_modulo) {
  169 + foreach ($lst_ano_letivo_modulo as $modulo) {
  170 + $obj_modulo = new clsPmieducarModulo($modulo['ref_cod_modulo']);
  171 + $det_modulo = $obj_modulo->detalhe();
  172 + $this->array_modulos[] = $det_modulo;
  173 + }
  174 + }
  175 + }
  176 +
  177 + $obj_disc_serie = new clsPmieducarEscolaSerieDisciplina();
  178 + $lst_disc_serie = $obj_disc_serie->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);
  179 +
  180 + $this->pdf = new clsPDF('Resultado Final', 'Resultado Final', 'A4', '', FALSE, FALSE);
  181 +
  182 + $this->pdf->OpenPage();
  183 +
  184 + $this->addCabecalho();
  185 +
  186 + $this->pdf->linha_relativa(30, 140, 540, 0);
  187 + $this->pdf->linha_relativa(30, 140, 0, 30);
  188 + $this->pdf->linha_relativa(570, 140, 0, 30);
  189 + $this->pdf->linha_relativa(30, 170, 540, 0);
  190 +
  191 + $this->pdf->linha_relativa(60, 140, 0, 30);
  192 + $this->pdf->linha_relativa(320, 140, 0, 30);
  193 +
  194 + $this->pdf->linha_relativa(380, 140, 0, 30);
  195 + $this->pdf->linha_relativa(490, 140, 0, 30);
  196 +
  197 + $this->pdf->linha_relativa(380, 155, 190, 0);
  198 + $this->pdf->linha_relativa(530, 155, 0, 15);
  199 +
  200 + $this->pdf->linha_relativa(450, 155, 0, 15);
  201 +
  202 + $this->pdf->escreve_relativo('Ord', 35, 150, 20, 20, NULL, 10);
  203 + $this->pdf->escreve_relativo('Nome do aluno', 70, 150, 160, 20, NULL, 10);
  204 + $this->pdf->escreve_relativo('Aprovado', 325, 150, 160, 20, NULL, 10);
  205 + $this->pdf->escreve_relativo('Reprovado', 410, 142, 160, 20, NULL, 10);
  206 + $this->pdf->escreve_relativo('Desempenho', 384, 156, 160, 20, NULL, 10);
  207 + $this->pdf->escreve_relativo('Faltas', 455, 156, 160, 20, NULL, 10);
  208 + $this->pdf->escreve_relativo('Alf.', 500, 156, 160, 20, NULL, 10);
  209 + $this->pdf->escreve_relativo('N. Alf.', 535, 156, 160, 20, NULL, 10);
  210 +
  211 + $obj_matricula = new clsPmieducarMatriculaTurma();
  212 + $obj_matricula->setOrderby('m.ref_ref_cod_serie, nome_ascii');
  213 +
  214 + // @todo 2007? Que diabo de condição é essa?
  215 + if ($this->is_padrao || $this->ano == 2007) {
  216 + $this->semestre = NULL;
  217 + }
  218 +
  219 + $lst_matricula = $obj_matricula->lista(NULL, $this->ref_cod_turma, NULL,
  220 + NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, $this->ref_cod_curso,
  221 + $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, NULL, array(1, 2, 3),
  222 + NULL, NULL, $this->ano, NULL, TRUE, NULL, NULL,TRUE, NULL,NULL, NULL,
  223 + $det_turma['ref_ref_cod_serie_mult'], $this->semestre);
  224 +
  225 + $qtd_quebra = 43;
  226 + $base = 155;
  227 + $linha = 1;
  228 +
  229 + $total_aprovados = 0;
  230 + $total_reprovados_desempenho = 0;
  231 + $total_reprovados_nota = 0;
  232 + $total_analfabetos = 0;
  233 + $total_nao_analfabetos = 0;
  234 + $ordem_mostra = 0;
  235 +
  236 + if (is_array($lst_matricula)) {
  237 + foreach ($lst_matricula as $ordem => $matricula) {
  238 + $obj_matricula = new clsPmieducarMatricula($matricula['ref_cod_matricula']);
  239 + $det_matricula = $obj_matricula->detalhe();
  240 +
  241 + if ($det_matricula['aprovado'] == 1 || $det_matricula['aprovado'] == 2) {
  242 + $ordem_mostra++;
  243 + $ordem_mostra = sprintf('%02d', $ordem_mostra);
  244 +
  245 + if ($linha % $qtd_quebra == 0) {
  246 + //nova pagina
  247 + $this->pdf->ClosePage();
  248 + $this->pdf->OpenPage();
  249 +
  250 + $base = 30;
  251 + $linha = 0;
  252 +
  253 + $this->pdf->linha_relativa(30, 30, 540, 0);
  254 + $qtd_quebra = 51;
  255 + }
  256 +
  257 + $this->pdf->linha_relativa(30, $base + ($linha * 15), 0, 15);
  258 + $this->pdf->linha_relativa(60, $base + ($linha * 15), 0, 15);
  259 + $this->pdf->linha_relativa(30, ($base + 15) + ($linha * 15), 540, 0);
  260 + $this->pdf->linha_relativa(570, $base + ($linha * 15), 0, 15); // fim
  261 +
  262 + $this->pdf->escreve_relativo($ordem_mostra, 40, ($base + 3) + ($linha * 15),
  263 + 15, 15, NULL, 8);
  264 +
  265 + if ($eh_multi_seriado) {
  266 + $this->pdf->escreve_relativo($matricula['nome'] . ' (' . $series[$det_matricula['ref_ref_cod_serie']] . ')',
  267 + 65, ($base + 3) + ($linha * 15), 250, 15, NULL, 8);
  268 + }
  269 + else {
  270 + $this->pdf->escreve_relativo($matricula['nome'], 65, ($base + 3) + ($linha * 15),
  271 + 250, 15, NULL, 8);
  272 + }
  273 +
  274 + if (!$eh_conceitual) {
  275 + if ($det_matricula['aprovado'] == 1) {
  276 + $this->pdf->escreve_relativo('X', 345, ($base + 3) + ($linha * 15),
  277 + 250, 15, NULL, 8);
  278 + $total_aprovados++;
  279 + }
  280 + else {
  281 + $reprovou_por_falta = FALSE;
  282 + $reprovou_por_nota = FALSE;
  283 +
  284 + if (is_array($lst_disc_serie)) {
  285 + foreach ($lst_disc_serie as $disciplina) {
  286 + if (!$reprovou_por_falta) {
  287 + $obj_falta = new clsPmieducarFaltaAluno();
  288 +
  289 + if ($det_curso['padrao_ano_escolar'] == 1) {
  290 + $lst_falta = $obj_falta->lista(NULL, NULL, NULL,
  291 + $this->ref_cod_serie, $this->ref_cod_escola,
  292 + $disciplina['ref_cod_disciplina'],
  293 + $matricula['ref_cod_matricula'], NULL, NULL, NULL,
  294 + NULL, NULL, 1);
  295 + }
  296 + else {
  297 + $lst_falta = $obj_falta->lista(NULL, NULL, NULL,
  298 + $this->ref_cod_serie, $this->ref_cod_escola, NULL,
  299 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL,
  300 + NULL, 1, NULL, $disciplina['ref_cod_disciplina']);
  301 + }
  302 +
  303 + $total_faltas = 0;
  304 + if (is_array($lst_falta)) {
  305 + foreach ($lst_falta as $key => $value) {
  306 + $total_faltas += $lst_falta[$key]['faltas'];
  307 + }
  308 + }
  309 +
  310 + $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
  311 + $det_disciplina = $obj_disciplina->detalhe();
  312 + $carga_horaria_disciplina = $det_disciplina['carga_horaria'];
  313 +
  314 + $max_falta = ($carga_horaria_disciplina * $frequencia_minima) / 100;
  315 + $max_falta = $carga_horaria_disciplina - $max_falta;
  316 +
  317 + $total_faltas *= $hora_falta;
  318 + if ($total_faltas > $max_falta) {
  319 + $this->pdf->escreve_relativo('X', 465, ($base + 3) + ($linha * 15),
  320 + 250, 15, NULL, 8);
  321 +
  322 + $reprovou_por_falta = TRUE;
  323 + $total_reprovados_desempenho++;
  324 + }
  325 + }
  326 +
  327 + if (!$reprovou_por_nota) {
  328 + $obj_nota = new clsPmieducarNotaAluno();
  329 + $obj_nota->setOrderby('modulo asc');
  330 +
  331 + if ($det_curso['padrao_ano_escolar'] == 1) {
  332 + $det_nota = $obj_nota->lista(NULL, NULL, NULL,
  333 + $this->ref_cod_serie, $this->ref_cod_escola,
  334 + $disciplina['ref_cod_disciplina'], $matricula['ref_cod_matricula'],
  335 + NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL);
  336 + }
  337 + else {
  338 + $det_nota = $obj_nota->lista(NULL, NULL, NULL,
  339 + $this->ref_cod_serie, $this->ref_cod_escola, NULL,
  340 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL,
  341 + NULL, NULL, 1, NULL, $disciplina['ref_cod_disciplina']);
  342 + }
  343 +
  344 + if (is_array($det_nota)) {
  345 + $soma_notas = 0;
  346 +
  347 + foreach ($det_nota as $key => $nota) {
  348 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  349 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  350 + NULL, NULL, NULL, NULL
  351 + );
  352 +
  353 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  354 +
  355 + if (count($this->array_modulos) == count($det_nota)) {
  356 + $frequencia_minima = $det_curso['frequencia_minima'];
  357 + $hora_falta = $det_curso['hora_falta'];
  358 + $carga_horaria_curso = $det_curso['carga_horaria'];
  359 + }
  360 +
  361 + if (!dbBool($det_serie['ultima_nota_define'])) {
  362 + if ($key < (count($this->array_modulos))) {
  363 + $soma_notas += $det_tipo_av_val['valor'];
  364 + $media_sem_exame = TRUE;
  365 + }
  366 + else {
  367 + $media_sem_exame = FALSE;
  368 + $nota_exame = TRUE;
  369 + $exame_nota = $det_nota[$key]['nota'];
  370 + }
  371 + }
  372 + else {
  373 + $media_sem_exame = TRUE;
  374 + $soma_notas = $det_tipo_av_val['valor'];
  375 + }
  376 + }
  377 + }
  378 +
  379 + if (!dbBool($det_serie['ultima_nota_define'])) {
  380 + if (!$nota_exame) {
  381 + $media = $soma_notas / count($det_nota);
  382 + // soh esta parte eh do codigo original
  383 + // $media_ = $media;
  384 + }
  385 + else {
  386 + $media = ($soma_notas + $exame_nota * 2) / (count($det_nota) + 1);
  387 + }
  388 + }
  389 + else {
  390 + $media = $soma_notas;
  391 + }
  392 +
  393 + $obj_media = new clsPmieducarTipoAvaliacaoValores();
  394 + $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],
  395 + $det_curso['ref_sequencial'], NULL, NULL, $media, $media);
  396 +
  397 + if ($det_media) {
  398 + $det_media = array_shift($det_media);
  399 + $media = $det_media['valor'];
  400 + $media = sprintf('%01.1f',$media);
  401 + $media = str_replace('.', ',', $media);
  402 + }
  403 +
  404 + if ($media_sem_exame) {
  405 + $media_curso_ = $det_curso['media'];
  406 + }
  407 + else {
  408 + $media_curso_ = $det_curso['media_exame'];
  409 + }
  410 +
  411 + if (str_replace(',', '.', $media) < $media_curso_) {
  412 + $this->pdf->escreve_relativo('X', 410, ($base + 3) + ($linha * 15),
  413 + 250, 15, NULL, 8);
  414 + $reprovou_por_nota = TRUE;
  415 + $total_reprovados_nota++;
  416 + }
  417 + }
  418 +
  419 + if ($reprovou_por_falta && $reprovou_por_nota) {
  420 + break;
  421 + }
  422 + }
  423 + }
  424 + }
  425 + }
  426 + else {
  427 + if ($det_matricula['aprovado'] == 1) {
  428 + $this->pdf->escreve_relativo('X', 345, ($base + 3) + ($linha * 15),
  429 + 250, 15, NULL, 8); // aprovado
  430 +
  431 + $total_aprovados++;
  432 + }
  433 + else {
  434 + $this->pdf->escreve_relativo('X', 410, ($base + 3) + ($linha * 15),
  435 + 250, 15, NULL, 8); // desempenho
  436 +
  437 + $reprovou_por_nota = TRUE;
  438 + $total_reprovados_nota++;
  439 + }
  440 + }
  441 +
  442 + // analfabeto
  443 + $obj_aluno = new clsPmieducarAluno($det_matricula['ref_cod_aluno']);
  444 + $obj_aluno->setCamposLista('analfabeto');
  445 + $det_aluno = $obj_aluno->detalhe();
  446 +
  447 + if ($det_aluno['analfabeto'] == 0) {
  448 + $this->pdf->escreve_relativo('X', 507, ($base + 3) + ($linha * 15),
  449 + 250, 15, NULL, 8); // não alfabetizado
  450 +
  451 + $total_analfabetos++;
  452 + }
  453 + else {
  454 + $this->pdf->escreve_relativo('X', 545, ($base + 3) + ($linha * 15),
  455 + 250, 15, NULL, 8); // alfabetizado
  456 +
  457 + $total_nao_analfabetos++;
  458 + }
  459 +
  460 + $this->pdf->linha_relativa(320, $base + ($linha * 15), 0, 15);
  461 + $this->pdf->linha_relativa(380, $base + ($linha * 15), 0, 15);
  462 + $this->pdf->linha_relativa(490, $base + ($linha * 15), 0, 15);
  463 + $this->pdf->linha_relativa(530, $base + ($linha * 15), 0, 15);
  464 + $this->pdf->linha_relativa(450, $base + ($linha * 15), 0, 15);
  465 +
  466 + $linha++;
  467 + }
  468 + }
  469 + }
  470 +
  471 + // Escrever total
  472 + $this->pdf->linha_relativa(30, $base + ($linha * 15), 0, 15);
  473 +
  474 + $this->pdf->escreve_relativo("Total", 35, ($base + 3) + ($linha * 15), 20,
  475 + 15, NULL, 8);
  476 +
  477 + $this->pdf->escreve_relativo($total_aprovados, 345, ($base + 3) + ($linha * 15),
  478 + 250, 15, null, 8); // aprovado
  479 +
  480 + $this->pdf->escreve_relativo($total_reprovados_desempenho, 465,
  481 + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // desempenho
  482 +
  483 + $this->pdf->escreve_relativo($total_reprovados_nota, 410,
  484 + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // faltas
  485 +
  486 + $this->pdf->escreve_relativo($total_analfabetos, 507,
  487 + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // não alfabetizado
  488 +
  489 + $this->pdf->escreve_relativo($total_nao_analfabetos, 545,
  490 + ($base + 3) + ($linha * 15), 250, 15, NULL, 8); // alfabetizado
  491 +
  492 + $this->pdf->linha_relativa(60, $base + ($linha * 15), 0, 15);
  493 + $this->pdf->linha_relativa(320, $base + ($linha * 15), 0, 15);
  494 + $this->pdf->linha_relativa(380, $base + ($linha * 15), 0, 15);
  495 + $this->pdf->linha_relativa(490, $base + ($linha * 15), 0, 15);
  496 + $this->pdf->linha_relativa(530, $base + ($linha * 15), 0, 15);
  497 + $this->pdf->linha_relativa(450, $base + ($linha * 15), 0, 15);
  498 +
  499 + $this->pdf->linha_relativa(570, $base + ($linha * 15), 0, 15);
  500 +
  501 + $this->pdf->linha_relativa(30, $base + (($linha + 1) * 15), 540, 0);
  502 +
  503 + $this->pdf->ClosePage();
  504 + $this->pdf->CloseFile();
  505 + $this->get_link = $this->pdf->GetLink();
  506 +
  507 + echo sprintf('
  508 + <script>
  509 + window.onload = function()
  510 + {
  511 + parent.EscondeDiv("LoadImprimir");
  512 + window.location="download.php?filename=%s"
  513 + }
  514 + </script>', $this->get_link);
  515 +
  516 + echo sprintf('
  517 + <html>
  518 + <center>
  519 + Se o download não iniciar automaticamente <br /><a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br>
  520 + <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
  521 + Clique na Imagem para Baixar o instalador<br><br>
  522 + <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a>
  523 + </span>
  524 + </center>
  525 + </html>', $this->get_link);
  526 + }
  527 +
  528 + function addCabecalho()
458 529 {
459 530 /**
460 531 * Variável global com objetos do CoreExt.
... ... @@ -478,49 +549,55 @@ class indice extends clsCadastro
478 549  
479 550 // Título principal
480 551 $titulo = $config->get($config->titulo, 'i-Educar');
  552 +
481 553 $this->pdf->escreve_relativo($titulo, 30, 30, 535, 80, $fonte, 18,
482 554 $corTexto, 'center');
  555 +
483 556 $this->pdf->escreve_relativo(date("d/m/Y"), 500, 30, 100, 80, $fonte, 12,
484 557 $corTexto, 'left');
485 558  
486 559 // Dados escola
487   - $this->pdf->escreve_relativo("Instituição: {$this->nm_instituicao}", 120,
  560 + $this->pdf->escreve_relativo('Instituição: ' . $this->nm_instituicao, 120,
488 561 58, 300, 80, $fonte, 10, $corTexto, 'left');
489   - $this->pdf->escreve_relativo("Escola: {$this->nm_escola}",138, 70, 300, 80,
  562 +
  563 + $this->pdf->escreve_relativo('Escola: ' . $this->nm_escola,138, 70, 300, 80,
490 564 $fonte, 10, $corTexto, 'left');
491   - $this->pdf->escreve_relativo("Turma/Série: {$this->nm_turma} - {$this->nm_serie}",
  565 +
  566 + $this->pdf->escreve_relativo('Turma/Série: ' . $this->nm_turma . ' - ' . $this->nm_serie,
492 567 112, 82, 300, 80, $fonte, 10, $corTexto, 'left');
493 568  
494 569 // Título
495   - $this->pdf->escreve_relativo("RESULTADO FINAL I", 30, 95, 535, 80, $fonte,
  570 + $this->pdf->escreve_relativo('RESULTADO FINAL I', 30, 95, 535, 80, $fonte,
496 571 14, $corTexto, 'center');
497 572  
498   - $this->pdf->escreve_relativo("Ano Referência: {$this->ano}", 45, 100, 535,
499   - 80, $fonte, 10, $corTexto, 'left' );
  573 + $this->pdf->escreve_relativo('Ano Referência: ' . $this->ano, 45, 100, 535,
  574 + 80, $fonte, 10, $corTexto, 'left');
500 575 }
501 576  
502   - function Editar()
503   - {
504   - return false;
505   - }
506   -
507   - function Excluir()
508   - {
509   - return false;
510   - }
  577 + function Editar()
  578 + {
  579 + return FALSE;
  580 + }
511 581  
  582 + function Excluir()
  583 + {
  584 + return FALSE;
  585 + }
512 586 }
513 587  
514 588 function cmp($a, $b)
515 589 {
516   - return $a["modulo"] > $b["modulo"];
  590 + return $a['modulo'] > $b['modulo'];
517 591 }
518 592  
519   -// cria uma extensao da classe base
  593 +// Instancia objeto de página
520 594 $pagina = new clsIndexBase();
521   -// cria o conteudo
  595 +
  596 +// Instancia objeto de conteúdo
522 597 $miolo = new indice();
523   -// adiciona o conteudo na clsBase
524   -$pagina->addForm( $miolo );
525   -// gera o html
  598 +
  599 +// Atribui o conteúdo à página
  600 +$pagina->addForm($miolo);
  601 +
  602 +// Gera o código HTML
526 603 $pagina->MakeAll();
527 604 \ No newline at end of file
... ...