Commit 99815b08ef8f6281c27d31b2d50dde6b56d236ff

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

Refactoring para conding standards

ieducar/intranet/educar_relatorio_alunos_nota_semestre_disc.php
1 <?php 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 class clsIndexBase extends clsBase 47 class clsIndexBase extends clsBase
34 { 48 {
35 - function Formular()  
36 - {  
37 - $this->SetTitulo( "{$this->_instituicao} i-Educar - Rela&ccedil;&atilde;o de alunos/nota bimestres" );  
38 - $this->processoAp = "811";  
39 - } 49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Espelho de Nota Bimestral');
  52 + $this->processoAp = 811;
  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 class indice extends clsCadastro 66 class indice extends clsCadastro
43 { 67 {
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 - $this->campoRadio("tipo","Tipo Relatório",array('n' => 'Notas', 'f' => 'Faltas'),'n');  
141 -  
142 -  
143 - $get_escola = true;  
144 - //$obrigatorio = true;  
145 - $exibe_nm_escola = true;  
146 - $get_curso = true;  
147 - $get_escola_curso_serie = true;  
148 - $escola_obrigatorio = false;  
149 - $curso_obrigatorio = true;  
150 - $instituicao_obrigatorio = true;  
151 -  
152 -// $get_semestre = true;  
153 -  
154 - include("include/pmieducar/educar_campo_lista.php");  
155 -  
156 - $this->campoLista("ref_cod_turma","Turma",array('' => 'Selecione'),'');  
157 -  
158 - $this->campoLista("ref_cod_modulo","M&oacute;dulo",array('' => 'Selecione'),"");  
159 -  
160 - if($this->ref_cod_escola)  
161 - $this->ref_ref_cod_escola = $this->ref_cod_escola;  
162 - $this->campoLista( "ref_cod_matricula", "Aluno",array(''=>'Selecione'), "","",false,"Campo não obrigatório","",false,false );  
163 - if($this->get_link)  
164 - $this->campoRotulo("rotulo11", "-", "<a href='$this->get_link' target='_blank'>Baixar Relatório</a>");  
165 -  
166 - $this->url_cancelar = "educar_index.php";  
167 - $this->nome_url_cancelar = "Cancelar";  
168 -  
169 - $this->acao_enviar = 'acao2()';  
170 - $this->acao_executa_submit = false;  
171 -  
172 - }  
173 - 68 + var $pessoa_logada;
  69 +
  70 + var $ref_cod_instituicao;
  71 + var $ref_cod_escola;
  72 + var $ref_cod_serie;
  73 + var $ref_cod_turma;
  74 +
  75 + var $ano;
  76 + var $mes;
  77 +
  78 + var $nm_escola;
  79 + var $nm_instituicao;
  80 + var $ref_cod_curso;
  81 + var $sequencial;
  82 + var $pdf;
  83 + var $pagina_atual = 1;
  84 + var $total_paginas = 1;
  85 + var $nm_professor;
  86 + var $nm_turma;
  87 + var $nm_serie;
  88 + var $nm_disciplina;
  89 + var $curso_com_exame = 0;
  90 + var $ref_cod_matricula;
  91 +
  92 + var $page_y = 135;
  93 +
  94 + var $nm_aluno;
  95 + var $array_modulos = array();
  96 + var $nm_curso;
  97 + var $get_link = false;
  98 +
  99 + var $total;
  100 +
  101 + var $ref_cod_modulo;
  102 +
  103 + var $meses_do_ano = array(
  104 + 1 => "JANEIRO",
  105 + 2 => "FEVEREIRO",
  106 + 3 => "MARÇO",
  107 + 4 => "ABRIL",
  108 + 5 => "MAIO",
  109 + 6 => "JUNHO",
  110 + 7 => "JULHO",
  111 + 8 => "AGOSTO",
  112 + 9 => "SETEMBRO",
  113 + 10 => "OUTUBRO",
  114 + 11 => "NOVEMBRO",
  115 + 12 => "DEZEMBRO"
  116 + );
  117 +
  118 +
  119 + function Inicializar()
  120 + {
  121 + $retorno = 'Novo';
  122 +
  123 + @session_start();
  124 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  125 + @session_write_close();
  126 +
  127 + $obj_permissoes = new clsPermissoes();
  128 +
  129 + return $retorno;
  130 + }
  131 +
  132 + function Gerar()
  133 + {
  134 + $obj_permissoes = new clsPermissoes();
  135 + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
  136 +
  137 + if ($_POST){
  138 + foreach ($_POST as $key => $value) {
  139 + $this->$key = $value;
  140 + }
  141 + }
  142 +
  143 + $this->ano = $ano_atual = date('Y');
  144 + $this->mes = $mes_atual = date('n');
  145 +
  146 + $this->campoNumero("ano", "Ano", $this->ano, 4, 4, TRUE);
  147 +
  148 + $tipo = array(
  149 + 'n' => 'Notas',
  150 + 'f' => 'Faltas'
  151 + );
  152 + $this->campoRadio("tipo", "Tipo Relatório", $tipo, 'n');
  153 +
  154 + $get_escola = TRUE;
  155 + $exibe_nm_escola = TRUE;
  156 + $get_curso = TRUE;
  157 + $get_escola_curso_serie = TRUE;
  158 + $escola_obrigatorio = FALSE;
  159 + $curso_obrigatorio = TRUE;
  160 + $instituicao_obrigatorio = TRUE;
  161 +
  162 + include 'include/pmieducar/educar_campo_lista.php';
  163 +
  164 + $opcaoDefault = array('' => 'Selecione');
  165 +
  166 + $this->campoLista('ref_cod_turma', 'Turma', $opcaoDefault, '');
  167 +
  168 + $this->campoLista('ref_cod_modulo', 'Módulo', $opcaoDefault, '');
  169 +
  170 + if($this->ref_cod_escola) {
  171 + $this->ref_ref_cod_escola = $this->ref_cod_escola;
  172 + }
  173 +
  174 + $this->campoLista('ref_cod_matricula', 'Aluno', $opcaoDefault, '', '',
  175 + FALSE, 'Campo não obrigatório', '', FALSE, FALSE);
  176 +
  177 + if ($this->get_link) {
  178 + $this->campoRotulo('rotulo11', '-',
  179 + sprintf('<a href="%s" target="_blank">Baixar Relatório</a>', $this->get_link));
  180 + }
  181 +
  182 + $this->url_cancelar = 'educar_index.php';
  183 + $this->nome_url_cancelar = 'Cancelar';
  184 +
  185 + $this->acao_enviar = 'acao2()';
  186 + $this->acao_executa_submit = FALSE;
  187 + }
174 } 188 }
175 189
176 // cria uma extensao da classe base 190 // cria uma extensao da classe base
177 $pagina = new clsIndexBase(); 191 $pagina = new clsIndexBase();
  192 +
178 // cria o conteudo 193 // cria o conteudo
179 $miolo = new indice(); 194 $miolo = new indice();
  195 +
180 // adiciona o conteudo na clsBase 196 // adiciona o conteudo na clsBase
181 -$pagina->addForm( $miolo ); 197 +$pagina->addForm($miolo);
  198 +
182 // gera o html 199 // gera o html
183 $pagina->MakeAll(); 200 $pagina->MakeAll();
184 -  
185 -  
186 ?> 201 ?>
187 -<script>  
188 -  
189 - 202 +<script type="text/javascript">
190 document.getElementById('ref_cod_escola').onchange = function() 203 document.getElementById('ref_cod_escola').onchange = function()
191 { 204 {
192 - setMatVisibility();  
193 - getEscolaCurso();  
194 - var campoTurma = document.getElementById( 'ref_cod_turma' );  
195 - getTurmaCurso();  
196 - getModulos(); 205 + setMatVisibility();
  206 + getEscolaCurso();
  207 +
  208 + var campoTurma = document.getElementById('ref_cod_turma');
  209 +
  210 + getTurmaCurso();
  211 + getModulos();
197 } 212 }
198 213
199 document.getElementById('ref_cod_curso').onchange = function() 214 document.getElementById('ref_cod_curso').onchange = function()
200 { 215 {
201 - getEscolaCursoSerie();  
202 - getTurmaCurso();  
203 - getModulos(); 216 + getEscolaCursoSerie();
  217 + getTurmaCurso();
  218 + getModulos();
204 } 219 }
205 220
206 document.getElementById('ano').onkeyup = function() 221 document.getElementById('ano').onkeyup = function()
207 { 222 {
208 -  
209 - setMatVisibility();  
210 - getAluno();  
211 - getModulos(); 223 + setMatVisibility();
  224 + getAluno();
  225 + getModulos();
212 } 226 }
213 227
214 document.getElementById('ref_ref_cod_serie').onchange = function() 228 document.getElementById('ref_ref_cod_serie').onchange = function()
215 { 229 {
  230 + var campoEscola = document.getElementById('ref_cod_escola').value;
  231 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
216 232
217 - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;  
218 - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;  
219 -  
220 - var xml1 = new ajax(getTurma_XML);  
221 - strURL = "educar_turma_xml.php?esc="+campoEscola+"&ser="+campoSerie;  
222 - xml1.envia(strURL);  
223 - getModulos(); 233 + var xml1 = new ajax(getTurma_XML);
  234 + strURL = 'educar_turma_xml.php?esc=' + campoEscola + '&ser=' + campoSerie;
  235 + xml1.envia(strURL);
  236 + getModulos();
224 } 237 }
225 238
226 function getTurma_XML(xml) 239 function getTurma_XML(xml)
227 { 240 {
  241 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
  242 + var campoTurma = document.getElementById('ref_cod_turma');
  243 + var turma = xml.getElementsByTagName('turma');
228 244
  245 + campoTurma.length = 1;
  246 + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false);
229 247
230 - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;  
231 -  
232 - var campoTurma = document.getElementById( 'ref_cod_turma' );  
233 -  
234 - var turma = xml.getElementsByTagName( "turma" );  
235 -  
236 - campoTurma.length = 1;  
237 - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );  
238 - for ( var j = 0; j < turma.length; j++ )  
239 - { 248 + for (var j = 0; j < turma.length; j++) {
  249 + campoTurma.options[campoTurma.options.length] = new Option(
  250 + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false
  251 + );
  252 + }
240 253
241 - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );  
242 -  
243 - }  
244 - if ( campoTurma.length == 1 && campoSerie != '' ) {  
245 - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false );  
246 - }  
247 -  
248 - setMatVisibility(); 254 + if (campoTurma.length == 1 && campoSerie != '') {
  255 + campoTurma.options[0] = new Option('A série não possui nenhuma turma', '', false, false);
  256 + }
