Commit 5979eb80fa2b6e4e04bed818d38721380c4b8132

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

Refactoring para coding standards

ieducar/intranet/educar_relatorio_ata_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");
  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 + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
  25 + * @package Core
  26 + * @subpackage pmieducar
  27 + * @subpackage NotaFalta
  28 + * @subpackage Relatorio
  29 + * @since Arquivo disponível desde a versão 1.0.0
  30 + * @version $Id$
  31 + */
  32 +
  33 +require_once 'include/clsBase.inc.php';
  34 +require_once 'include/clsCadastro.inc.php';
  35 +require_once 'include/clsBanco.inc.php';
  36 +require_once 'include/pmieducar/geral.inc.php';
  37 +require_once 'include/clsPDF.inc.php';
32 38  
33 39 class clsIndexBase extends clsBase
34 40 {
35   - function Formular()
36   - {
37   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Rela&ccedil;&atilde;o de alunos/nota bimestres" );
38   - $this->processoAp = "807";
39   - }
  41 + function Formular()
  42 + {
  43 + $this->SetTitulo($this->_instituicao . ' i-Educar - Rela&ccedil;&atilde;o de alunos/nota bimestres');
  44 + $this->processoAp = '807';
  45 + }
40 46 }
41 47  
42 48 class indice extends clsCadastro
43 49 {
44   -
45   -
46   - /**
47   - * Referencia pega da session para o idpes do usuario atual
48   - *
49   - * @var int
50   - */
51   - var $pessoa_logada;
52   -
53   -
54   - var $ref_cod_instituicao;
55   - var $ref_cod_escola;
56   - var $ref_cod_serie;
57   - var $ref_cod_turma;
58   -
59   - var $ano;
60   - var $mes;
61   -
62   - var $nm_escola;
63   - var $nm_instituicao;
64   - var $ref_cod_curso;
65   - var $sequencial;
66   - var $pdf;
67   - var $pagina_atual = 1;
68   - var $total_paginas = 1;
69   - var $nm_professor;
70   - var $nm_turma;
71   - var $nm_serie;
72   - var $nm_disciplina;
73   - var $curso_com_exame = 0;
74   - var $ref_cod_matricula;
75   -
76   - var $page_y = 135;
77   -
78   - var $nm_aluno;
79   - var $array_modulos = array();
80   - var $nm_curso;
81   - var $get_link = false;
82   - //var $cursos = array();
83   -
84   - var $total;
85   -
86   - //var $array_disciplinas = array();
87   -
88   - var $ref_cod_modulo;
89   -
90   - var $meses_do_ano = array(
91   - "1" => "JANEIRO"
92   - ,"2" => "FEVEREIRO"
93   - ,"3" => "MAR&Ccedil;O"
94   - ,"4" => "ABRIL"
95   - ,"5" => "MAIO"
96   - ,"6" => "JUNHO"
97   - ,"7" => "JULHO"
98   - ,"8" => "AGOSTO"
99   - ,"9" => "SETEMBRO"
100   - ,"10" => "OUTUBRO"
101   - ,"11" => "NOVEMBRO"
102   - ,"12" => "DEZEMBRO"
103   - );
104   -
105   -
106   - function Inicializar()
107   - {
108   - $retorno = "Novo";
109   - @session_start();
110   - $this->pessoa_logada = $_SESSION['id_pessoa'];
111   - @session_write_close();
112   -
113   - $obj_permissoes = new clsPermissoes();
114   - //if($obj_permissoes->nivel_acesso($this->pessoa_logada) > 7)
115   - //header("location: index.php");
116   -
117   - return $retorno;
118   - }
119   -
120   - function Gerar()
121   - {
122   -
123   - $obj_permissoes = new clsPermissoes();
124   - $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
125   -
126   - if($_POST){
127   - foreach ($_POST as $key => $value) {
128   - $this->$key = $value;
129   -
130   - }
131   - }
132   -
133   -
134   -
135   - $this->ano = $ano_atual = date("Y");
136   - $this->mes = $mes_atual = date("n");
137   -
138   - $this->campoNumero( "ano", "Ano", $this->ano, 4, 4, true );
139   -
140   -
141   - $get_escola = true;
142   - //$obrigatorio = true;
143   - $exibe_nm_escola = true;
144   - $get_curso = true;
145   - $get_escola_curso_serie = true;
146   - $escola_obrigatorio = false;
147   - $curso_obrigatorio = true;
148   - $instituicao_obrigatorio = true;
149   -// $get_semestre = true;
150   -
151   - include("include/pmieducar/educar_campo_lista.php");
152   -
153   - $this->campoLista("ref_cod_turma","Turma",array('' => 'Selecione'),'');
154   -
155   - if($this->ref_cod_escola)
156   - $this->ref_ref_cod_escola = $this->ref_cod_escola;
157   -// $this->campoLista( "ref_cod_matricula", "Aluno",array(''=>'Selecione'), "","",false,"Campo não obrigatório","",false,false );
158   -// if($this->get_link)
159   -// $this->campoRotulo("rotulo11", "-", "<a href='$this->get_link' target='_blank'>Baixar Relatório</a>");
160   -
161   - $this->url_cancelar = "educar_index.php";
162   - $this->nome_url_cancelar = "Cancelar";
163   -
164   - $this->acao_enviar = 'acao2()';
165   - $this->acao_executa_submit = false;
166   -
167   - }
168   -
  50 + /**
  51 + * Referência a usuário da sessão.
  52 + * @var int
  53 + */
  54 + var $pessoa_logada;
  55 +
  56 + var $ref_cod_instituicao;
  57 + var $ref_cod_escola;
  58 + var $ref_cod_serie;
  59 + var $ref_cod_turma;
  60 + var $ano;
  61 + var $mes;
  62 + var $nm_escola;
  63 + var $nm_instituicao;
  64 + var $ref_cod_curso;
  65 + var $sequencial;
  66 + var $nm_professor;
  67 + var $nm_turma;
  68 + var $nm_serie;
  69 + var $nm_disciplina;
  70 + var $ref_cod_matricula;
  71 + var $curso_com_exame = 0;
  72 +
  73 + var $pagina_atual = 1;
  74 + var $total_paginas = 1;
  75 +
  76 + var $pdf;
  77 +
  78 + var $page_y = 135;
  79 +
  80 + var $nm_aluno;
  81 + var $array_modulos = array();
  82 + var $nm_curso;
  83 + var $get_link = FALSE;
  84 + var $total;
  85 +
  86 + var $ref_cod_modulo;
  87 +
  88 + var $meses_do_ano = array(
  89 + '1' => 'JANEIRO',
  90 + '2' => 'FEVEREIRO',
  91 + '3' => 'MAR&Ccedil;O',
  92 + '4' => 'ABRIL',
  93 + '5' => 'MAIO',
  94 + '6' => 'JUNHO',
  95 + '7' => 'JULHO',
  96 + '8' => 'AGOSTO',
  97 + '9' => 'SETEMBRO',
  98 + '10' => 'OUTUBRO',
  99 + '11' => 'NOVEMBRO',
  100 + '12' => 'DEZEMBRO'
  101 + );
  102 +
  103 + function Inicializar()
  104 + {
  105 + $retorno = 'Novo';
  106 +
  107 + session_start();
  108 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  109 + session_write_close();
  110 +
  111 + $obj_permissoes = new clsPermissoes();
  112 +
  113 + return $retorno;
  114 + }
  115 +
  116 + function Gerar()
  117 + {
  118 + $obj_permissoes = new clsPermissoes();
  119 + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
  120 +
  121 + if($_POST){
  122 + foreach ($_POST as $key => $value) {
  123 + $this->$key = $value;
  124 + }
  125 + }
  126 +
  127 + $this->ano = $ano_atual = date('Y');
  128 + $this->mes = $mes_atual = date('n');
  129 +
  130 + $this->campoNumero('ano', 'Ano', $this->ano, 4, 4, TRUE);
  131 +
  132 + $get_escola = TRUE;
  133 + $exibe_nm_escola = TRUE;
  134 + $get_curso = TRUE;
  135 + $get_escola_curso_serie = TRUE;
  136 + $escola_obrigatorio = FALSE;
  137 + $curso_obrigatorio = TRUE;
  138 + $instituicao_obrigatorio = TRUE;
  139 +
  140 + include 'include/pmieducar/educar_campo_lista.php';
  141 +
  142 + $this->campoLista('ref_cod_turma', 'Turma', array('' => 'Selecione'), '');
  143 +
  144 + if ($this->ref_cod_escola) {
  145 + $this->ref_ref_cod_escola = $this->ref_cod_escola;
  146 + }
  147 +
  148 + $this->url_cancelar = 'educar_index.php';
  149 + $this->nome_url_cancelar = 'Cancelar';
  150 +
  151 + $this->acao_enviar = 'acao2()';
  152 + $this->acao_executa_submit = FALSE;
  153 + }
169 154 }
170 155  
171   -// cria uma extensao da classe base
  156 +// Instancia objeto de página
172 157 $pagina = new clsIndexBase();
173   -// cria o conteudo
  158 +
  159 +// Instancia objeto de conteúdo
174 160 $miolo = new indice();
175   -// adiciona o conteudo na clsBase
176   -$pagina->addForm( $miolo );
177   -// gera o html
178   -$pagina->MakeAll();
179 161  
  162 +// Atribui o conteúdo à página
  163 +$pagina->addForm($miolo);
180 164  
  165 +// Gera o código HTML
  166 +$pagina->MakeAll();
181 167 ?>
182   -<script>
183   -
184   -
  168 +<script type="text/javascript">
185 169 document.getElementById('ref_cod_escola').onchange = function()
186 170 {
187   - getEscolaCurso();
188   - var campoTurma = document.getElementById( 'ref_cod_turma' );
189   - getTurmaCurso();
  171 + getEscolaCurso();
  172 + var campoTurma = document.getElementById('ref_cod_turma');
  173 + getTurmaCurso();
190 174 }
191 175  
192 176 document.getElementById('ref_cod_curso').onchange = function()
193 177 {
194   - getEscolaCursoSerie();
195   - getTurmaCurso();
196   -// verifica_curso();
  178 + getEscolaCursoSerie();
  179 + getTurmaCurso();
197 180 }
198 181  
199 182 document.getElementById('ref_ref_cod_serie').onchange = function()
200 183 {
  184 + var campoEscola = document.getElementById('ref_cod_escola').value;
  185 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
201 186  
202   - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;
203   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
  187 + var xml1 = new ajax(getTurma_XML);
  188 + strURL = 'educar_turma_xml.php?esc=' + campoEscola + '&ser=' + campoSerie;
204 189  
205   - var xml1 = new ajax(getTurma_XML);
206   - strURL = "educar_turma_xml.php?esc="+campoEscola+"&ser="+campoSerie;
207   - xml1.envia(strURL);
  190 + xml1.envia(strURL);
208 191 }
209 192  
210 193 function getTurma_XML(xml)
211 194 {
  195 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
  196 + var campoTurma = document.getElementById('ref_cod_turma');
  197 + var turma = xml.getElementsByTagName('turma');
212 198  
  199 + campoTurma.length = 1;
  200 + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false);