249 257
  258 + setMatVisibility();
250 } 259 }
251 260
252 function getTurmaCurso() 261 function getTurmaCurso()
253 { 262 {
254 - var campoCurso = document.getElementById('ref_cod_curso').value;  
255 - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; 263 + var campoCurso = document.getElementById('ref_cod_curso').value;
  264 + var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
256 265
257 - var xml1 = new ajax(getTurmaCurso_XML);  
258 - strURL = "educar_turma_xml.php?ins="+campoInstituicao+"&cur="+campoCurso; 266 + var xml1 = new ajax(getTurmaCurso_XML);
  267 + strURL = 'educar_turma_xml.php?ins=' + campoInstituicao + '&cur=' + campoCurso;
259 268
260 - xml1.envia(strURL); 269 + xml1.envia(strURL);
261 } 270 }
262 271
263 function getTurmaCurso_XML(xml) 272 function getTurmaCurso_XML(xml)
264 { 273 {
265 - var turma = xml.getElementsByTagName( "turma" );  
266 - var campoTurma = document.getElementById( 'ref_cod_turma' );  
267 - var campoCurso = document.getElementById('ref_cod_curso');  
268 -  
269 - campoTurma.length = 1;  
270 - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );  
271 -  
272 - for ( var j = 0; j < turma.length; j++ )  
273 - { 274 + var turma = xml.getElementsByTagName('turma');
  275 + var campoTurma = document.getElementById('ref_cod_turma');
  276 + var campoCurso = document.getElementById('ref_cod_curso');
274 277
275 - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false ); 278 + campoTurma.length = 1;
  279 + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false);
276 280
277 - } 281 + for (var j = 0; j < turma.length; j++) {
  282 + campoTurma.options[campoTurma.options.length] = new Option(
  283 + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false
  284 + );
  285 + }
278 286
279 - setMatVisibility(); 287 + setMatVisibility();
280 } 288 }
281 289
282 -  
283 document.getElementById('ref_cod_turma').onchange = function() 290 document.getElementById('ref_cod_turma').onchange = function()
284 { 291 {
285 - getAluno();  
286 - var This = this;  
287 - setMatVisibility();  
288 - 292 + getAluno();
  293 + var This = this;
  294 + setMatVisibility();
289 } 295 }
290 296
291 function setMatVisibility() 297 function setMatVisibility()
292 { 298 {
293 - var campoTurma = document.getElementById('ref_cod_turma');  
294 - var campoAluno = document.getElementById('ref_cod_matricula');  
295 -  
296 - campoAluno.length = 1;  
297 -  
298 - if (campoTurma.value == '')  
299 - {  
300 - setVisibility('tr_ref_cod_matricula',false);  
301 - setVisibility('ref_cod_matricula',false);  
302 - }  
303 - else  
304 - {  
305 - setVisibility('tr_ref_cod_matricula',true);  
306 - setVisibility('ref_cod_matricula',true);  
307 - } 299 + var campoTurma = document.getElementById('ref_cod_turma');
  300 + var campoAluno = document.getElementById('ref_cod_matricula');
  301 +
  302 + campoAluno.length = 1;
  303 +
  304 + if (campoTurma.value == '') {
  305 + setVisibility('tr_ref_cod_matricula', false);
  306 + setVisibility('ref_cod_matricula', false);
  307 + }
  308 + else {
  309 + setVisibility('tr_ref_cod_matricula', true);
  310 + setVisibility('ref_cod_matricula', true);
  311 + }
308 } 312 }
309 function getAluno() 313 function getAluno()
310 { 314 {
  315 + var campoTurma = document.getElementById('ref_cod_turma').value;
  316 + var campoAno = document.getElementById('ano').value;
311 317
312 - var campoTurma = document.getElementById('ref_cod_turma').value;  
313 - var campoAno = document.getElementById('ano').value;  
314 -  
315 - var xml1 = new ajax(getAluno_XML);  
316 - strURL = "educar_matricula_turma_xml.php?tur="+campoTurma+"&ano="+campoAno; 318 + var xml1 = new ajax(getAluno_XML);
  319 + strURL = 'educar_matricula_turma_xml.php?tur=' + campoTurma + '&ano=' + campoAno;
317 320
318 - xml1.envia(strURL); 321 + xml1.envia(strURL);
319 } 322 }
320 323
321 function getAluno_XML(xml) 324 function getAluno_XML(xml)
322 { 325 {
323 - var aluno = xml.getElementsByTagName( "matricula" );  
324 - var campoTurma = document.getElementById( 'ref_cod_turma' );  
325 - var campoAluno = document.getElementById('ref_cod_matricula');  
326 -  
327 - campoAluno.length = 1;  
328 - //campoAluno.options[0] = new Option( 'Selecione uma Turma', '', false, false );  
329 -  
330 - for ( var j = 0; j < aluno.length; j++ )  
331 - { 326 + var aluno = xml.getElementsByTagName('matricula');
  327 + var campoTurma = document.getElementById('ref_cod_turma');
  328 + var campoAluno = document.getElementById('ref_cod_matricula');
332 329
333 - campoAluno.options[campoAluno.options.length] = new Option( aluno[j].firstChild.nodeValue, aluno[j].getAttribute('cod_matricula'), false, false );  
334 -  
335 - } 330 + campoAluno.length = 1;
336 331
  332 + for (var j = 0; j < aluno.length; j++) {
  333 + campoAluno.options[campoAluno.options.length] = new Option(
  334 + aluno[j].firstChild.nodeValue, aluno[j].getAttribute('cod_matricula'), false, false
  335 + );
  336 + }
337 } 337 }
338 338
  339 +setVisibility('tr_ref_cod_matricula', false);
  340 +var func = function()
  341 +{
  342 + document.getElementById('btn_enviar').disabled= false;
  343 +}