213 201  
214   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
215   -
216   - var campoTurma = document.getElementById( 'ref_cod_turma' );
217   -
218   - var turma = xml.getElementsByTagName( "turma" );
219   -
220   - campoTurma.length = 1;
221   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
222   - for ( var j = 0; j < turma.length; j++ )
223   - {
224   -
225   - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );
226   -
227   - }
228   - if ( campoTurma.length == 1 && campoSerie != '' ) {
229   - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false );
230   - }
  202 + for (var j = 0; j < turma.length; j++) {
  203 + campoTurma.options[campoTurma.options.length] = new Option(
  204 + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false);
  205 + }
231 206  
  207 + if (campoTurma.length == 1 && campoSerie != '') {
  208 + campoTurma.options[0] = new Option('A série não possui nenhuma turma', '', false, false);
  209 + }
232 210 }
233 211  
234 212 function getTurmaCurso()
235 213 {
236   - var campoCurso = document.getElementById('ref_cod_curso').value;
237   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
  214 + var campoCurso = document.getElementById('ref_cod_curso').value;
  215 + var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
238 216  
239   - var xml1 = new ajax(getTurmaCurso_XML);
240   - strURL = "educar_turma_xml.php?ins="+campoInstituicao+"&cur="+campoCurso;
  217 + var xml1 = new ajax(getTurmaCurso_XML);
  218 + strURL = 'educar_turma_xml.php?ins=' + campoInstituicao + '&cur=' + campoCurso;
241 219  
242   - xml1.envia(strURL);
  220 + xml1.envia(strURL);
243 221 }
244 222  
245 223 function getTurmaCurso_XML(xml)
246 224 {
247   - var turma = xml.getElementsByTagName( "turma" );
248   - var campoTurma = document.getElementById( 'ref_cod_turma' );
249   - var campoCurso = document.getElementById('ref_cod_curso');
250   -
251   - campoTurma.length = 1;
252   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
253   -
254   - for ( var j = 0; j < turma.length; j++ )
255   - {
  225 + var turma = xml.getElementsByTagName('turma');
  226 + var campoTurma = document.getElementById('ref_cod_turma');
  227 + var campoCurso = document.getElementById('ref_cod_curso');
256 228  
257   - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );
  229 + campoTurma.length = 1;
  230 + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false);
258 231  
259   - }
  232 + for (var j = 0; j < turma.length; j++) {
  233 + campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );
  234 + }
260 235  
261 236 }
262 237  
263 238 function acao2()
264 239 {
265   -// if ($F('is_padrao') == 0)
266   -// {
267   -// if (!$F('sem1') && !$F('sem2'))
268   -// {
269   -// alert("O campo 'Semestre' deve ser preenchido corretamente!");
270   -// document.getElementById('sem1').focus();
271   -// return;
272   -// }
273   -// }
274   - if(!acao())
275   - return;
276   -
277   - showExpansivelImprimir(400, 200,'',[], "Ata Resultado Final");
278   -
279   - document.formcadastro.target = 'miolo_'+(DOM_divs.length-1);
280   -
281   - document.getElementById( 'btn_enviar' ).disabled =false;
282   -
283   - document.formcadastro.submit();
284   -
  240 + if(! acao()) {
  241 + return;
  242 + }
  243 +
  244 + showExpansivelImprimir(400, 200, '',[], 'Ata Resultado Final');
  245 + document.formcadastro.target = 'miolo_' + (DOM_divs.length - 1);
  246 + document.getElementById('btn_enviar').disabled = false;
  247 + document.formcadastro.submit();
285 248 }
286 249  
287 250 document.formcadastro.action = 'educar_relatorio_ata_resultado_final_proc.php';
288   -
289 251 </script>
290 252 \ No newline at end of file
... ...
ieducar/intranet/educar_relatorio_ata_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,15 +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   - * Ata de resultado final.
26 22 *
27 23 * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
28 24 * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL
29 25 * @package Core
30   - * @subpackage Relatório
  26 + * @subpackage pmieducar
  27 + * @subpackage NotaFalta
  28 + * @subpackage Relatorio
31 29 * @since Arquivo disponível desde a versão 1.0.0
32 30 * @version $Id$
33 31 */
... ... @@ -40,554 +38,636 @@ require_once &#39;include/clsPDF.inc.php&#39;;
40 38  
41 39 class clsIndexBase extends clsBase
42 40 {
43   - function Formular()
44   - {
45   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Registro de Matr&iacute;culas" );
46   - $this->processoAp = "693";
47   - $this->renderMenu = false;
48   - $this->renderMenuSuspenso = false;
49   - }
  41 + function Formular()
  42 + {
  43 + $this->SetTitulo($this->_instituicao . ' i-Educar - Registro de Matr&iacute;culas');
  44 + $this->processoAp = '693';
  45 + $this->renderMenu = FALSE;
  46 + $this->renderMenuSuspenso = FALSE;
  47 + }
50 48 }
51 49  
52 50 class indice extends clsCadastro
53 51 {
  52 + /**
  53 + * Referência a usuário da sessão.
  54 + * @var int
  55 + */
  56 + var $pessoa_logada;
  57 +
  58 + var $ref_cod_instituicao;
  59 + var $ref_cod_escola;
  60 + var $ref_cod_serie;
  61 + var $ref_ref_cod_serie;
  62 + var $ref_cod_curso;
  63 + var $ref_cod_turma;
  64 +
  65 + var $disciplinas = array();
  66 +
  67 + var $ano;
  68 + var $nm_escola;
  69 + var $nm_instituicao;
  70 + var $nm_curso;
  71 + var $nm_serie;
  72 + var $nm_turma;
  73 + var $nm_turno;
  74 +
  75 + var $pdf;
  76 + var $page_y = 139;
  77 + var $get_link;
  78 + var $campo_assinatura;
  79 + var $total = 0;
  80 +
  81 + var $meses_do_ano = array(
  82 + '1' => 'JANEIRO',
  83 + '2' => 'FEVEREIRO',
  84 + '3' => 'MARÇO',
  85 + '4' => 'ABRIL',
  86 + '5' => 'MAIO',
  87 + '6' => 'JUNHO',
  88 + '7' => 'JULHO',
  89 + '8' => 'AGOSTO',
  90 + '9' => 'SETEMBRO',
  91 + '10' => 'OUTUBRO',
  92 + '11' => 'NOVEMBRO',
  93 + '12' => 'DEZEMBRO'
  94 + );
  95 +
  96 + var $array_modulos = array();
  97 + var $dias_letivos;
  98 + var $falta_ch_globalizada;
  99 +
  100 + var $is_padrao;
  101 + var $semestre;
  102 +
  103 + function renderHTML()
  104 + {
  105 + session_start();
  106 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  107 + session_write_close();
  108 +
  109 + foreach ($_POST as $key => $value) {
  110 + $this->$key = $value;
  111 + }
  112 +
  113 + $this->ref_cod_serie = $this->ref_ref_cod_serie;
  114 +
  115 + $fonte = 'arial';
  116 + $corTexto = '#000000';
  117 +
  118 + if (is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola) &&
  119 + is_numeric($this->ref_cod_curso) && is_numeric($this->ref_cod_serie) &&
  120 + is_numeric($this->ref_cod_turma) && is_numeric($this->ano))
  121 + {
  122 + $sql = "
  123 + SELECT
  124 + cod_matricula,
  125 + aprovado,
  126 + ref_ref_cod_serie,
  127 + (SELECT
  128 + nome
  129 + FROM
  130 + pmieducar.aluno a,
  131 + cadastro.pessoa p
  132 + WHERE
  133 + a.cod_aluno = m.ref_cod_aluno
  134 + AND p.idpes = a.ref_idpes
  135 + ) as nome
  136 + FROM
  137 + pmieducar.matricula m,
  138 + pmieducar.matricula_turma mt
  139 + WHERE
  140 + mt.ref_cod_turma = {$this->ref_cod_turma}
  141 + AND mt.ref_cod_matricula = m.cod_matricula
  142 + AND m.ativo = 1
  143 + AND mt.ativo = 1
  144 + AND aprovado IN (1, 2)
  145 + AND ano = {$this->ano}
  146 + ORDER BY
  147 + ref_ref_cod_serie, nome";
  148 +
  149 + //verificar se a turma é multiseriada
  150 + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
  151 + $det_turma = $obj_turma->detalhe();
  152 + $ref_ref_cod_serie_mult = $det_turma['ref_ref_cod_serie_mult'];
  153 +
  154 + $db = new clsBanco();
  155 + $db->Consulta($sql);
  156 +
  157 + if ($db->numLinhas()) {
  158 + $numAlunos = $db->numLinhas();
  159 +
  160 + $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao);
  161 + $det_instituicao = $obj_instituicao->detalhe();
  162 + $this->nm_instituicao = $det_instituicao['nm_instituicao'];
  163 +
  164 + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
  165 + $det_escola = $obj_escola->detalhe();
  166 + $this->nm_escola = $det_escola['nome'];
  167 +
  168 + $obj_escola_serie_disciplina = new clsPmieducarEscolaSerieDisciplina();
  169 + $obj_escola_serie_disciplina->setCamposLista('ref_cod_disciplina');
  170 + $lst_escola_serie_disciplina = $obj_escola_serie_disciplina->lista(
  171 + $this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);
  172 +
  173 + foreach ($lst_escola_serie_disciplina as $escola_serie_disciplina) {
  174 + $obj_disciplina = new clsPmieducarDisciplina($escola_serie_disciplina);
  175 + $obj_disciplina->setCamposLista('cod_disciplina, carga_horaria, nm_disciplina, abreviatura');
  176 + $det_disciplina = $obj_disciplina->detalhe();
  177 +
  178 + $this->disciplinas[$det_disciplina['cod_disciplina']]['nm_disciplina'] = $det_disciplina['nm_disciplina'];
  179 + $this->disciplinas[$det_disciplina['cod_disciplina']]['abreviatura'] = $det_disciplina['abreviatura'];
  180 + $this->disciplinas[$det_disciplina['cod_disciplina']]['carga_horaria'] = $det_disciplina['carga_horaria'];
  181 + }
  182 +
  183 + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
  184 + $det_curso = $obj_curso->detalhe();
  185 +
  186 + $this->nm_curso = $det_curso['nm_curso'];
  187 + $this->falta_ch_globalizada = $det_curso['falta_ch_globalizada'];
  188 +
  189 + $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
  190 + $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
  191 + $curso_conceitual = $det_tipo_avaliacao['conceitual'];
  192 +
  193 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  194 + $obj_serie->setOrderby('nm_serie');
  195 + $det_serie = $obj_serie->detalhe();
  196 + $this->nm_serie = $det_serie['nm_serie'];
  197 +
  198 + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
  199 + $obj_turma->setCamposLista('nm_turma, hora_inicial');
  200 + $det_turma = $obj_turma->detalhe();
  201 +
  202 + if ($det_turma['hora_inicial'] < '12:00') {
  203 + $this->nm_turno = 'Matutino';
  204 + }
  205 + elseif ($det_turma['hora_inicial'] < '18:00') {
  206 + $this->nm_turno = 'Vespertino';
  207 + }
  208 + else {
  209 + $this->nm_turno = 'Noturno';
  210 + }
  211 +
  212 + $this->nm_turma = $det_turma["nm_turma"];
  213 + $this->buscaDiasLetivos();
  214 +
  215 + asort($this->disciplinas);
  216 +
  217 + $this->pdf = new clsPDF('Ata de Resultado Final - ' . $this->ano,
  218 + 'Ata de Resultado Final', 'A4', '', FALSE, FALSE);
  219 +
  220 + $this->pdf->largura = 842.0;
  221 + $this->pdf->altura = 595.0;
  222 +
  223 + $this->pdf->OpenFile();
  224 + $this->addCabecalho();
  225 +
  226 + $esquerda = 3;
  227 + $altura = 30;
  228 + $direita = 834;
  229 + $tam_texto = 10;
  230 + $altura = 130;
  231 +
  232 + if ($det_curso['padrao_ano_escolar'] == 1) {
  233 + $this->array_modulos = array(
  234 + array('nm_tipo' => 'Bimestre'),
  235 + array('nm_tipo' => 'Bimestre'),
  236 + array('nm_tipo' => 'Bimestre'),
  237 + array('nm_tipo' => 'Bimestre')
  238 + );
  239 + }
  240 + else {
  241 + $obj_turma_modulo = new clsPmieducarTurmaModulo();
  242 + $lst_turma_modulo = $obj_turma_modulo->lista($this->ref_cod_turma);
  243 +
  244 + foreach ($lst_turma_modulo as $modulo) {
  245 + $obj_modulo = new clsPmieducarModulo($modulo);
  246 + $det_modulo = $obj_modulo->detalhe();
  247 + $this->array_modulos[] = $det_modulo;
  248 + }
  249 + }
  250 +
  251 + $altura += 50;
  252 + $espessura_linha = 0.3;
  253 +
  254 + $alunos_matriculados = array();
  255 + while ($db->ProximoRegistro()) {
  256 + list($cod_matricula, $aprovado, $ref_cod_serie, $nome) = $db->Tupla();
  257 + $alunos_matriculados[$cod_matricula] =
  258 + array(
  259 + 'aprovado' => $aprovado,
  260 + 'nome' => $nome,
  261 + 'ref_cod_serie' => $ref_cod_serie
  262 + );
  263 + }
  264 +
  265 + if (is_array($alunos_matriculados) && count($alunos_matriculados)) {
  266 + if ($this->falta_ch_globalizada) {
  267 + $this->montaAlunoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual);
  268 + } else {
  269 + $this->montaAlunoNaoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual);
  270 + }
  271 + }
  272 +
  273 + $this->rodape();
  274 +
  275 + $this->pdf->CloseFile();
  276 + $this->get_link = $this->pdf->GetLink();
  277 +
  278 + echo "
  279 + <script>
  280 + window.onload=function() {
  281 + parent.EscondeDiv('LoadImprimir');
  282 + window.location='download.php?filename=".$this->get_link."'
  283 + }
  284 + </script>";
  285 +
  286 + echo "
  287 + <html>
  288 + <center>
  289 + 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>
  290 + <span style='font-size: 10px;'>
  291 + Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
  292 + Clique na Imagem para Baixar o instalador<br><br>
  293 + <a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br>
  294 + <img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\">
  295 + </a>
  296 + </span>
  297 + </center>";
  298 + }
  299 + else {
  300 + echo '
  301 + <script>
  302 + alert("A turma não possui nenhum aluno com situação final definida");
  303 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length - 1));
  304 + </script>';
  305 +
  306 + return TRUE;
  307 + }
  308 + }
  309 + else
  310 + {
  311 + echo '
  312 + <script>
  313 + alert("A turma não possui nenhum aluno com situação final definida");
  314 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  315 + </script>';
  316 +
  317 + return TRUE;
  318 + }
  319 + }
  320 +
  321 + function rodape()
  322 + {
  323 + $texto = '';
  324 + $esquerda = 3;
  325 + $altura = 22;
  326 + $direita = 834;
  327 + $tam_texto = 10;
  328 + $this->pdf->escreve_relativo('Legenda', $esquerda + 2, $this->page_y += 30,
  329 + 150, 100, $fonte, $tam_texto);
  330 +
  331 + if (count($this->disciplinas) > 10) {
  332 + $legenda_por_linha = true;
  333 + } else {
  334 + $legenda_por_linha = false;
  335 + }
  336 +
  337 + foreach ($this->disciplinas as $disciplina) {
  338 + $texto .= $disciplina['abreviatura'] . ':' . $disciplina['nm_disciplina'] . ' ';
  339 +
  340 + if ($legenda_por_linha) {
  341 + $this->pdf->escreve_relativo($texto, $esquerda + 2, $this->page_y += $altura,
  342 + $direita, 200, $fonte, $tam_texto + 1);
  343 +
  344 + $texto = "";
  345 +
  346 + if ($this->page_y > $this->pdf->altura - 50) {
  347 + $texto = '';
  348 + $esquerda = 3;
  349 + $altura = 18;
  350 + $direita = 834;
  351 + $tam_texto = 10;
  352 + $this->pdf->ClosePage();
  353 + $this->pdf->OpenPage();
  354 + $this->addCabecalho();
  355 + }
  356 + }
  357 + }
  358 +
  359 + if (! $legenda_por_linha) {
  360 + $this->pdf->escreve_relativo($texto, $esquerda + 2, $this->page_y += $altura,
  361 + $direita, 200, $fonte, $tam_texto + 1);
  362 + }
  363 +
  364 + if ($this->page_y + $altura * 2 > $this->pdf->altura - 50) {
  365 + $texto = '';
  366 + $esquerda = 3;
  367 + $altura = 18;
  368 + $direita = 834;
  369 + $tam_texto = 10;
  370 + $this->pdf->ClosePage();
  371 + $this->pdf->OpenPage();
  372 + $this->addCabecalho();
  373 + }
  374 +
  375 + $this->pdf->quadrado_relativo($esquerda, $this->page_y += $altura * 2, $direita, 60);
  376 +
  377 + $this->pdf->escreve_relativo('Observações:', $esquerda + 1, $this->page_y + 1, 150, 200, $fonte, $tam_texto);
  378 +
  379 + $this->pdf->linha_relativa($esquerda + 200, $this->page_y += 120, 150, 0);
54 380  
  381 + $this->pdf->escreve_relativo('Assinatura do(a) Secretário(a)', $esquerda + 220,
  382 + $this->page_y + 2, 150, 200, $fonte, 7);
55 383  
56   - /**
57   - * Referencia pega da session para o idpes do usuario atual
58   - *
59   - * @var int
60   - */
61   - var $pessoa_logada;
62   -
63   -
64   - var $ref_cod_instituicao;
65   - var $ref_cod_escola;
66   - var $ref_cod_serie;
67   - var $ref_ref_cod_serie;
68   - var $ref_cod_curso;
69   - var $ref_cod_turma;
70   -
71   - var $disciplinas = array();
72   -
73   - var $ano;
74   -
75   - var $nm_escola;
76   - var $nm_instituicao;
77   - var $nm_curso;
78   - var $nm_serie;
79   - var $nm_turma;
80   - var $nm_turno;
81   -
82   - var $pdf;
83   -
84   - var $page_y = 139;
85   -
86   - var $get_link;
87   -
88   - var $campo_assinatura;
89   -
90   - var $total = 0;
91   -
92   - var $meses_do_ano = array(
93   - "1" => "JANEIRO"
94   - ,"2" => "FEVEREIRO"
95   - ,"3" => "MARÇO"
96   - ,"4" => "ABRIL"
97   - ,"5" => "MAIO"
98   - ,"6" => "JUNHO"
99   - ,"7" => "JULHO"
100   - ,"8" => "AGOSTO"
101   - ,"9" => "SETEMBRO"
102   - ,"10" => "OUTUBRO"
103   - ,"11" => "NOVEMBRO"
104   - ,"12" => "DEZEMBRO"
105   - );
106   -
107   - var $array_modulos = array();
108   - var $dias_letivos;
109   - var $falta_ch_globalizada;
110   -
111   - var $is_padrao;
112   - var $semestre;
113   -
114   - function renderHTML()
115   - {
116   -
117   - @session_start();
118   - $this->pessoa_logada = $_SESSION['id_pessoa'];
119   - @session_write_close();
120   -
121   - foreach ($_POST as $key => $value) {
122   - $this->$key = $value;
123   - }
124   - $this->ref_cod_serie = $this->ref_ref_cod_serie;
125   -
126   - $fonte = 'arial';
127   - $corTexto = '#000000';
128   -
129   - if (is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola) && is_numeric($this->ref_cod_curso) && is_numeric($this->ref_cod_serie) && is_numeric($this->ref_cod_turma) && is_numeric($this->ano))
130   - {
131   - $sql = "SELECT
132   - cod_matricula,
133   - aprovado,
134   - ref_ref_cod_serie,
135   - (SELECT
136   - nome
137   - FROM
138   - pmieducar.aluno a,
139   - cadastro.pessoa p
140   - WHERE
141   - a.cod_aluno = m.ref_cod_aluno
142   - AND p.idpes = a.ref_idpes
143   - ) as nome
144   - FROM
145   - pmieducar.matricula m,
146   - pmieducar.matricula_turma mt
147   - WHERE
148   - mt.ref_cod_turma = {$this->ref_cod_turma}
149   - AND mt.ref_cod_matricula = m.cod_matricula
150   - AND m.ativo = 1
151   - AND mt.ativo = 1
152   - AND aprovado IN (1, 2)
153   - AND ano = {$this->ano}
154   - ORDER BY
155   - ref_ref_cod_serie, nome";
156   - //verificar se a turma é multiseriada
157   - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
158   - $det_turma = $obj_turma->detalhe();
159   - $ref_ref_cod_serie_mult = $det_turma["ref_ref_cod_serie_mult"];
160   -
161   - /*$db2 = new clsBanco();
162   - $alunos_multiseriados = array();
163   -
164   - if (is_numeric($ref_ref_cod_serie_mult))
165   - {
166   - $sql2 = "SELECT
167   - cod_matricula,
168   - aprovado,
169   - (SELECT
170   - nome
171   - FROM
172   - pmieducar.aluno a,
173   - cadastro.pessoa p
174   - WHERE
175   - a.cod_aluno = m.ref_cod_aluno
176   - AND p.idpes = a.ref_idpes ) as nome
177   - FROM
178   - pmieducar.matricula m
179   - WHERE
180   - m.ref_ref_cod_serie = {$ref_ref_cod_serie_mult}
181   - AND m.ref_ref_cod_escola = {$this->ref_cod_escola}
182   - AND m.ativo = 1
183   - AND aprovado IN (1, 2)
184   - AND ano = 2007
185   - ORDER BY
186   - nome";
187   - $db2->Consulta($sql2);
188   - if ($db2->Num_Linhas())
189   - {
190   - while ($db2->ProximoRegistro()) {
191   - list($cod_matricula, $aprovado, $nome) = $db2->Tupla();
192   - $alunos_multiseriados[$cod_matricula] = array("aprovado" => $aprovado, "nome" => $nome);
193   - }
194   - }
195   - }*/
196   -
197   - $db = new clsBanco();
198   - $db->Consulta($sql);
199   - if ($db->numLinhas())
200   - {
201   - $numAlunos = $db->numLinhas();
202   - $obj_instituicao = new clsPmieducarInstituicao($this->ref_cod_instituicao);
203   - $det_instituicao = $obj_instituicao->detalhe();
204   - $this->nm_instituicao = $det_instituicao["nm_instituicao"];
205   -
206   - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
207   - $det_escola = $obj_escola->detalhe();
208   - $this->nm_escola = $det_escola['nome'];
209   -
210   -
211   - $obj_escola_serie_disciplina = new clsPmieducarEscolaSerieDisciplina();
212   - $obj_escola_serie_disciplina->setCamposLista("ref_cod_disciplina");
213   - $lst_escola_serie_disciplina = $obj_escola_serie_disciplina->lista($this->ref_cod_serie, $this->ref_cod_escola, null, 1);
214   - foreach ($lst_escola_serie_disciplina as $escola_serie_disciplina)
215   - {
216   - $obj_disciplina = new clsPmieducarDisciplina($escola_serie_disciplina);
217   - $obj_disciplina->setCamposLista("cod_disciplina, carga_horaria, nm_disciplina, abreviatura");
218   - $det_disciplina = $obj_disciplina->detalhe();
219   - $this->disciplinas[$det_disciplina["cod_disciplina"]]["nm_disciplina"] = $det_disciplina["nm_disciplina"];
220   - $this->disciplinas[$det_disciplina["cod_disciplina"]]["abreviatura"] = $det_disciplina["abreviatura"];
221   - $this->disciplinas[$det_disciplina["cod_disciplina"]]["carga_horaria"] = $det_disciplina["carga_horaria"];
222   - }
223   - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
224   - $det_curso = $obj_curso->detalhe();
225   - $this->nm_curso = $det_curso["nm_curso"];
226   - $this->falta_ch_globalizada = $det_curso["falta_ch_globalizada"];
227   -
228   - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
229   - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
230   - $curso_conceitual = $det_tipo_avaliacao['conceitual'];
231   -
232   - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
233   - $obj_serie->setOrderby("nm_serie");
234   - $det_serie = $obj_serie->detalhe();
235   - $this->nm_serie = $det_serie["nm_serie"];
236   -
237   - /*if (is_numeric($ref_ref_cod_serie_mult))
238   - {
239   - $obj_serie2 = new clsPmieducarSerie($ref_ref_cod_serie_mult);
240   - $obj_serie2->setOrderby("nm_serie");
241   - $det_serie2 = $obj_serie2->detalhe();
242   - $this->nm_serie .= " / ".$det_serie2["nm_serie"];
243   - }*/
244   -
245   - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
246   - $obj_turma->setCamposLista("nm_turma, hora_inicial");
247   - $det_turma = $obj_turma->detalhe();
248   - if ($det_turma["hora_inicial"] < "12:00")
249   - $this->nm_turno = "Matutino";
250   - elseif ($det_turma["hora_inicial"] < "18:00")
251   - $this->nm_turno = "Vespertino";
252   - else
253   - $this->nm_turno = "Noturno";
254   - $this->nm_turma = $det_turma["nm_turma"];
255   - $this->buscaDiasLetivos();
256   -
257   - asort($this->disciplinas);
258   -
259   - $this->pdf = new clsPDF("Ata de Resultado Final - {$this->ano}", "Ata de Resultado Final", "A4", "", false, false);
260   - $this->pdf->largura = 842.0;
261   - $this->pdf->altura = 595.0;
262   - $this->pdf->OpenFile();
263   - $this->addCabecalho();
264   -
265   - $esquerda = 3;
266   - $altura = 30;
267   - $direita = 834;
268   - $tam_texto = 10;
269   - $altura = 130;
270   -
271   - if ($det_curso["padrao_ano_escolar"] == 1)
272   - {
273   - $this->array_modulos = array(array('nm_tipo' => 'Bimestre'),array('nm_tipo' => 'Bimestre'),array('nm_tipo' => 'Bimestre'),array('nm_tipo' => 'Bimestre'));
274   - }
275   - else
276   - {
277   - $obj_turma_modulo = new clsPmieducarTurmaModulo();
278   - $lst_turma_modulo = $obj_turma_modulo->lista($this->ref_cod_turma);
279   - foreach ($lst_turma_modulo as $modulo)
280   - {
281   - $obj_modulo = new clsPmieducarModulo($modulo);
282   - $det_modulo = $obj_modulo->detalhe();
283   - $this->array_modulos[] = $det_modulo;
284   - }
285   - }
286   -
287   - $altura += 50;
288   - $espessura_linha = 0.3;
289   -
290   - $alunos_matriculados = array();
291   - while ($db->ProximoRegistro()) {
292   - list($cod_matricula, $aprovado, $ref_cod_serie, $nome) = $db->Tupla();
293   - $alunos_matriculados[$cod_matricula] = array("aprovado" => $aprovado, "nome" => $nome, "ref_cod_serie" => $ref_cod_serie);
294   - }
295   - /*if (is_array($alunos_multiseriados))
296   - {
297   - foreach ($alunos_multiseriados as $cod_matricula => $dados) {
298   - $alunos_matriculados[$cod_matricula] = array("aprovado" => $dados["aprovado"], "nome" => $dados["nome"]);
299   - }
300   - }*/
301   - if (is_array($alunos_matriculados) && count($alunos_matriculados)) {
302   - if ($this->falta_ch_globalizada) {
303   - $this->montaAlunoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual);
304   - } else {
305   - $this->montaAlunoNaoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual);
306   - }
307   - }
308   -
309   - $this->rodape();
310   -
311   - $this->pdf->CloseFile();
312   - $this->get_link = $this->pdf->GetLink();
313   -
314   - echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>";
315   -
316   - 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>
317   - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
318   -
319   - Clique na Imagem para Baixar o instalador<br><br>
320   - <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>
321   - </span>
322   - </center>";
323   - }
324   - else
325   - {
326   - echo '<script>
327   - alert("A turma não possui nenhum aluno com situação final definida");
328   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
329   - </script>';
330   - return true;
331   - }
332   - }
333   - else
334   - {
335   - echo '<script>
336   - alert("A turma não possui nenhum aluno com situação final definida");
337   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
338   - </script>';
339   - return true;
340   - }
341   - }
342   -
343   - function rodape() {
344   -// $controle = 0;
345   - $texto = "";
346   - $esquerda = 3;
347   - $altura = 22;
348   - $direita = 834;
349   - $tam_texto = 10;
350   - $this->pdf->escreve_relativo("Legenda", $esquerda + 2, $this->page_y += 30, 150, 100, $fonte, $tam_texto);
351   - if (count($this->disciplinas) > 10) {
352   - $legenda_por_linha = true;
353   - } else {
354   - $legenda_por_linha = false;
355   - }
356   - foreach ($this->disciplinas as $disciplina) {
357   -// $controle++;
358   - $texto .= "{$disciplina["abreviatura"]}:{$disciplina["nm_disciplina"]} ";
359   - if ($legenda_por_linha) {
360   - $this->pdf->escreve_relativo($texto, $esquerda + 2, $this->page_y += $altura, $direita, 200, $fonte, $tam_texto+1);
361   - $texto = "";
362   - if ($this->page_y > $this->pdf->altura - 50) // || $this->page_y + 50 > $this->pdf->altura - 120)
363   - {
364   - $texto = "";
365   - $esquerda = 3;
366   - $altura = 18;
367   - $direita = 834;
368   - $tam_texto = 10;
369   - $this->pdf->ClosePage();
370   - $this->pdf->OpenPage();
371   - $this->addCabecalho();
372   - }
373   - }
374   - }
375   - if (!$legenda_por_linha) {
376   - $this->pdf->escreve_relativo($texto, $esquerda + 2, $this->page_y += $altura, $direita, 200, $fonte, $tam_texto+1);
377   - }
378   - if ($this->page_y + $altura * 2 > $this->pdf->altura - 50) {
379   - $texto = "";
380   - $esquerda = 3;
381   - $altura = 18;
382   - $direita = 834;
383   - $tam_texto = 10;
384   - $this->pdf->ClosePage();
385   - $this->pdf->OpenPage();
386   - $this->addCabecalho();
387   - }
388   - $this->pdf->quadrado_relativo($esquerda, $this->page_y += $altura*2, $direita, 60);//, $espessura_linha);
389   - $this->pdf->escreve_relativo("Observações:", $esquerda + 1, $this->page_y + 1, 150, 200, $fonte, $tam_texto);
390   - $this->pdf->linha_relativa($esquerda + 200, $this->page_y += 120, 150, 0);//, $espessura_linha);
391   - $this->pdf->escreve_relativo("Assinatura do(a) Secretário(a)", $esquerda + 220, $this->page_y + 2, 150, 200, $fonte, 7);
392   - $this->pdf->linha_relativa($esquerda + 450, $this->page_y, 150, 0);//, $espessura_linha);
393   - $this->pdf->escreve_relativo("Assinatura do(a) Diretor(a)", $esquerda + 480, $this->page_y + 2, 150, 200, $fonte, 7);
394   - }
395   -
396   - //monta alunos que a serie nao tem falta globalizada
397   - function montaAlunoNaoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual) {
398   - $fonte = 'arial';
399   - $corTexto = '#000000';
400   - /*$esquerda = */$esquerda_original = 3;
401   - $espessura_linha = 0.3;
402   - $tam_texto = 9;
403   - $direita = 834;
404   - $altura = 20;
405   - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
406   - $det_serie = $obj_serie->detalhe();
407   - foreach ($alunos_matriculados as $matricula => $aluno) {
408   -// break;
409   - $esquerda = $esquerda_original;
410   - $this->pdf->quadrado_relativo($esquerda, $this->page_y, $direita, $altura);
411   - $this->pdf->escreve_relativo($matricula, $esquerda, $this->page_y + 2, 45, 45, $fonte, $tam_texto, $corTexto, 'center');
412   - $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);//, $espessura_linha);
413   - $espaco_nome = 150;
414   - $this->pdf->escreve_relativo($aluno["nome"], $esquerda, $this->page_y + 2, $espaco_nome, 45, $fonte, $tam_texto, $corTexto, 'center');
415   - $this->pdf->linha_relativa($esquerda += $espaco_nome, $this->page_y, 0, $altura);//, $espessura_linha);
416   - $this->pdf->escreve_relativo($aluno["aprovado"] == 1 ? "Aprovado" : "Reprovado", $esquerda, $this->page_y + 4, 45, 45, $fonte, $tam_texto, $corTexto, 'center');
417   - $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);//, $espessura_linha);
418   - $espaco_disciplinas = ceil(($direita - $esquerda) / (count($this->disciplinas)));
419   - foreach ($this->disciplinas as $cod_disciplina => $disciplina) {
420   - $obj_dispensa_disciplina = new clsPmieducarDispensaDisciplina($matricula, $aluno["ref_cod_serie"], $this->ref_cod_escola, $cod_disciplina);
421   - if ($obj_dispensa_disciplina->detalhe())
422   - {
423   - $media = $faltas = "D";
424   - }
425   - else
426   - {
427   - $nota_exame = false;
428   - if ($curso_conceitual) {
429   - $obj_nota_aluno = new clsPmieducarNotaAluno();
430   - $obj_nota_aluno->setOrderby("modulo ASC");
431   -// $lst_nota_aluno = $obj_nota_aluno->lista(null, null, $det_curso["ref_cod_tipo_avaliacao"], $aluno["ref_cod_serie"], $this->ref_cod_escola,
432   - $lst_nota_aluno = $obj_nota_aluno->lista(null, null, null, $aluno["ref_cod_serie"], $this->ref_cod_escola,
433   - $cod_disciplina, $matricula, null, null, null, null, null, null, 1);
434   - if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
435   - foreach ($lst_nota_aluno as $key => $nota) {
436   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota["ref_ref_cod_tipo_avaliacao"], $nota["ref_sequencial"], null, null, null, null, 1);
437   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
438   - $media = $det_tipo_av_val["nome"];
439   - }
440   - }
441   - } else {
442   - if (dbBool($det_serie["ultima_nota_define"])) {
443   - $obj_nota_aluno = new clsPmieducarNotaAluno();
444   - $media = $obj_nota_aluno->getUltimaNotaModulo($matricula, $cod_disciplina, $aluno["ref_cod_serie"], count($this->array_modulos));
445   - } else {
446   -
447   - $obj_nota_aluno = new clsPmieducarNotaAluno();
448   - $obj_nota_aluno->setOrderby("modulo ASC");
449   -// $lst_nota_aluno = $obj_nota_aluno->lista(null, null, $det_curso["ref_cod_tipo_avaliacao"], $aluno["ref_cod_serie"], $this->ref_cod_escola,
450   - $lst_nota_aluno = $obj_nota_aluno->lista(null, null, null, $aluno["ref_cod_serie"], $this->ref_cod_escola,
451   - $cod_disciplina, $matricula, null, null, null, null, null, null, 1);
452   - $qtd_modulos = count($this->array_modulos);
453   - $notas = 0;
454   -
455   - if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
456   - foreach ($lst_nota_aluno as $key => $nota) {
457   - if ($key < $qtd_modulos) {
458   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota["ref_ref_cod_tipo_avaliacao"], $nota["ref_sequencial"], null, null, null, null);
459   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
460   - $notas += $det_tipo_av_val["valor"];
461   - } else {
462   - $notas += $nota["nota"] * 2;
463   - $nota_exame = true;
464   - }
465   - }
466   - }
467   -
468   - $media = $nota_exame ? $notas / (count($lst_nota_aluno) + 1) : $notas / count($lst_nota_aluno);
469   - $obj_media = new clsPmieducarTipoAvaliacaoValores();
470   - $det_media = $obj_media->lista($det_curso["ref_cod_tipo_avaliacao"], $det_curso["ref_sequencial"], null, null, $media, $media);
471   - if (is_array($det_media) && count($det_media)) {
472   - $det_media = array_shift($det_media);
473   - $media = $det_media["valor"];
474   - $media = str_replace(".", ",", sprintf("%01.1f", $media));
475   - }
476   - }
477   - }
478   - $obj_falta = new clsPmieducarFaltaAluno();
479   - $faltas = $obj_falta->total_faltas_disciplina($matricula, $cod_disciplina, $aluno["ref_cod_serie"]);
480   - }
481   - $this->pdf->escreve_relativo($media, $esquerda, $this->page_y + 4, $espaco_disciplinas / 2, 100, $fonte, $tam_texto + 1, $corTexto, 'center');
482   - $this->pdf->linha_relativa($esquerda + $espaco_disciplinas / 2, $this->page_y, 0, $altura);//, $espessura_linha);
483   - $this->pdf->escreve_relativo($faltas, $esquerda + $espaco_disciplinas / 2, $this->page_y + 4, $espaco_disciplinas / 2, 100, $fonte, $tam_texto + 1, $corTexto, 'center');
484   - $esquerda += $espaco_disciplinas;
485   - $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);//, $espessura_linha);
486   - }
487   - $this->page_y += $altura;
488   - if ($this->page_y > $this->pdf->altura - $altura * 2) {
489   - $this->pdf->ClosePage();
490   - $this->pdf->OpenPage();
491   - $this->addCabecalho();
492   - }
493   - }
494   - }
495   -
496   - //monta alunos que a serie tem falta globalizada
497   - function montaAlunoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual) {
498   - $fonte = 'arial';
499   - $corTexto = '#000000';
500   - /*$esquerda =*/ $esquerda_original = 3;
501   - $espessura_linha = 0.3;
502   - $tam_texto = 7;
503   - $direita = 834;
504   - $altura = 20;
505   - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
506   - $det_serie = $obj_serie->detalhe();
507   - foreach ($alunos_matriculados as $matricula => $aluno) {
508   -// break;
509   - $esquerda = $esquerda_original;
510   - $this->pdf->quadrado_relativo($esquerda, $this->page_y, $direita, $altura);
511   - $this->pdf->escreve_relativo($matricula, $esquerda, $this->page_y + 2, 45, 45, $fonte, $tam_texto, $corTexto, 'center');
512   - $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);//, $espessura_linha);
513   - $espaco_nome = 150;
514   - $this->pdf->escreve_relativo($aluno["nome"], $esquerda, $this->page_y + 2, $espaco_nome, 45, $fonte, $tam_texto, $corTexto, 'center');
515   - $this->pdf->linha_relativa($esquerda += $espaco_nome, $this->page_y, 0, $altura);//, $espessura_linha);
516   - $this->pdf->escreve_relativo($aluno["aprovado"] == 1 ? "Aprovado" : "Reprovado", $esquerda, $this->page_y + 4, 45, 45, $fonte, $tam_texto, $corTexto, 'center');
517   - $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);//, $espessura_linha);
518   - $espaco_disciplinas = ceil(($direita - $esquerda) / (count($this->disciplinas) + 1));
519   - foreach ($this->disciplinas as $cod_disciplina => $disciplina) {
520   - $obj_dispensa_disciplina = new clsPmieducarDispensaDisciplina($matricula, $aluno["ref_cod_serie"], $this->ref_cod_escola, $cod_disciplina);
521   - if ($obj_dispensa_disciplina->detalhe())
522   - {
523   - $media = $faltas = "D";
524   - }
525   - else
526   - {
527   - $nota_exame = false;
528   - if ($curso_conceitual) {
529   - $obj_nota_aluno = new clsPmieducarNotaAluno();
530   - $obj_nota_aluno->setOrderby("modulo ASC");
531   - $lst_nota_aluno = $obj_nota_aluno->lista(null, null, $det_curso["ref_cod_tipo_avaliacao"], $aluno["ref_cod_serie"], $this->ref_cod_escola,
532   - $cod_disciplina, $matricula, null, null, null, null, null, null, 1);
533   - if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
534   - foreach ($lst_nota_aluno as $key => $nota) {
535   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota["ref_ref_cod_tipo_avaliacao"], $nota["ref_sequencial"], null, null, null, null, 1);
536   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
537   - $media = $det_tipo_av_val["nome"];
538   - }
539   - }
540   - } else {
541   - if (dbBool($det_serie["ultima_nota_define"])) {
542   - $obj_nota_aluno = new clsPmieducarNotaAluno();
543   - $media = $obj_nota_aluno->getUltimaNotaModulo($matricula, $cod_disciplina, $aluno["ref_cod_serie"], count($this->array_modulos));
544   - } else {
545   - $obj_nota_aluno = new clsPmieducarNotaAluno();
546   - $obj_nota_aluno->setOrderby("modulo ASC");
547   - $lst_nota_aluno = $obj_nota_aluno->lista(null, null, $det_curso["ref_cod_tipo_avaliacao"], $aluno["ref_cod_serie"], $this->ref_cod_escola,
548   - $cod_disciplina, $matricula, null, null, null, null, null, null, 1);
549   - $qtd_modulos = count($this->array_modulos);
550   - $notas = 0;
551   - if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
552   - foreach ($lst_nota_aluno as $key => $nota) {
553   - if ($key < $qtd_modulos) {
554   - $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores($nota["ref_ref_cod_tipo_avaliacao"], $nota["ref_sequencial"], null, null, null, null);
555   - $det_tipo_av_val = $obj_tipo_av_val->detalhe();
556   - $notas += $det_tipo_av_val["valor"];
557   - } else {
558   - $notas += $nota["nota"] * 2;
559   - $nota_exame = true;
560   - }
561   - }
562   - }
563   - $media = $nota_exame ? $notas / (count($lst_nota_aluno) + 1) : $notas / count($lst_nota_aluno);
564   - $obj_media = new clsPmieducarTipoAvaliacaoValores();
565   - $det_media = $obj_media->lista($det_curso["ref_cod_tipo_avaliacao"], $det_curso["ref_sequencial"], null, null, $media, $media);
566   - if (is_array($det_media) && count($det_media)) {
567   - $det_media = array_shift($det_media);
568   - $media = $det_media["valor"];
569   - $media = str_replace(".", ",", sprintf("%01.1f", $media));
570   - }
571   - }
572   - }
573   - $this->pdf->escreve_relativo($media, $esquerda, $this->page_y + 4, $espaco_disciplinas, 50, $fonte, $tam_texto + 1, $corTexto, 'center');
574   - $esquerda += $espaco_disciplinas;
575   - $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);//, $espessura_linha);
576   - }
577   - $obj_falta = new clsPmieducarFaltas();
578   - $faltas = $obj_falta->somaFaltas($matricula);
579   - $this->pdf->escreve_relativo($faltas ? $faltas : "0", $esquerda, $this->page_y + 4, $espaco_disciplinas, 50, $fonte, $tam_texto + 1, $corTexto, 'center');
580   - $esquerda += $espaco_disciplinas;
581   - $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);//, $espessura_linha);
582   - }
583   - $this->page_y += $altura;
584   - if ($this->page_y > $this->pdf->altura - $altura * 2) {
585   - $this->pdf->ClosePage();
586   - $this->pdf->OpenPage();
587   - $this->addCabecalho();
588   - }
589   - }
590   - }
  384 + $this->pdf->linha_relativa($esquerda + 450, $this->page_y, 150, 0);
  385 +
  386 + $this->pdf->escreve_relativo('Assinatura do(a) Diretor(a)', $esquerda + 480,
  387 + $this->page_y + 2, 150, 200, $fonte, 7);
  388 + }
  389 +
  390 + //monta alunos que a serie nao tem falta globalizada
  391 + function montaAlunoNaoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual)
  392 + {
  393 + $fonte = 'arial';
  394 + $corTexto = '#000000';
  395 + $esquerda_original = 3;
  396 + $espessura_linha = 0.3;
  397 + $tam_texto = 9;
  398 + $direita = 834;
  399 + $altura = 20;
  400 +
  401 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  402 + $det_serie = $obj_serie->detalhe();
  403 +
  404 + foreach ($alunos_matriculados as $matricula => $aluno) {
  405 + $esquerda = $esquerda_original;
  406 +
  407 + $this->pdf->quadrado_relativo($esquerda, $this->page_y, $direita, $altura);
  408 +
  409 + $this->pdf->escreve_relativo($matricula, $esquerda, $this->page_y + 2, 45,
  410 + 45, $fonte, $tam_texto, $corTexto, 'center');
  411 +
  412 + $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);
  413 +
  414 + $espaco_nome = 150;
  415 +
  416 + $this->pdf->escreve_relativo($aluno['nome'], $esquerda, $this->page_y + 2,
  417 + $espaco_nome, 45, $fonte, $tam_texto, $corTexto, 'center');
  418 +
  419 + $this->pdf->linha_relativa($esquerda += $espaco_nome, $this->page_y, 0, $altura);
  420 +
  421 + $this->pdf->escreve_relativo($aluno['aprovado'] == 1 ? 'Aprovado' : 'Reprovado',
  422 + $esquerda, $this->page_y + 4, 45, 45, $fonte, $tam_texto, $corTexto, 'center');
  423 +
  424 + $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);
  425 +
  426 + $espaco_disciplinas = ceil(($direita - $esquerda) / (count($this->disciplinas)));
  427 +
  428 + foreach ($this->disciplinas as $cod_disciplina => $disciplina) {
  429 + $obj_dispensa_disciplina = new clsPmieducarDispensaDisciplina($matricula,
  430 + $aluno['ref_cod_serie'], $this->ref_cod_escola, $cod_disciplina);
  431 +
  432 + if ($obj_dispensa_disciplina->detalhe()) {
  433 + $media = $faltas = 'D';
  434 + }
  435 + else {
  436 + $nota_exame = FALSE;
  437 +
  438 + if ($curso_conceitual) {
  439 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  440 + $obj_nota_aluno->setOrderby('modulo ASC');
  441 + $lst_nota_aluno = $obj_nota_aluno->lista(NULL, NULL, NULL, $aluno['ref_cod_serie'], $this->ref_cod_escola,
  442 + $cod_disciplina, $matricula, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  443 +
  444 + if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
  445 + foreach ($lst_nota_aluno as $key => $nota) {
  446 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  447 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  448 + NULL, NULL, NULL, NULL, 1);
  449 +
  450 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  451 + $media = $det_tipo_av_val['nome'];
  452 + }
  453 + }
  454 + } else {
  455 + if (dbBool($det_serie['ultima_nota_define'])) {
  456 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  457 +
  458 + $media = $obj_nota_aluno->getUltimaNotaModulo($matricula, $cod_disciplina,
  459 + $aluno['ref_cod_serie'], count($this->array_modulos));
  460 + } else {
  461 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  462 + $obj_nota_aluno->setOrderby('modulo ASC');
  463 +
  464 + $lst_nota_aluno = $obj_nota_aluno->lista(NULL, NULL, NULL,
  465 + $aluno['ref_cod_serie'], $this->ref_cod_escola, $cod_disciplina,
  466 + $matricula, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  467 +
  468 + $qtd_modulos = count($this->array_modulos);
  469 + $notas = 0;
  470 +
  471 + if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
  472 + foreach ($lst_nota_aluno as $key => $nota) {
  473 + if ($key < $qtd_modulos) {
  474 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  475 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  476 + NULL, NULL, NULL, NULL);
  477 +
  478 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  479 + $notas += $det_tipo_av_val['valor'];
  480 + } else {
  481 + $notas += $nota['nota'] * 2;
  482 + $nota_exame = true;
  483 + }
  484 + }
  485 + }
  486 +
  487 + $media = $nota_exame ? $notas / (count($lst_nota_aluno) + 1) :
  488 + $notas / count($lst_nota_aluno);
  489 +
  490 + $obj_media = new clsPmieducarTipoAvaliacaoValores();
  491 + $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],
  492 + $det_curso['ref_sequencial'], NULL, NULL, $media, $media);
  493 +
  494 + if (is_array($det_media) && count($det_media)) {
  495 + $det_media = array_shift($det_media);
  496 + $media = $det_media['valor'];
  497 + $media = str_replace('.', ',', sprintf('%01.1f', $media));
  498 + }
  499 + }
  500 + }
  501 +
  502 + $obj_falta = new clsPmieducarFaltaAluno();
  503 + $faltas = $obj_falta->total_faltas_disciplina($matricula, $cod_disciplina, $aluno['ref_cod_serie']);
  504 + }
  505 +
  506 + $this->pdf->escreve_relativo($media, $esquerda, $this->page_y + 4,
  507 + $espaco_disciplinas / 2, 100, $fonte, $tam_texto + 1, $corTexto, 'center');
  508 +
  509 + $this->pdf->linha_relativa($esquerda + $espaco_disciplinas / 2,
  510 + $this->page_y, 0, $altura);
  511 +
  512 + $this->pdf->escreve_relativo($faltas, $esquerda + $espaco_disciplinas / 2,
  513 + $this->page_y + 4, $espaco_disciplinas / 2, 100, $fonte, $tam_texto + 1,
  514 + $corTexto, 'center');
  515 +
  516 + $esquerda += $espaco_disciplinas;
  517 +
  518 + $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);
  519 + }
  520 +
  521 + $this->page_y += $altura;
  522 +
  523 + if ($this->page_y > $this->pdf->altura - $altura * 2) {
  524 + $this->pdf->ClosePage();
  525 + $this->pdf->OpenPage();
  526 + $this->addCabecalho();
  527 + }
  528 + }
  529 + }
  530 +
  531 + //monta alunos que a serie tem falta globalizada
  532 + function montaAlunoGlobalizados($alunos_matriculados, $det_curso, $curso_conceitual)
  533 + {
  534 + $fonte = 'arial';
  535 + $corTexto = '#000000';
  536 + $esquerda_original = 3;
  537 + $espessura_linha = 0.3;
  538 + $tam_texto = 7;
  539 + $direita = 834;
  540 + $altura = 20;
  541 +
  542 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  543 + $det_serie = $obj_serie->detalhe();
  544 +
  545 + foreach ($alunos_matriculados as $matricula => $aluno) {
  546 + $esquerda = $esquerda_original;
  547 +
  548 + $this->pdf->quadrado_relativo($esquerda, $this->page_y, $direita, $altura);
  549 +
  550 + $this->pdf->escreve_relativo($matricula, $esquerda, $this->page_y + 2, 45,
  551 + 45, $fonte, $tam_texto, $corTexto, 'center');
  552 +
  553 + $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);
  554 +
  555 + $espaco_nome = 150;
  556 +
  557 + $this->pdf->escreve_relativo($aluno['nome'], $esquerda, $this->page_y + 2,
  558 + $espaco_nome, 45, $fonte, $tam_texto, $corTexto, 'center');
  559 +
  560 + $this->pdf->linha_relativa($esquerda += $espaco_nome, $this->page_y, 0, $altura);
  561 +
  562 + $this->pdf->escreve_relativo($aluno['aprovado'] == 1 ? 'Aprovado' : 'Reprovado',
  563 + $esquerda, $this->page_y + 4, 45, 45, $fonte, $tam_texto, $corTexto, 'center');
  564 +
  565 + $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);
  566 +
  567 + $espaco_disciplinas = ceil(($direita - $esquerda) / (count($this->disciplinas) + 1));
  568 +
  569 + foreach ($this->disciplinas as $cod_disciplina => $disciplina) {
  570 + $obj_dispensa_disciplina = new clsPmieducarDispensaDisciplina($matricula,
  571 + $aluno['ref_cod_serie'], $this->ref_cod_escola, $cod_disciplina);
  572 +
  573 + if ($obj_dispensa_disciplina->detalhe()) {
  574 + $media = $faltas = 'D';
  575 + }
  576 + else {
  577 + $nota_exame = false;
  578 +
  579 + if ($curso_conceitual) {
  580 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  581 + $obj_nota_aluno->setOrderby('modulo ASC');
  582 + $lst_nota_aluno = $obj_nota_aluno->lista(NULL, NULL,
  583 + $det_curso['ref_cod_tipo_avaliacao'], $aluno['ref_cod_serie'],
  584 + $this->ref_cod_escola, $cod_disciplina, $matricula, NULL, NULL,
  585 + NULL, NULL, NULL, NULL, 1);
  586 +
  587 + if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
  588 + foreach ($lst_nota_aluno as $key => $nota) {
  589 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  590 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  591 + NULL, NULL, NULL, NULL, 1);
  592 +
  593 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  594 + $media = $det_tipo_av_val['nome'];
  595 + }
  596 + }
  597 + } else {
  598 + if (dbBool($det_serie['ultima_nota_define'])) {
  599 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  600 +
  601 + $media = $obj_nota_aluno->getUltimaNotaModulo($matricula,
  602 + $cod_disciplina, $aluno['ref_cod_serie'], count($this->array_modulos));
  603 + } else {
  604 + $obj_nota_aluno = new clsPmieducarNotaAluno();
  605 +
  606 + $obj_nota_aluno->setOrderby('modulo ASC');
  607 +
  608 + $lst_nota_aluno = $obj_nota_aluno->lista(NULL, NULL,
  609 + $det_curso['ref_cod_tipo_avaliacao'], $aluno['ref_cod_serie'],
  610 + $this->ref_cod_escola, $cod_disciplina, $matricula, NULL, NULL,
  611 + NULL, NULL, NULL, NULL, 1);
  612 +
  613 + $qtd_modulos = count($this->array_modulos);
  614 +
  615 + $notas = 0;
  616 + if (is_array($lst_nota_aluno) && count($lst_nota_aluno)) {
  617 + foreach ($lst_nota_aluno as $key => $nota) {
  618 + if ($key < $qtd_modulos) {
  619 + $obj_tipo_av_val = new clsPmieducarTipoAvaliacaoValores(
  620 + $nota['ref_ref_cod_tipo_avaliacao'], $nota['ref_sequencial'],
  621 + NULL, NULL, NULL, NULL);
  622 +
  623 + $det_tipo_av_val = $obj_tipo_av_val->detalhe();
  624 + $notas += $det_tipo_av_val['valor'];
  625 + } else {
  626 + $notas += $nota['nota'] * 2;
  627 + $nota_exame = true;
  628 + }
  629 + }
  630 + }
  631 +
  632 + $media = $nota_exame ? $notas / (count($lst_nota_aluno) + 1) :
  633 + $notas / count($lst_nota_aluno);
  634 +
  635 + $obj_media = new clsPmieducarTipoAvaliacaoValores();
  636 + $det_media = $obj_media->lista($det_curso['ref_cod_tipo_avaliacao'],
  637 + $det_curso['ref_sequencial'], NULL, NULL, $media, $media);
  638 +
  639 + if (is_array($det_media) && count($det_media)) {
  640 + $det_media = array_shift($det_media);
  641 + $media = $det_media['valor'];
  642 + $media = str_replace('.', ',', sprintf('%01.1f', $media));
  643 + }
  644 + }
  645 + }
  646 +
  647 + $this->pdf->escreve_relativo($media, $esquerda, $this->page_y + 4,
  648 + $espaco_disciplinas, 50, $fonte, $tam_texto + 1, $corTexto, 'center');
  649 + $esquerda += $espaco_disciplinas;
  650 + $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);
  651 + }
  652 +
  653 + $obj_falta = new clsPmieducarFaltas();
  654 +
  655 + $faltas = $obj_falta->somaFaltas($matricula);
  656 + $this->pdf->escreve_relativo($faltas ? $faltas : '0', $esquerda, $this->page_y + 4,
  657 + $espaco_disciplinas, 50, $fonte, $tam_texto + 1, $corTexto, 'center');
  658 +
  659 + $esquerda += $espaco_disciplinas;
  660 + $this->pdf->linha_relativa($esquerda, $this->page_y, 0, $altura);
  661 + }
  662 +
  663 + $this->page_y += $altura;
  664 + if ($this->page_y > $this->pdf->altura - $altura * 2) {
  665 + $this->pdf->ClosePage();
  666 + $this->pdf->OpenPage();
  667 + $this->addCabecalho();
  668 + }
  669 + }
  670 + }