339 344
340 -setVisibility('tr_ref_cod_matricula',false);  
341 -var func = function(){document.getElementById('btn_enviar').disabled= false;};  
342 -if( window.addEventListener ) {  
343 - //mozilla  
344 - document.getElementById('btn_enviar').addEventListener('click',func,false);  
345 - } else if ( window.attachEvent ) {  
346 - //ie  
347 - document.getElementById('btn_enviar').attachEvent('onclick',func);  
348 - } 345 +if (window.addEventListener) {
  346 + // mozilla
  347 + document.getElementById('btn_enviar').addEventListener('click', func, false);
  348 +}
  349 +else if (window.attachEvent) {
  350 + // ie
  351 + document.getElementById('btn_enviar').attachEvent('onclick', func);
  352 +}
349 353
350 function acao2() 354 function acao2()
351 { 355 {
352 - if(!acao())  
353 - return;  
354 -  
355 - showExpansivelImprimir(400, 200,'',[], "Boletim"); 356 + if (!acao()) {
  357 + return;
  358 + }
356 359
357 - document.formcadastro.target = 'miolo_'+(DOM_divs.length-1); 360 + showExpansivelImprimir(400, 200, '', [], 'Boletim');
358 361
359 - document.getElementById( 'btn_enviar' ).disabled =false; 362 + document.formcadastro.target = 'miolo_'+(DOM_divs.length-1);
360 363
361 - if(document.formcadastro.tipo[0].checked)  
362 - document.formcadastro.action = 'educar_relatorio_alunos_nota_semestre_disc_proc.php';  
363 - else  
364 - document.formcadastro.action = 'educar_relatorio_alunos_falta_bimestre_disc_proc.php'; 364 + document.getElementById('btn_enviar').disabled = false;
365 365
366 - document.formcadastro.submit(); 366 + if (document.formcadastro.tipo[0].checked) {
  367 + document.formcadastro.action = 'educar_relatorio_alunos_nota_semestre_disc_proc.php';
  368 + }
  369 + else {
  370 + document.formcadastro.action = 'educar_relatorio_alunos_falta_bimestre_disc_proc.php';
  371 + }
367 372
  373 + document.formcadastro.submit();
368 } 374 }
369 375
370 -  
371 -  
372 function getModulos() 376 function getModulos()
373 { 377 {
374 - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;  
375 - var campoCurso = document.getElementById( 'ref_cod_curso' ).value;  
376 - var campoAno = document.getElementById( 'ano' ).value;  
377 - var campoTurma = document.getElementById( 'ref_cod_turma' ).value;  
378 - var xml1 = new ajax(getModulos_XML);  
379 - strURL = "educar_modulo_xml.php?esc="+campoEscola+"&ano="+campoAno+"&curso="+campoCurso+"&turma="+campoTurma;  
380 - xml1.envia(strURL); 378 + var campoEscola = document.getElementById('ref_cod_escola').value;
  379 + var campoCurso = document.getElementById('ref_cod_curso').value;
  380 + var campoAno = document.getElementById('ano').value;
  381 + var campoTurma = document.getElementById('ref_cod_turma').value;
  382 +
  383 + var xml1 = new ajax(getModulos_XML);
  384 + strURL = 'educar_modulo_xml.php?esc=' + campoEscola + '&ano=' + campoAno +
  385 + '&curso=' + campoCurso + '&turma=' + campoTurma;
  386 +
  387 + xml1.envia(strURL);
381 } 388 }
382 389
383 function getModulos_XML(xml) 390 function getModulos_XML(xml)
384 { 391 {
  392 + var modulos = xml.getElementsByTagName('ano_letivo_modulo');
385 393
386 - var modulos = xml.getElementsByTagName( "ano_letivo_modulo" ); 394 + var campoEscola = document.getElementById('ref_cod_escola').value;
  395 + var campoCurso = document.getElementById('ref_cod_curso').value;
  396 + var campoModulo = document.getElementById('ref_cod_modulo');
  397 + var campoAno = document.getElementById('ano').value;
387 398
388 - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;  
389 - var campoCurso= document.getElementById( 'ref_cod_curso' ).value;  
390 - var campoModulo = document.getElementById( 'ref_cod_modulo' );  
391 - var campoAno = document.getElementById( 'ano' ).value;  
392 -  
393 - campoModulo.length = 1;  
394 - campoModulo.options[0] = new Option( 'Selecione um módulo', '', false, false );  
395 - for ( var j = 0; j < modulos.length; j++ )  
396 - {  
397 - //if ( modulos[j][2] == campoEscola && modulos[j][3] == campoAno)  
398 - //{  
399 - campoModulo.options[campoModulo.options.length] = new Option( modulos[j].firstChild.nodeValue, modulos[j].getAttribute('cod_modulo') + "-" +modulos[j].getAttribute('sequencial') , false, false );  
400 - //}  
401 - }  
402 - if ( campoModulo.length == 1 ) {  
403 - campoModulo.options[0] = new Option( 'O curso não possui nenhum módulo', '', false, false );  
404 - } 399 + campoModulo.length = 1;
  400 + campoModulo.options[0] = new Option('Selecione um módulo', '', false, false);
405 401
  402 + for (var j = 0; j < modulos.length; j++) {
  403 + campoModulo.options[campoModulo.options.length] = new Option( modulos[j].firstChild.nodeValue, modulos[j].getAttribute('cod_modulo') + "-" +modulos[j].getAttribute('sequencial') , false, false );
  404 + }
406 405
  406 + if (campoModulo.length == 1) {
  407 + campoModulo.options[0] = new Option('O curso não possui nenhum módulo', '', false, false);
  408 + }
407 } 409 }
408 -  
409 -</script> 410 +</script>
410 \ No newline at end of file 411 \ No newline at end of file
ieducar/intranet/educar_relatorio_alunos_nota_semestre_disc_proc.php
1 <?php 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/relatorio.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/relatorio.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 class clsIndexBase extends clsBase 47 class clsIndexBase extends clsBase
34 { 48 {
35 - function Formular()  
36 - {  
37 - $this->SetTitulo( "{$this->_instituicao} i-Educar - Rela&ccedil;&atilde;o de alunos/nota bimestres" );  
38 - $this->processoAp = "811";  
39 - $this->renderMenu = false;  
40 - $this->renderMenuSuspenso = false;  
41 - } 49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Espelho de Notas Bimestral');
  52 + $this->processoAp = 811;
  53 + $this->renderMenu = FALSE;
  54 + $this->renderMenuSuspenso = FALSE;
  55 + }
42 } 56 }
43 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 + */
44 class indice extends clsCadastro 68 class indice extends clsCadastro
45 { 69 {
46 -  
47 -  
48 - /**  
49 - * Referencia pega da session para o idpes do usuario atual  
50 - *  
51 - * @var int  
52 - */  
53 - var $pessoa_logada;  
54 -  
55 -  
56 - var $ref_cod_instituicao;  
57 - var $ref_cod_escola;  
58 - var $ref_cod_serie;  
59 - var $ref_cod_turma;  
60 - var $ref_cod_curso;  
61 - var $ref_cod_modulo;  
62 -  
63 - var $ano;  
64 -  
65 - var $is_padrao;  
66 - var $semestre;  
67 -  
68 - var $cursos = array();  
69 -  
70 - var $get_link;  
71 -  
72 -  
73 - function renderHTML()  
74 - {  
75 -  
76 - if($_POST){  
77 - foreach ($_POST as $key => $value) {  
78 - $this->$key = $value;  
79 -  
80 - }  
81 - }  
82 - if($this->ref_ref_cod_serie)  
83 - $this->ref_cod_serie = $this->ref_ref_cod_serie;  
84 -  
85 - $this->ref_cod_modulo = explode("-",$this->ref_cod_modulo);  
86 - $this->ref_cod_modulo = array_pop($this->ref_cod_modulo);  
87 -  
88 - $fonte = 'arial';  
89 - $corTexto = '#000000';  
90 -  
91 - if(empty($this->ref_cod_turma))  
92 - {  
93 - echo '<script>  
94 - alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");  
95 - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));  
96 - </script>';  
97 - return true;  
98 - }  
99 -  
100 - if($this->ref_cod_escola){  
101 -  
102 - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);  
103 - $det_escola = $obj_escola->detalhe();  
104 - $this->nm_escola = $det_escola['nome'];  
105 -  
106 - $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']);  
107 - $det_instituicao = $obj_instituicao->detalhe();  
108 - $this->nm_instituicao = $det_instituicao['nm_instituicao'];  
109 -  
110 - }  
111 -  
112 - $obj_calendario = new clsPmieducarEscolaAnoLetivo();  
113 - $lista_calendario = $obj_calendario->lista($this->ref_cod_escola,$this->ano,null,null,null,null,null,null,null,1,null);  
114 -  
115 - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);  
116 - $det_turma = $obj_turma->detalhe();  
117 - $this->nm_turma = $det_turma['nm_turma'];  
118 -  
119 - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);  
120 - $det_serie = $obj_serie->detalhe();  
121 - $this->nm_serie = $det_serie['nm_serie'];  
122 -  
123 - $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]);  
124 - $det = $obj_pessoa->detalhe();  
125 - $this->nm_professor = $det["nome"];  
126 -  
127 - if(!$lista_calendario)  
128 - {  
129 - echo '<script>  
130 - alert("Escola não possui calendário definido para este ano");  
131 - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));  
132 - </script>';  
133 - return true;  
134 - }  
135 -  
136 - $obj = new clsPmieducarSerie();  
137 - $obj->setOrderby('cod_serie,etapa_curso');  
138 - $lista_serie_curso = $obj->lista(null,null,null,$this->ref_cod_curso,null,null,null,null,null,null,null,null,1,$this->ref_cod_instituicao);  
139 -  
140 - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);  
141 - $det_curso = $obj_curso->detalhe();  
142 - $this->nm_curso = $det_curso['nm_curso'];  
143 -  
144 - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);  
145 - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();  
146 - $conceitual = $det_tipo_avaliacao['conceitual'];  
147 -  
148 - if ($this->is_padrao || $this->ano == 2007) {  
149 - $this->semestre = null;  
150 - }  
151 -  
152 - $obj_matricula_turma = new clsPmieducarMatriculaTurma();  
153 - $obj_matricula_turma->setOrderby('nome_ascii');  
154 -// $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, $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,null,null,null,true);  
155 - $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, $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,null,null,null,true, null, null, true, null, $this->semestre);  
156 - //$obj_disciplinas = new clsPmieducarDisciplinaSerie();  
157 - $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();  
158 - $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,$this->ref_cod_escola,null,1);  
159 -  
160 - if($lst_matricula_turma)  
161 - {  
162 -  
163 - $relatorio = new relatorios("Espelho de Notas Bimestral {$this->ref_cod_modulo}º Bimestre Ano {$this->ano}", 210, false, "Espelho de Notas Bimestral", "A4", "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma ".date("d/m/Y"));  
164 - $relatorio->setMargem(20,20,50,50);  
165 - $relatorio->exibe_produzido_por = false;  
166 -  
167 -  
168 - //$relatorio->novalinha( array( "Cód. Aluno", "Nome do Aluno", "1Mº", "M.Parcial", "Exame", "M.Final", "Faltas"),0,16,true,"arial",array( 75, 160, 120, 55, 50, 50),"#515151","#d3d3d3","#FFFFFF",false,true);  
169 - //$relatorio->novalinha( array( "Cód. Aluno", "Nome do Aluno", "1Mº", "2Mº", "M.Parcial", "Exame", "M.Final", "Faltas"),0,16,true,"arial",array( 75, 160, 60, 60, 55, 50, 50),"#515151","#d3d3d3","#FFFFFF",false,true);  
170 - //$relatorio->novalinha( array( "Cód. Aluno", "Nome do Aluno", "1Mº", "2Mº", "3Mº", "M.Parcial", "Exame", "M.Final", "Faltas"),0,16,true,"arial",array( 75, 160, 40, 40, 40, 55, 50, 50),"#515151","#d3d3d3","#FFFFFF",false,true);  
171 -  
172 - $db = new clsBanco();  
173 -  
174 - foreach ($lst_disciplinas as $disciplina)  
175 - {  
176 - $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);  
177 - $det_disciplina = $obj_disciplina->detalhe();  
178 -  
179 - $array_disc[$det_disciplina['cod_disciplina']] = ($det_disciplina['abreviatura']);  
180 - $array_cab[] = str2upper($det_disciplina['abreviatura']);  
181 - }  
182 -  
183 - //if($conceitual)  
184 - {  
185 - asort($array_disc);  
186 - sort($array_cab);  
187 - $array_cab = array_merge(array( "Cód.", "Nome do Aluno" ),$array_cab);  
188 - }  
189 -  
190 -  
191 - $divisoes = array( 40, 165 );  
192 - $divisoes_texto = array( 40, 165 );  
193 -  
194 - if(!$conceitual)  
195 - $tamanho_divisao = 32 + ( 10 - count($array_disc) ) * 5;  
196 - else  
197 - $tamanho_divisao = 23 + ( 15 - count($array_disc) ) * 5;  
198 - for($ct=0;$ct<20;$ct++)  
199 - {  
200 - $divisoes[] = $tamanho_divisao;  
201 - $divisoes_texto[] = $tamanho_divisao;  
202 - }  
203 - $relatorio->novalinha( $array_cab ,0,16,true,"arial",$divisoes,"#515151","#d3d3d3","#ffffff",false,true);  
204 -  
205 - if(!$conceitual)  
206 - {  
207 - $campo_nota = "COALESCE(nota,valor) ";  
208 - }  
209 - else  
210 - {  
211 - $campo_nota = "nome ";  
212 - }  
213 -  
214 - if($conceitual)  
215 - {  
216 - $tam_fonte = 8;  
217 - $tam_linha = 11;  
218 - }  
219 - else  
220 - {  
221 - $tam_fonte = null;  
222 - $tam_linha = 16;  
223 - }  
224 - foreach ($lst_matricula_turma as $matricula)  
225 - {  
226 -  
227 - $consulta = "SELECT ref_cod_disciplina  
228 - ,$campo_nota as nota  
229 - ,modulo  
230 - FROM pmieducar.nota_aluno  
231 - LEFT OUTER JOIN  
232 - pmieducar.tipo_avaliacao_valores  
233 - ON ( ref_ref_cod_tipo_avaliacao = ref_cod_tipo_avaliacao  
234 - AND ref_sequencial = sequencial )  
235 - WHERE ref_cod_matricula = {$matricula['ref_cod_matricula']}  
236 - AND ref_cod_escola = {$this->ref_cod_escola}  
237 - AND ref_cod_serie = {$this->ref_cod_serie}  
238 - AND modulo = {$this->ref_cod_modulo}  
239 - AND nota_aluno.ativo = 1  
240 - GROUP BY ref_cod_disciplina  
241 - ,modulo  
242 - ,$campo_nota  
243 - ORDER BY ref_cod_disciplina ASC ";  
244 -  
245 - $db->Consulta($consulta);  
246 -  
247 - unset($notas);  
248 - while ($db->ProximoRegistro())  
249 - {  
250 - $registro = $db->Tupla();  
251 -  
252 - $notas[$registro['ref_cod_disciplina']] = $registro['nota'];  
253 -  
254 - }  
255 -  
256 - if( strlen( $matricula['nome'] ) > 24 )  
257 - {  
258 - $matricula['nome'] = explode(" ",$matricula['nome']);  
259 - if(is_array($matricula['nome'] ))  
260 - {  
261 - $nome_aluno = array_shift($matricula['nome']);  
262 - }  
263 - if(is_array($matricula['nome'] ))  
264 - {  
265 - $nome_aluno .= " ".array_shift($matricula['nome']);  
266 - }  
267 - if(is_array($matricula['nome'] ))  
268 - {  
269 - $nome_aluno .= " ".array_pop($matricula['nome']);  
270 - }  
271 - $matricula['nome'] = $nome_aluno;  
272 - }  
273 -  
274 - unset($array_val);  
275 - $array_val = array();  
276 - $array_val[] = $matricula['ref_cod_aluno'];  
277 - $array_val[] = $matricula['nome'];  
278 - foreach ($array_disc as $cod_disc => $disc)  
279 - {  
280 - if(!$conceitual)  
281 - $array_val[] = $notas[$cod_disc] ? number_format( $notas[$cod_disc] ,2,'.','') : $notas[$cod_disc];  
282 - else  
283 - $array_val[] = $notas[$cod_disc];  
284 -  
285 - }  
286 -  
287 - $relatorio->novalinha($array_val,0,$tam_linha,false,"arial",$divisoes_texto,"#515151","#d3d3d3","#FFFFFF",false,true,null,$tam_fonte);  
288 -  
289 - }  
290 -  
291 - $this->get_link = $relatorio->fechaPdf();  
292 - }  
293 -  
294 -  
295 - echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>";  
296 -  
297 - 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>  
298 - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>  
299 -  
300 - Clique na Imagem para Baixar o instalador<br><br>  
301 - <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>  
302 - </span>  
303 - </center>";  
304 - }  
305 -  
306 -  
307 - function Editar()  
308 - {  
309 - return false;  
310 - }  
311 -  
312 - function Excluir()  
313 - {  
314 - return false;  
315 - }  
316 - 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;
  76 + var $ref_cod_curso;
  77 + var $ref_cod_modulo;
  78 +
  79 + var $ano;
  80 +
  81 + var $is_padrao;
  82 + var $semestre;
  83 +
  84 + var $cursos = array();
  85 +
  86 + var $get_link;
  87 +
  88 + function renderHTML()
  89 + {
  90 + if ($_POST){
  91 + foreach ($_POST as $key => $value) {
  92 + $this->$key = $value;
  93 + }
  94 + }
  95 +
  96 + if($this->ref_ref_cod_serie) {
  97 + $this->ref_cod_serie = $this->ref_ref_cod_serie;
  98 + }
  99 +
  100 + $this->ref_cod_modulo = explode('-', $this->ref_cod_modulo);
  101 + $this->ref_cod_modulo = array_pop($this->ref_cod_modulo);
  102 +
  103 + $fonte = 'arial';
  104 + $corTexto = '#000000';
  105 +
  106 + if (empty($this->ref_cod_turma)) {
  107 + echo '<script>
  108 + alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");
  109 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  110 + </script>';
  111 +
  112 + return TRUE;
  113 + }
  114 +
  115 + if($this->ref_cod_escola) {
  116 + $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
  117 + $det_escola = $obj_escola->detalhe();
  118 + $this->nm_escola = $det_escola['nome'];
  119 +
  120 + $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']);
  121 + $det_instituicao = $obj_instituicao->detalhe();
  122 + $this->nm_instituicao = $det_instituicao['nm_instituicao'];
  123 + }
  124 +
  125 + $obj_calendario = new clsPmieducarEscolaAnoLetivo();
  126 + $lista_calendario = $obj_calendario->lista($this->ref_cod_escola, $this->ano,
  127 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL);
  128 +
  129 + $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
  130 + $det_turma = $obj_turma->detalhe();
  131 + $this->nm_turma = $det_turma['nm_turma'];
  132 +
  133 + $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
  134 + $det_serie = $obj_serie->detalhe();
  135 + $this->nm_serie = $det_serie['nm_serie'];
  136 +
  137 + $obj_pessoa = new clsPessoa_($det_turma['ref_cod_regente']);
  138 + $det = $obj_pessoa->detalhe();
  139 + $this->nm_professor = $det['nome'];
  140 +
  141 + if (!$lista_calendario) {
  142 + echo '<script>
  143 + alert("Escola não possui calendário definido para este ano");
  144 + window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
  145 + </script>';
  146 +
  147 + return TRUE;
  148 + }
  149 +
  150 + $obj = new clsPmieducarSerie();
  151 + $obj->setOrderby('cod_serie, etapa_curso');
  152 + $lista_serie_curso = $obj->lista(NULL, NULL, NULL, $this->ref_cod_curso,
  153 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao);
  154 +
  155 + $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
  156 + $det_curso = $obj_curso->detalhe();
  157 + $this->nm_curso = $det_curso['nm_curso'];
  158 +
  159 + $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
  160 + $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
  161 + $conceitual = $det_tipo_avaliacao['conceitual'];
  162 +
  163 + // @todo Ano 2007 porque? Remover
  164 + if ($this->is_padrao || $this->ano == 2007) {
  165 + $this->semestre = NULL;
  166 + }
  167 +
  168 + $obj_matricula_turma = new clsPmieducarMatriculaTurma();
  169 + $obj_matricula_turma->setOrderby('nome_ascii');
  170 + $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula,
  171 + $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1,
  172 + $this->ref_cod_serie, $this->ref_cod_curso, $this->ref_cod_escola,
  173 + $this->ref_cod_instituicao, NULL, NULL, array(1, 2, 3), NULL, NULL,
  174 + $this->ano, NULL, NULL, NULL, NULL, TRUE, NULL, NULL, TRUE, NULL, $this->semestre);
  175 +
  176 + $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();
  177 + $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,
  178 + $this->ref_cod_escola, NULL, 1);
  179 +
  180 + if($lst_matricula_turma) {
  181 + $relatorio = new relatorios("Espelho de Notas Bimestral {$this->ref_cod_modulo}º Bimestre Ano {$this->ano}", 210, false, "Espelho de Notas Bimestral", "A4", "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma ".date("d/m/Y"));
  182 + $relatorio->setMargem(20, 20, 50, 50);
  183 + $relatorio->exibe_produzido_por = FALSE;
  184 +
  185 + $db = new clsBanco();
  186 +
  187 + foreach ($lst_disciplinas as $disciplina) {
  188 + $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
  189 + $det_disciplina = $obj_disciplina->detalhe();
  190 +
  191 + $array_disc[$det_disciplina['cod_disciplina']] = ($det_disciplina['abreviatura']);
  192 + $array_cab[] = str2upper($det_disciplina['abreviatura']);
  193 + }
  194 +
  195 + asort($array_disc);
  196 + sort($array_cab);
  197 + $array_cab = array_merge(array( "Cód.", "Nome do Aluno" ),$array_cab);
  198 +
  199 + $divisoes = array(40, 165);
  200 + $divisoes_texto = array(40, 165);
  201 +
  202 + if (!$conceitual) {
  203 + $tamanho_divisao = 32 + (10 - count($array_disc)) * 5;
  204 + }
  205 + else {
  206 + $tamanho_divisao = 23 + (15 - count($array_disc)) * 5;
  207 + }
  208 +
  209 + for ($ct = 0; $ct < 20; $ct++) {
  210 + $divisoes[] = $tamanho_divisao;
  211 + $divisoes_texto[] = $tamanho_divisao;
  212 + }
  213 +
  214 + $relatorio->novalinha($array_cab, 0, 16, TRUE, 'arial', $divisoes,
  215 + '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE);
  216 +
  217 + if(!$conceitual) {
  218 + $campo_nota = 'COALESCE(nota, valor) ';
  219 + }
  220 + else {
  221 + $campo_nota = 'nome ';
  222 + }
  223 +
  224 + if ($conceitual) {
  225 + $tam_fonte = 8;
  226 + $tam_linha = 11;
  227 + }
  228 + else {
  229 + $tam_fonte = NULL;
  230 + $tam_linha = 16;
  231 + }
  232 +
  233 + foreach ($lst_matricula_turma as $matricula) {
  234 + $consulta = sprintf("
  235 + SELECT
  236 + ref_cod_disciplina,
  237 + %s AS nota,
  238 + modulo
  239 + FROM
  240 + pmieducar.nota_aluno
  241 + LEFT OUTER JOIN
  242 + pmieducar.tipo_avaliacao_valores
  243 + ON (
  244 + ref_ref_cod_tipo_avaliacao = ref_cod_tipo_avaliacao
  245 + AND ref_sequencial = sequencial
  246 + )
  247 + WHERE
  248 + ref_cod_matricula = %d
  249 + AND ref_cod_escola = %d
  250 + AND ref_cod_serie = %d
  251 + AND modulo = %d
  252 + AND nota_aluno.ativo = 1
  253 + GROUP BY
  254 + ref_cod_disciplina,
  255 + modulo,
  256 + %s
  257 + ORDER BY
  258 + ref_cod_disciplina ASC", $campo_nota, $matricula['ref_cod_matricula'],
  259 + $this->ref_cod_escola, $this->ref_cod_serie, $this->ref_cod_modulo,
  260 + $campo_nota);
  261 +
  262 + $db->Consulta($consulta);
  263 +
  264 + unset($notas);
  265 +
  266 + while ($db->ProximoRegistro()) {
  267 + $registro = $db->Tupla();
  268 + $notas[$registro['ref_cod_disciplina']] = $registro['nota'];
  269 + }
  270 +
  271 + // @todo WTF?!
  272 + if (strlen($matricula['nome']) > 24) {
  273 + $matricula['nome'] = explode(' ', $matricula['nome']);
  274 +
  275 + if (is_array($matricula['nome'])) {
  276 + $nome_aluno = array_shift($matricula['nome']);
  277 + }
  278 +
  279 + if (is_array($matricula['nome'])) {
  280 + $nome_aluno .= ' ' . array_shift($matricula['nome']);
  281 + }
  282 +
  283 + if (is_array($matricula['nome'])) {
  284 + $nome_aluno .= ' ' . array_pop($matricula['nome']);
  285 + }
  286 +
  287 + $matricula['nome'] = $nome_aluno;
  288 + }
  289 +
  290 + unset($array_val);
  291 + $array_val = array();
  292 + $array_val[] = $matricula['ref_cod_aluno'];
  293 + $array_val[] = $matricula['nome'];
  294 +
  295 + foreach ($array_disc as $cod_disc => $disc) {
  296 + if (!$conceitual) {
  297 + $array_val[] = $notas[$cod_disc] ?
  298 + number_format($notas[$cod_disc], 2, '.', '') : $notas[$cod_disc];
  299 + }
  300 + else {
  301 + $array_val[] = $notas[$cod_disc];
  302 + }
  303 + }
  304 +
  305 + $relatorio->novalinha($array_val, 0, $tam_linha, FALSE, 'arial',
  306 + $divisoes_texto, '#515151', '#d3d3d3', '#FFFFFF', FALSE, TRUE, NULL, $tam_fonte);
  307 + }
  308 +
  309 + $this->get_link = $relatorio->fechaPdf();
  310 + }
  311 +
  312 + echo sprintf('
  313 + <script>
  314 + window.onload=function()
  315 + {
  316 + parent.EscondeDiv("LoadImprimir");
  317 + window.location="download.php?filename=%s"
  318 + }
  319 + </script>', $this->get_link);
  320 +
  321 + echo sprintf('
  322 + <html>
  323 + <center>
  324 + Se o download não iniciar automaticamente <br>
  325 + <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br>
  326 + <span style="font-size: 10px;">
  327 + Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
  328 + Clique na Imagem para Baixar o instalador<br><br>
  329 + <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>
  330 + </span>
  331 + </center>
  332 + </html>', $this->get_link);
  333 + }
  334 +
  335 + function Editar()
  336 + {
  337 + return FALSE;
  338 + }
  339 +
  340 + function Excluir()
  341 + {
  342 + return FALSE;
  343 + }
317 } 344 }
318 345
319 -// cria uma extensao da classe base 346 +// Instancia objeto de página
320 $pagina = new clsIndexBase(); 347 $pagina = new clsIndexBase();
321 -// cria o conteudo 348 +
  349 +// Instancia objeto de conteúdo
322 $miolo = new indice(); 350 $miolo = new indice();
323 -// adiciona o conteudo na clsBase  
324 -$pagina->addForm( $miolo );  
325 -// gera o html  
326 -$pagina->MakeAll();  
327 351
  352 +// Atribui o conteúdo à página
  353 +$pagina->addForm($miolo);
328 354
329 -?> 355 +// Gera o código HTML
  356 +$pagina->MakeAll();
330 \ No newline at end of file 357 \ No newline at end of file