591 671  
592 672 public function addCabecalho()
593 673 {
... ... @@ -617,38 +697,38 @@ class indice extends clsCadastro
617 697 $this->pdf->insertImageScaled('gif', $logo, 50, 95, 41);
618 698  
619 699 // Título principal
620   - $titulo = $config->get($config->titulo, "i-Educar");
  700 + $titulo = $config->get($config->titulo, 'i-Educar');
621 701 $this->pdf->escreve_relativo($titulo, 30, 30, 782, 80,
622 702 $fonte, 18, $corTexto, 'center');
623   - $this->pdf->escreve_relativo(date("d/m/Y"), 745, 30, 100, 80, $fonte, 12,
  703 + $this->pdf->escreve_relativo(date('d/m/Y'), 745, 30, 100, 80, $fonte, 12,
624 704 $corTexto, 'left');
625 705  
626 706 // Dados escola
627   - $this->pdf->escreve_relativo("Instituição: $this->nm_instituicao", 120, 52,
  707 + $this->pdf->escreve_relativo('Instituição: ' . $this->nm_instituicao, 120, 52,
628 708 300, 80, $fonte, 9, $corTexto, 'left' );
629   - $this->pdf->escreve_relativo("Escola: {$this->nm_escola}",132, 64, 300, 80,
  709 + $this->pdf->escreve_relativo('Escola: ' . $this->nm_escola,132, 64, 300, 80,
630 710 $fonte, 9, $corTexto, 'left' );
631 711  
632   - $this->pdf->escreve_relativo("Ata de Resultado Final - {$this->ano}", 30,
  712 + $this->pdf->escreve_relativo('Ata de Resultado Final - ' . $this->ano, 30,
633 713 78, $direita, 80, $fonte, 12, $corTexto, 'center');
634 714  
635 715 $this->pdf->quadrado_relativo($esquerda, $this->page_y += 100, $direita, $altura);
636   - $this->pdf->escreve_relativo("Disciplina", $esquerda + 30, $this->page_y + 1,
  716 + $this->pdf->escreve_relativo('Disciplina', $esquerda + 30, $this->page_y + 1,
637 717 150, 50, $fonte, 9, $corTexto, 'center');
638   - $this->pdf->escreve_relativo("Carga Horária", $esquerda + 35, $this->page_y + 10,
  718 + $this->pdf->escreve_relativo('Carga Horária', $esquerda + 35, $this->page_y + 10,
639 719 150, 50, $fonte, 7, $corTexto, 'center');
640 720  
641 721 $this->page_y += $altura;
642 722 $this->pdf->quadrado_relativo($esquerda, $this->page_y, $direita, $altura);
643   - $this->pdf->escreve_relativo("Matrícula", $esquerda, $this->page_y + 2, 45,
  723 + $this->pdf->escreve_relativo('Matrícula', $esquerda, $this->page_y + 2, 45,
644 724 45, $fonte, $tam_texto, $corTexto, 'center');
645 725 $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);
646 726  
647 727 $espaco_nome = 150;
648   - $this->pdf->escreve_relativo("Nome do Aluno", $esquerda, $this->page_y + 2,
  728 + $this->pdf->escreve_relativo('Nome do Aluno', $esquerda, $this->page_y + 2,
649 729 $espaco_nome, 45, $fonte, $tam_texto, $corTexto, 'center');
650 730 $this->pdf->linha_relativa($esquerda += $espaco_nome, $this->page_y, 0, $altura);
651   - $this->pdf->escreve_relativo("Situação", $esquerda, $this->page_y + 2, 45,
  731 + $this->pdf->escreve_relativo('Situação', $esquerda, $this->page_y + 2, 45,
652 732 45, $fonte, $tam_texto, $corTexto, 'center');
653 733 $this->pdf->linha_relativa($esquerda += 45, $this->page_y, 0, $altura);
654 734  
... ... @@ -659,180 +739,216 @@ class indice extends clsCadastro
659 739 $carga_global = $this->montaDisciplinasNaoGlobalizada($esquerda, $direita - $esquerda);
660 740 }
661 741  
662   - $nm_curso = "Curso: {$this->nm_curso} Série: {$this->nm_serie} Turma: {$this->nm_turma} Dias Letivos: {$this->dias_letivos} Carga Global: {$carga_global} Turno: {$this->nm_turno}";
  742 + $nm_curso = sprintf('Curso: %s Série: %s Turma: %s Dias Letivos: %d Carga Global: %s Turno: %s',
  743 + $this->nm_curso, $this->nm_serie, $this->nm_turma, $this->dias_letivos, $carga_global, $this->nm_turno);
  744 +
663 745 $this->pdf->quadrado_relativo($esquerda_original, $this->page_y, $direita, $altura);
  746 +
664 747 $this->pdf->escreve_relativo($nm_curso, $esquerda_original + 10, $this->page_y + 5,
665 748 $direita, 50, $fonte, $tam_texto);
  749 +
  750 + $this->page_y += $altura;
  751 + }
  752 +
  753 +
  754 + function montaDisciplinasGlobalizada($esquerda, $espaco_disciplina)
  755 + {
  756 + $tam_texto = 9;
  757 + $altura = 20;
  758 + $tam_texto = 9;
  759 + $fonte = 'arial';
  760 + $corTexto = '#000000';
  761 + $carga_global = 0;
  762 +
  763 + $espaco_disciplinas = ceil($espaco_disciplina / (count($this->disciplinas) + 1));
  764 +
  765 + foreach ($this->disciplinas as $disciplina) {
  766 + $carga_global += $disciplina['carga_horaria'];
  767 +
  768 + $this->pdf->escreve_relativo($disciplina['abreviatura'], $esquerda,
  769 + $this->page_y - $altura, $espaco_disciplinas, 100, $fonte, $tam_texto,
  770 + $corTexto, 'center');
  771 +
  772 + $this->pdf->escreve_relativo($disciplina['carga_horaria'] . ' hrs',
  773 + $esquerda, $this->page_y + 10 - $altura, $espaco_disciplinas, 50,
  774 + $fonte, $tam_texto - 2, $corTexto, 'center');
  775 +
  776 + $this->pdf->escreve_relativo('Nota / Conceito', $esquerda, $this->page_y + 3,
  777 + $espaco_disciplinas, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
  778 +
  779 + $this->pdf->linha_relativa($esquerda, $this->page_y - $altura, 0, $altura * 2);
  780 +
  781 + $esquerda += $espaco_disciplinas;
  782 + }
  783 +
  784 + $this->pdf->linha_relativa($esquerda, $this->page_y - $altura, 0, $altura * 2);
  785 + $this->pdf->escreve_relativo('Faltas', $esquerda, $this->page_y, $espaco_disciplinas,
  786 + 50, $fonte, $tam_texto, $corTexto, 'center');
  787 +
  788 + $this->pdf->linha_relativa($esquerda += $espaco_disciplinas,
  789 + $this->page_y - $altura, 0, $altura * 2);
  790 +
666 791 $this->page_y += $altura;
  792 +
  793 + return $carga_global;
667 794 }
668 795  
  796 + function montaDisciplinasNaoGlobalizada($esquerda, $espaco_disciplina)
  797 + {
  798 + $espaco_disciplinas = ceil($espaco_disciplina / (count($this->disciplinas)));
  799 +
  800 + $tam_texto = 9;
  801 + $altura = 20;
  802 + $tam_texto = 9;
  803 + $fonte = 'arial';
  804 + $corTexto = '#000000';
  805 + $carga_global = 0;
  806 +
  807 + foreach ($this->disciplinas as $disciplina) {
  808 + $carga_global += $disciplina['carga_horaria'];
  809 +
  810 + $this->pdf->escreve_relativo($disciplina['abreviatura'], $esquerda,
  811 + $this->page_y - $altura, $espaco_disciplinas, 100, $fonte, $tam_texto, $corTexto, 'center');
  812 +
  813 + $this->pdf->escreve_relativo($disciplina['carga_horaria'] . ' hrs', $esquerda,
  814 + $this->page_y + 10 - $altura, $espaco_disciplinas, 50, $fonte,
  815 + $tam_texto - 2, $corTexto, 'center');
  816 +
  817 + $this->pdf->escreve_relativo('Nota / Conceito', $esquerda, $this->page_y + 3,
  818 + $espaco_disciplinas / 2, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
  819 +
  820 + $this->pdf->escreve_relativo('Falta', $esquerda + $espaco_disciplinas / 2,
  821 + $this->page_y + 3, $espaco_disciplinas / 2, 50, $fonte, $tam_texto - 2,
  822 + $corTexto, 'center');
  823 +
  824 + $this->pdf->linha_relativa($esquerda, $this->page_y - $altura, 0, $altura * 2);
  825 +
  826 + $this->pdf->linha_relativa($esquerda + $espaco_disciplinas / 2, $this->page_y, 0, $altura);
  827 +
  828 + $esquerda += $espaco_disciplinas;
  829 + }
  830 + $this->page_y += $altura;
  831 +
  832 + return $carga_global;
  833 + }
  834 +
  835 + function buscaDiasLetivos()
  836 + {
  837 + $obj_calendario = new clsPmieducarEscolaAnoLetivo();
  838 + $lista_calendario = $obj_calendario->lista($this->ref_cod_escola, $this->ano,
  839 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL);
  840 +
  841 + $totalDiasUteis = 0;
  842 + $total_semanas = 0;
669 843  
670   - function montaDisciplinasGlobalizada($esquerda, $espaco_disciplina) {
671   - $tam_texto = 9;
672   - $espaco_disciplinas = ceil($espaco_disciplina / (count($this->disciplinas) + 1));
673   - $altura = 20;
674   - $tam_texto = 9;
675   - $fonte = 'arial';
676   - $corTexto = '#000000';
677   - $carga_global = 0;
678   - foreach ($this->disciplinas as $disciplina) {
679   - $carga_global += $disciplina["carga_horaria"];
680   - $this->pdf->escreve_relativo($disciplina["abreviatura"], $esquerda, $this->page_y - $altura, $espaco_disciplinas, 100, $fonte, $tam_texto, $corTexto, 'center');
681   - $this->pdf->escreve_relativo($disciplina["carga_horaria"]." hrs", $esquerda, $this->page_y + 10 - $altura, $espaco_disciplinas, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
682   - $this->pdf->escreve_relativo("Nota / Conceito", $esquerda, $this->page_y + 3, $espaco_disciplinas, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
683   - $this->pdf->linha_relativa($esquerda, $this->page_y - $altura, 0, $altura * 2);//, $espessura_linha);
684   - $esquerda += $espaco_disciplinas;
685   - }
686   - $this->pdf->linha_relativa($esquerda, $this->page_y - $altura, 0, $altura * 2);
687   - $this->pdf->escreve_relativo("Faltas", $esquerda, $this->page_y, $espaco_disciplinas, 50, $fonte, $tam_texto, $corTexto, 'center');
688   - $this->pdf->linha_relativa($esquerda += $espaco_disciplinas, $this->page_y - $altura, 0, $altura * 2);
689   - $this->page_y += $altura;
690   - return $carga_global;
691   - }
692   -
693   - function montaDisciplinasNaoGlobalizada($esquerda, $espaco_disciplina) {
694   - $tam_texto = 9;
695   - $espaco_disciplinas = ceil($espaco_disciplina / (count($this->disciplinas)));
696   - $altura = 20;
697   - $tam_texto = 9;
698   - $fonte = 'arial';
699   - $corTexto = '#000000';
700   - $carga_global = 0;
701   - foreach ($this->disciplinas as $disciplina) {
702   - $carga_global += $disciplina["carga_horaria"];
703   - $this->pdf->escreve_relativo($disciplina["abreviatura"], $esquerda, $this->page_y - $altura, $espaco_disciplinas, 100, $fonte, $tam_texto, $corTexto, 'center');
704   - $this->pdf->escreve_relativo($disciplina["carga_horaria"]." hrs", $esquerda, $this->page_y + 10 - $altura, $espaco_disciplinas, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
705   - $this->pdf->escreve_relativo("Nota / Conceito", $esquerda, $this->page_y + 3, $espaco_disciplinas / 2, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
706   - $this->pdf->escreve_relativo("Falta", $esquerda + $espaco_disciplinas / 2, $this->page_y + 3, $espaco_disciplinas / 2, 50, $fonte, $tam_texto - 2, $corTexto, 'center');
707   - $this->pdf->linha_relativa($esquerda, $this->page_y - $altura, 0, $altura * 2);//, $espessura_linha);
708   - $this->pdf->linha_relativa($esquerda + $espaco_disciplinas / 2, $this->page_y, 0, $altura);//, $espessura_linha);
709   - $esquerda += $espaco_disciplinas;
710   - }
711   - $this->page_y += $altura;
712   - return $carga_global;
713   - }
714   -
715   - function buscaDiasLetivos()
716   - {
717   - $obj_calendario = new clsPmieducarEscolaAnoLetivo();
718   - $lista_calendario = $obj_calendario->lista($this->ref_cod_escola,$this->ano,null,null,null,null,null,null,null,1,null);
719   -
720   - $totalDiasUteis = 0;
721   - $total_semanas = 0;
722   -
723   - $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
724   - $obj_ano_letivo_modulo->setOrderby("data_inicio asc");
725   -
726   - $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano, $this->ref_cod_escola, null, null);
727   -
728   - if($lst_ano_letivo_modulo)
729   - {
730   - $inicio = $lst_ano_letivo_modulo['0'];
731   - $fim = $lst_ano_letivo_modulo[count($lst_ano_letivo_modulo) - 1];
732   -
733   - $mes_inicial = explode("-",$inicio['data_inicio']);
734   - $mes_inicial = $mes_inicial[1];
735   -
736   - $dia_inicial = $mes_inicial[2];
737   -
738   - $mes_final = explode("-",$fim['data_fim']);
739   - $mes_final = $mes_final[1];
740   -
741   - $dia_final = $mes_final[2];
742   - }
743   -
744   - for ($mes = $mes_inicial;$mes <= $mes_final;$mes++)
745   - {
746   - $obj_calendario_dia = new clsPmieducarCalendarioDia();
747   - $lista_dias = $obj_calendario_dia->lista($calendario['cod_calendario_ano_letivo'],$mes,null,null,null,null,null,null,null,1);
748   -
749   - $dias_mes = array();
750   -
751   - if($lista_dias)
752   - {
753   - foreach ($lista_dias as $dia) {
754   - $obj_motivo = new clsPmieducarCalendarioDiaMotivo($dia['ref_cod_calendario_dia_motivo']);
755   - $det_motivo = $obj_motivo->detalhe();
756   - $dias_mes[$dia['dia']] = strtolower($det_motivo['tipo']);
757   - }
758   - }
759   - //Dias previstos do mes
760   -
761   - // Qual o primeiro dia do mes
762   - $primeiroDiaDoMes = mktime(0,0,0,$mes,1,$this->ano);
763   -
764   - // Quantos dias tem o mes
765   - $NumeroDiasMes = date('t',$primeiroDiaDoMes);
766   -
767   - //informacoes primeiro dia do mes
768   - $dateComponents = getdate($primeiroDiaDoMes);
769   -
770   - // What is the name of the month in question?
771   - $NomeMes = $mesesDoAno[$dateComponents['mon']];
772   -
773   - // What is the index value (0-6) of the first day of the
774   - // month in question.
775   - $DiaSemana = $dateComponents['wday'];
776   -
777   - //total de dias uteis + dias extra-letivos - dia nao letivo - fim de semana
778   - $DiaSemana = 0;
779   -
780   - if($mes == $mes_inicial)
781   - {
782   - $dia_ini = $dia_inicial;
783   - }
784   - elseif($mes == $mes_final)
785   - {
786   - $dia_ini = $dia_final;
787   - }
788   - else
789   - {
790   - $dia_ini = 1;
791   - }
792   -
793   - for($dia = $dia_ini; $dia <= $NumeroDiasMes; $dia++)
794   - {
795   - if($DiaSemana >= 7)
796   - {
797   - $DiaSemana = 0;
798   - $total_semanas++;
799   - }
800   -
801   - if($DiaSemana != 0 && $DiaSemana != 6) {
802   - if(!(key_exists($dia,$dias_mes) && $dias_mes[$dia] == strtolower('n')))
803   - $totalDiasUteis++;
804   - } elseif(key_exists($dia,$dias_mes) && $dias_mes[$dia] == strtolower('e'))
805   - $totalDiasUteis++;
806   -
807   - $DiaSemana++;
  844 + $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
  845 + $obj_ano_letivo_modulo->setOrderby('data_inicio asc');
808 846  
809   - }
  847 + $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano,
  848 + $this->ref_cod_escola, NULL, NULL);
810 849  
  850 + if ($lst_ano_letivo_modulo) {
  851 + $inicio = $lst_ano_letivo_modulo['0'];
  852 + $fim = $lst_ano_letivo_modulo[count($lst_ano_letivo_modulo) - 1];
811 853  
812   - }
  854 + $mes_inicial = explode("-", $inicio['data_inicio']);
  855 + $mes_inicial = $mes_inicial[1];
  856 + $dia_inicial = $mes_inicial[2];
813 857  
814   - $this->dias_letivos = $totalDiasUteis;
815   - }
  858 + $mes_final = explode("-", $fim['data_fim']);
  859 + $mes_final = $mes_final[1];
  860 + $dia_final = $mes_final[2];
  861 + }
  862 +
  863 + for ($mes = $mes_inicial;$mes <= $mes_final; $mes++) {
  864 + $obj_calendario_dia = new clsPmieducarCalendarioDia();
  865 +
  866 + $lista_dias = $obj_calendario_dia->lista($calendario['cod_calendario_ano_letivo'],
  867 + $mes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  868 +
  869 + $dias_mes = array();
  870 +
  871 + if ($lista_dias) {
  872 + foreach ($lista_dias as $dia) {
  873 + $obj_motivo = new clsPmieducarCalendarioDiaMotivo($dia['ref_cod_calendario_dia_motivo']);
  874 +
  875 + $det_motivo = $obj_motivo->detalhe();
  876 + $dias_mes[$dia['dia']] = strtolower($det_motivo['tipo']);
  877 + }
  878 + }
  879 +
  880 + //Dias previstos do mes
  881 +
  882 + // Qual o primeiro dia do mes
  883 + $primeiroDiaDoMes = mktime(0, 0, 0, $mes, 1, $this->ano);
  884 +
  885 + // Quantos dias tem o mes
  886 + $NumeroDiasMes = date('t', $primeiroDiaDoMes);
  887 +
  888 + //informacoes primeiro dia do mes
  889 + $dateComponents = getdate($primeiroDiaDoMes);
  890 +
  891 + // What is the name of the month in question?
  892 + $NomeMes = $mesesDoAno[$dateComponents['mon']];
  893 +
  894 + // What is the index value (0-6) of the first day of the
  895 + // month in question.
  896 + $DiaSemana = $dateComponents['wday'];
  897 +
  898 + //total de dias uteis + dias extra-letivos - dia nao letivo - fim de semana
  899 + $DiaSemana = 0;
816 900  
817   - function Editar()
818   - {
819   - return false;
820   - }
  901 + if ($mes == $mes_inicial) {
  902 + $dia_ini = $dia_inicial;
  903 + }
  904 + elseif ($mes == $mes_final) {
  905 + $dia_ini = $dia_final;
  906 + }
  907 + else {
  908 + $dia_ini = 1;
  909 + }
821 910  
822   - function Excluir()
823   - {
824   - return false;
825   - }
  911 + for ($dia = $dia_ini; $dia <= $NumeroDiasMes; $dia++) {
  912 + if($DiaSemana >= 7) {
  913 + $DiaSemana = 0;
  914 + $total_semanas++;
  915 + }
826 916  
  917 + if ($DiaSemana != 0 && $DiaSemana != 6) {
  918 + if (!(key_exists($dia,$dias_mes) && $dias_mes[$dia] == strtolower('n'))) {
  919 + $totalDiasUteis++;
  920 + }
  921 + }
  922 + elseif (key_exists($dia,$dias_mes) && $dias_mes[$dia] == strtolower('e')) {
  923 + $totalDiasUteis++;
  924 + }
  925 +
  926 + $DiaSemana++;
  927 + }
  928 + }
  929 +
  930 + $this->dias_letivos = $totalDiasUteis;
  931 + }
  932 +
  933 + function Editar()
  934 + {
  935 + return FALSE;
  936 + }
  937 +
  938 + function Excluir()
  939 + {
  940 + return FALSE;
  941 + }
827 942 }
828 943  
829   -// cria uma extensao da classe base
  944 +// Instancia objeto de página
830 945 $pagina = new clsIndexBase();
831   -// cria o conteudo
  946 +
  947 +// Instancia objeto de conteúdo
832 948 $miolo = new indice();
833   -// adiciona o conteudo na clsBase
834   -$pagina->addForm( $miolo );
835   -// gera o html
836   -$pagina->MakeAll();
837 949  
838   -?>
  950 +// Atribui o conteúdo à página
  951 +$pagina->addForm($miolo);
  952 +
  953 +// Gera o código HTML
  954 +$pagina->MakeAll();
839 955 \ No newline at end of file
... ...