Commit 728f42c6ddeeec2c4b701705d258106bc6865615

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

Refactoring para coding standards

ieducar/intranet/educar_relatorio_alunos_nota_semestre.php
1 1 <?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsCadastro.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once( "include/pmieducar/geral.inc.php" );
31   -require_once ("include/clsPDF.inc.php");
32 2  
  3 +/**
  4 + * i-Educar - Sistema de gestão escolar
  5 + *
  6 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  7 + * <ctima@itajai.sc.gov.br>
  8 + *
  9 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  10 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  11 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  12 + * qualquer versão posterior.
  13 + *
  14 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  15 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  16 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  17 + * do GNU para mais detalhes.
  18 + *
  19 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  20 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  21 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  22 + *
  23 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  24 + * @category i-Educar
  25 + * @license @@license@@
  26 + * @package iEd_Pmieducar
  27 + * @since Arquivo disponível desde a versão 1.0.0
  28 + * @version $Id$
  29 + */
  30 +
  31 +require_once 'include/clsBase.inc.php';
  32 +require_once 'include/clsCadastro.inc.php';
  33 +require_once 'include/clsBanco.inc.php';
  34 +require_once 'include/pmieducar/geral.inc.php';
  35 +require_once 'include/clsPDF.inc.php';
  36 +
  37 +/**
  38 + * clsIndexBase class.
  39 + *
  40 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  41 + * @category i-Educar
  42 + * @license @@license@@
  43 + * @package iEd_Pmieducar
  44 + * @since Classe disponível desde a versão 1.0.0
  45 + * @version @@package_version@@
  46 + */
33 47 class clsIndexBase extends clsBase
34 48 {
35   - function Formular()
36   - {
37   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Rela&ccedil;&atilde;o de alunos/nota bimestres" );
38   - $this->processoAp = "807";
39   - }
  49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Espelho de Nota Anual');
  52 + $this->processoAp = 807;
  53 + }
40 54 }
41 55  
  56 +/**
  57 + * indice class.
  58 + *
  59 + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
  60 + * @category i-Educar
  61 + * @license @@license@@
  62 + * @package iEd_Pmieducar
  63 + * @since Classe disponível desde a versão 1.0.0
  64 + * @version @@package_version@@
  65 + */
42 66 class indice extends clsCadastro
43 67 {
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   -
150   -// $get_semestre = true;
151   -
152   - include("include/pmieducar/educar_campo_lista.php");
153   -
154   - $this->campoLista("ref_cod_turma","Turma",array('' => 'Selecione'),'');
155   -
156   - if($this->ref_cod_escola)
157   - $this->ref_ref_cod_escola = $this->ref_cod_escola;
158   - $this->campoLista( "ref_cod_matricula", "Aluno",array(''=>'Selecione'), "","",false,"Campo não obrigatório","",false,false );
159   - if($this->get_link)
160   - $this->campoRotulo("rotulo11", "-", "<a href='$this->get_link' target='_blank'>Baixar Relatório</a>");
161   -
162   - $this->url_cancelar = "educar_index.php";
163   - $this->nome_url_cancelar = "Cancelar";
164   -
165   - $this->acao_enviar = 'acao2()';
166   - $this->acao_executa_submit = false;
167   -
168   - }
169   -
  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 + function Inicializar()
  119 + {
  120 + $retorno = 'Novo';
  121 +
  122 + @session_start();
  123 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  124 + @session_write_close();
  125 +
  126 + $obj_permissoes = new clsPermissoes();
  127 + return $retorno;
  128 + }
  129 +
  130 + function Gerar()
  131 + {
  132 + $obj_permissoes = new clsPermissoes();
  133 + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
  134 +
  135 + if ($_POST){
  136 + foreach ($_POST as $key => $value) {
  137 + $this->$key = $value;
  138 + }
  139 + }
  140 +
  141 + $this->ano = $ano_atual = date('Y');
  142 + $this->mes = $mes_atual = date('n');
  143 +
  144 + $this->campoNumero('ano', 'Ano', $this->ano, 4, 4, TRUE);
  145 +
  146 + $get_escola = TRUE;
  147 + $exibe_nm_escola = TRUE;
  148 + $get_curso = TRUE;
  149 + $get_escola_curso_serie = TRUE;
  150 + $escola_obrigatorio = FALSE;
  151 + $curso_obrigatorio = TRUE;
  152 + $instituicao_obrigatorio = TRUE;
  153 +
  154 + include 'include/pmieducar/educar_campo_lista.php';
  155 +
  156 + $this->campoLista('ref_cod_turma', 'Turma', array('' => 'Selecione'), '');
  157 +
  158 + if ($this->ref_cod_escola) {
  159 + $this->ref_ref_cod_escola = $this->ref_cod_escola;
  160 + }
  161 +
  162 + $this->campoLista('ref_cod_matricula', 'Aluno', array('' => 'Selecione'),
  163 + '', '', FALSE, 'Campo não obrigatório', '', FALSE, FALSE);
  164 +
  165 + if ($this->get_link) {
  166 + $this->campoRotulo('rotulo11', '-',
  167 + sprintf('<a href="%s" target="_blank">Baixar Relatório</a>', $this->get_link));
  168 + }
  169 +
  170 + $this->url_cancelar = 'educar_index.php';
  171 + $this->nome_url_cancelar = 'Cancelar';
  172 +
  173 + $this->acao_enviar = 'acao2()';
  174 + $this->acao_executa_submit = FALSE;
  175 + }
170 176 }
171 177  
172   -// cria uma extensao da classe base
  178 +// Instancia objeto de página
173 179 $pagina = new clsIndexBase();
174   -// cria o conteudo
  180 +
  181 +// Instancia objeto de conteúdo
175 182 $miolo = new indice();
176   -// adiciona o conteudo na clsBase
177   -$pagina->addForm( $miolo );
178   -// gera o html
179   -$pagina->MakeAll();
180 183  
  184 +// Atribui o conteúdo à página
  185 +$pagina->addForm($miolo);
181 186  
  187 +// Gera o código HTML
  188 +$pagina->MakeAll();
182 189 ?>
183   -<script>
184   -
185   -
  190 +<script type="text/javascript">
186 191 document.getElementById('ref_cod_escola').onchange = function()
187 192 {
188   - setMatVisibility();
189   - getEscolaCurso();
190   - var campoTurma = document.getElementById( 'ref_cod_turma' );
191   - getTurmaCurso();
  193 + setMatVisibility();
  194 + getEscolaCurso();
  195 + var campoTurma = document.getElementById('ref_cod_turma');
  196 + getTurmaCurso();
192 197 }
193 198  
194 199 document.getElementById('ref_cod_curso').onchange = function()
195 200 {
196   - getEscolaCursoSerie();
197   - getTurmaCurso();
198   -// verifica_curso();
  201 + getEscolaCursoSerie();
  202 + getTurmaCurso();
199 203 }
200 204  
201 205 document.getElementById('ano').onkeyup = function()
202 206 {
203   -
204   - setMatVisibility();
205   - getAluno();
  207 + setMatVisibility();
  208 + getAluno();
206 209 }
207 210  
208 211 document.getElementById('ref_ref_cod_serie').onchange = function()
209 212 {
  213 + var campoEscola = document.getElementById('ref_cod_escola').value;
  214 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
210 215  
211   - var campoEscola = document.getElementById( 'ref_cod_escola' ).value;
212   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
213   -
214   - var xml1 = new ajax(getTurma_XML);
215   - strURL = "educar_turma_xml.php?esc="+campoEscola+"&ser="+campoSerie;
216   - xml1.envia(strURL);
  216 + var xml1 = new ajax(getTurma_XML);
  217 + strURL = 'educar_turma_xml.php?esc=' + campoEscola + '&ser=' + campoSerie;
  218 + xml1.envia(strURL);
217 219 }
218 220  
219 221 function getTurma_XML(xml)
220 222 {
221   -
222   - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value;
223   -
224   - var campoTurma = document.getElementById( 'ref_cod_turma' );
225   -
226   - var turma = xml.getElementsByTagName( "turma" );
227   -
228   - campoTurma.length = 1;
229   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
230   - for ( var j = 0; j < turma.length; j++ )
231   - {
232   -
233   - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );
234   -
235   - }
236   - if ( campoTurma.length == 1 && campoSerie != '' ) {
237   - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false );
238   - }
239   -
240   - setMatVisibility();
241   -
  223 + var campoSerie = document.getElementById('ref_ref_cod_serie').value;
  224 + var campoTurma = document.getElementById('ref_cod_turma');
  225 + var turma = xml.getElementsByTagName('turma');
  226 +
  227 + campoTurma.length = 1;
  228 + campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
  229 + for (var j = 0; j < turma.length; j++) {
  230 + campoTurma.options[campoTurma.options.length] = new Option(
  231 + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false
  232 + );
  233 + }
  234 +
  235 + if (campoTurma.length == 1 && campoSerie != '') {
  236 + campoTurma.options[0] = new Option(
  237 + 'A série não possui nenhuma turma', '', false, false
  238 + );
  239 + }
  240 +
  241 + setMatVisibility();
242 242 }
243 243  
244 244 function getTurmaCurso()
245 245 {
246   - var campoCurso = document.getElementById('ref_cod_curso').value;
247   - var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
  246 + var campoCurso = document.getElementById('ref_cod_curso').value;
  247 + var campoInstituicao = document.getElementById('ref_cod_instituicao').value;
248 248  
249   - var xml1 = new ajax(getTurmaCurso_XML);
250   - strURL = "educar_turma_xml.php?ins="+campoInstituicao+"&cur="+campoCurso;
  249 + var xml1 = new ajax(getTurmaCurso_XML);
  250 + strURL = 'educar_turma_xml.php?ins=' + campoInstituicao + '&cur=' + campoCurso;
251 251  
252   - xml1.envia(strURL);
  252 + xml1.envia(strURL);
253 253 }
254 254  
255 255 function getTurmaCurso_XML(xml)
256 256 {
257   - var turma = xml.getElementsByTagName( "turma" );
258   - var campoTurma = document.getElementById( 'ref_cod_turma' );
259   - var campoCurso = document.getElementById('ref_cod_curso');
260   -
261   - campoTurma.length = 1;
262   - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false );
263   -
264   - for ( var j = 0; j < turma.length; j++ )
265   - {
  257 + var turma = xml.getElementsByTagName('turma');
  258 + var campoTurma = document.getElementById('ref_cod_turma');
  259 + var campoCurso = document.getElementById('ref_cod_curso');
266 260  
267   - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false );
  261 + campoTurma.length = 1;
  262 + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false);
268 263  
269   - }
  264 + for (var j = 0; j < turma.length; j++) {
  265 + campoTurma.options[campoTurma.options.length] = new Option(
  266 + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false
  267 + );
  268 + }
270 269  
271   - setMatVisibility();
  270 + setMatVisibility();
272 271 }
273 272  
274 273  
275 274 document.getElementById('ref_cod_turma').onchange = function()
276 275 {
277   - getAluno();
278   - var This = this;
279   - setMatVisibility();
  276 + getAluno();
  277 + var This = this;
  278 + setMatVisibility();
280 279  
281 280 }
282 281  
283 282 function setMatVisibility()
284 283 {
285   - var campoTurma = document.getElementById('ref_cod_turma');
286   - var campoAluno = document.getElementById('ref_cod_matricula');
287   -
288   - campoAluno.length = 1;
289   -
290   - if (campoTurma.value == '')
291   - {
292   - setVisibility('tr_ref_cod_matricula',false);
293   - setVisibility('ref_cod_matricula',false);
294   - }
295   - else
296   - {
297   - setVisibility('tr_ref_cod_matricula',true);
298   - setVisibility('ref_cod_matricula',true);
299   - }
  284 + var campoTurma = document.getElementById('ref_cod_turma');
  285 + var campoAluno = document.getElementById('ref_cod_matricula');
  286 +
  287 + campoAluno.length = 1;
  288 +
  289 + if (campoTurma.value == '') {
  290 + setVisibility('tr_ref_cod_matricula', false);
  291 + setVisibility('ref_cod_matricula', false);
  292 + }
  293 + else {
  294 + setVisibility('tr_ref_cod_matricula', true);
  295 + setVisibility('ref_cod_matricula', true);
  296 + }
300 297 }
301 298 function getAluno()
302 299 {
  300 + var campoTurma = document.getElementById('ref_cod_turma').value;
  301 + var campoAno = document.getElementById('ano').value;
303 302  
304   - var campoTurma = document.getElementById('ref_cod_turma').value;
305   - var campoAno = document.getElementById('ano').value;
  303 + var xml1 = new ajax(getAluno_XML);
  304 + strURL = 'educar_matricula_turma_xml.php?tur=' + campoTurma + '&ano=' + campoAno;
306 305  
307   - var xml1 = new ajax(getAluno_XML);
308   - strURL = "educar_matricula_turma_xml.php?tur="+campoTurma+"&ano="+campoAno;
309   -
310   - xml1.envia(strURL);
  306 + xml1.envia(strURL);
311 307 }
312 308  
313 309 function getAluno_XML(xml)
314 310 {
315   - var aluno = xml.getElementsByTagName( "matricula" );
316   - var campoTurma = document.getElementById( 'ref_cod_turma' );
317   - var campoAluno = document.getElementById('ref_cod_matricula');
318   -
319   - campoAluno.length = 1;
320   - //campoAluno.options[0] = new Option( 'Selecione uma Turma', '', false, false );
321   -
322   - for ( var j = 0; j < aluno.length; j++ )
323   - {
  311 + var aluno = xml.getElementsByTagName('matricula');
  312 + var campoTurma = document.getElementById('ref_cod_turma');
  313 + var campoAluno = document.getElementById('ref_cod_matricula');
324 314  
325   - campoAluno.options[campoAluno.options.length] = new Option( aluno[j].firstChild.nodeValue, aluno[j].getAttribute('cod_matricula'), false, false );
326   -
327   - }
  315 + campoAluno.length = 1;
328 316  
  317 + for (var j = 0; j < aluno.length; j++) {
  318 + campoAluno.options[campoAluno.options.length] = new Option(
  319 + aluno[j].firstChild.nodeValue, aluno[j].getAttribute('cod_matricula'), false, false
  320 + );
  321 + }
329 322 }
330 323  
  324 +setVisibility('tr_ref_cod_matricula', false);
  325 +
  326 +var func = function()
  327 +{
  328 + document.getElementById('btn_enviar').disabled= false;
  329 +};
331 330  
332   -setVisibility('tr_ref_cod_matricula',false);
333   -var func = function(){document.getElementById('btn_enviar').disabled= false;};
334 331 if( window.addEventListener ) {
335   - //mozilla
336   - document.getElementById('btn_enviar').addEventListener('click',func,false);
337   - } else if ( window.attachEvent ) {
338   - //ie
339   - document.getElementById('btn_enviar').attachEvent('onclick',func);
340   - }
  332 + // mozilla
  333 + document.getElementById('btn_enviar').addEventListener('click',func,false);
  334 +}
  335 +else if (window.attachEvent) {
  336 + // ie
  337 + document.getElementById('btn_enviar').attachEvent('onclick',func);
  338 +}
341 339  
342 340 function acao2()
343 341 {
344   - /*if ($F('is_padrao') == 0)
345   - {
346   - if (!$F('sem1') && !$F('sem2'))
347   - {
348   - alert("O campo 'Semestre' deve ser preenchido corretamente!");
349   - document.getElementById('sem1').focus();
350   - return;
351   - }
352   - }*/
353   - if(!acao())
354   - return;
355   -
356   - showExpansivelImprimir(400, 200,'',[], "Boletim");
  342 + if (!acao()) {
  343 + return;
  344 + }
357 345  
358   - document.formcadastro.target = 'miolo_'+(DOM_divs.length-1);
  346 + showExpansivelImprimir(400, 200, '', [], 'Boletim');
359 347  
360   - document.getElementById( 'btn_enviar' ).disabled =false;
  348 + document.formcadastro.target = 'miolo_' + (DOM_divs.length - 1);
361 349  
362   - document.formcadastro.submit();
  350 + document.getElementById('btn_enviar').disabled = false;
363 351  
  352 + document.formcadastro.submit();
364 353 }
365 354  
366 355 document.formcadastro.action = 'educar_relatorio_alunos_nota_semestre_proc.php';
367   -
368 356 </script>
369 357 \ No newline at end of file
... ...
ieducar/intranet/educar_relatorio_alunos_nota_semestre_proc.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/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 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 = "807";
39   - $this->renderMenu = false;
40   - $this->renderMenuSuspenso = false;
41   - }
  49 + function Formular()
  50 + {
  51 + $this->SetTitulo($this->_instituicao . ' i-Educar - Espelho de Notas Anual');
  52 + $this->processoAp = 807;
  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 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   -
62   - var $semestre;
63   - var $is_padrao;
64   -
65   - var $ano;
66   -
67   - var $cursos = array();
68   -
69   - var $get_link;
70   -
71   -
72   - function renderHTML()
73   - {
74   -
75   - @session_start();
76   - $this->pessoa_logada = $_SESSION['id_pessoa'];
77   - @session_write_close();
78   -
79   - if($_POST){
80   - foreach ($_POST as $key => $value) {
81   - $this->$key = $value;
82   -
83   - }
84   - }
85   -
86   - if($this->ref_ref_cod_serie)
87   - $this->ref_cod_serie = $this->ref_ref_cod_serie;
88   -
89   - $fonte = 'arial';
90   - $corTexto = '#000000';
91   -
92   - if(empty($this->ref_cod_turma))
93   - {
94   - echo '<script>
95   - alert("Erro ao gerar relatório!\nNenhuma turma selecionada!");
96   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
97   - </script>';
98   - return true;
99   - }
100   -
101   - if($this->ref_cod_escola){
102   -
103   - $obj_escola = new clsPmieducarEscola($this->ref_cod_escola);
104   - $det_escola = $obj_escola->detalhe();
105   - $this->nm_escola = $det_escola['nome'];
106   -
107   - $obj_instituicao = new clsPmieducarInstituicao($det_escola['ref_cod_instituicao']);
108   - $det_instituicao = $obj_instituicao->detalhe();
109   - $this->nm_instituicao = $det_instituicao['nm_instituicao'];
110   -
111   - }
112   -
113   - $obj_calendario = new clsPmieducarEscolaAnoLetivo();
114   - $lista_calendario = $obj_calendario->lista($this->ref_cod_escola,$this->ano,null,null,null,null,null,null,null,1,null);
115   -
116   - $obj_turma = new clsPmieducarTurma($this->ref_cod_turma);
117   - $det_turma = $obj_turma->detalhe();
118   - $this->nm_turma = $det_turma['nm_turma'];
119   -
120   - $obj_serie = new clsPmieducarSerie($this->ref_cod_serie);
121   - $det_serie = $obj_serie->detalhe();
122   - $this->nm_serie = $det_serie['nm_serie'];
123   -
124   - $obj_pessoa = new clsPessoa_($det_turma["ref_cod_regente"]);
125   - $det = $obj_pessoa->detalhe();
126   - $this->nm_professor = $det["nome"];
127   -
128   - if(!$lista_calendario)
129   - {
130   - echo '<script>
131   - alert("Escola não possui calendário definido para este ano");
132   - window.parent.fechaExpansivel(\'div_dinamico_\'+(window.parent.DOM_divs.length-1));
133   - </script>';
134   - return true;
135   - }
136   -
137   - $obj = new clsPmieducarSerie();
138   - $obj->setOrderby('cod_serie,etapa_curso');
139   - $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);
140   -
141   - $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
142   - $det_curso = $obj_curso->detalhe();
143   - $this->nm_curso = $det_curso['nm_curso'];
144   -
145   - $obj_tipo_avaliacao = new clsPmieducarTipoAvaliacao($det_curso['ref_cod_tipo_avaliacao']);
146   - $det_tipo_avaliacao = $obj_tipo_avaliacao->detalhe();
147   - $conceitual = $det_tipo_avaliacao['conceitual'];
148   -
149   - $obj_matricula_turma = new clsPmieducarMatriculaTurma();
150   - $obj_matricula_turma->setOrderby('nome_ascii');
151   - if (!$this->is_padrao && is_numeric($this->semestre) && $this->ano != 2007)
152   - $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, null, null, $this->semestre);
153   - else
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   -
156   - $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();
157   - $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,$this->ref_cod_escola,null,1);
158   - // Caso o curso siga o padrao da escola
159   - if ($det_curso["padrao_ano_escolar"])
160   - {
161   - $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
162   - $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista( $this->ano,$this->ref_cod_escola );
163   - if ( is_array($lst_ano_letivo_modulo) )
164   - {
165   - // guarda a qtd de modulos a serem cursados
166   - $qtd_modulos = count($lst_ano_letivo_modulo);
167   - /****************COLOCADO********************************/
168   - $segue_padrão = true;
169   - /****************COLOCADO********************************/
170   - }
171   - }// Caso o curso NÃO siga o padrao da escola
172   - else
173   - {
174   - $obj_turma_modulo = new clsPmieducarTurmaModulo();
175   - $lst_turma_modulo = $obj_turma_modulo->lista( $this->ref_cod_turma );
176   - if ( is_array($lst_turma_modulo) )
177   - {
178   - // guarda a qtd de modulos a serem cursados
179   - $qtd_modulos = count($lst_turma_modulo);
180   - /****************COLOCADO********************************/
181   - $aux_turma_modulo = array_shift($lst_turma_modulo);
182   - $obj_modulo = new clsPmieducarModulo($aux_turma_modulo["ref_cod_modulo"]);
183   - $det_modulo = $obj_modulo->detalhe();
184   - $nm_modulo = $det_modulo["nm_tipo"];
185   - $segue_padrão = false;
186   - $mostra_cabecalho = array();
187   - $nm_modulo = substr(strtoupper($nm_modulo), 0, 1);
188   - for ($i = 0; $i < $qtd_modulos; $i++) {
189   - $mostra_cabecalho[$i] = ($i+1)."º".$nm_modulo;
190   - }
191   - /****************COLOCADO********************************/
192   - }
193   - }
194   -
195   - if($lst_matricula_turma)
196   - {
197   -
198   - $relatorio = new relatorios("Espelho de Notas Ano - {$this->ano}", 210, false, "Espelho de Notas", "A4", "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma ".date("d/m/Y"));
199   - $relatorio->setMargem(20,20,20,20);
200   - $relatorio->exibe_produzido_por = false;
201   -
202   -
203   - //$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);
204   - //$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);
205   - //$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);
206   -
207   - $db = new clsBanco();
208   -
209   - if(!$conceitual)
210   - {
211   - $campo_nota = "COALESCE(nota,valor) ";
212   - }
213   - else
214   - {
215   - $campo_nota = "nome ";
216   - }
217   -
218   - foreach ($lst_disciplinas as $disciplina)
219   - {
220   - //$relatorio->novaPagina();
221   - //$relatorio->novaPagina();
222   -
223   - $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
224   - $det_disciplina = $obj_disciplina->detalhe();
225   -
226   - $relatorio->novalinha( array( "{$det_disciplina['nm_disciplina']}" ),0,16,true,"arial",array( 400 ),"#515151","#d3d3d3","#ffffff",false,true);
227   - /*******************COLOCADO***********************/
228   - if ($segue_padrão)
229   - {
230   - /*************DENTRO DO IF EH A IMPLEMENTACAO ORIGINAL*****DENTRO ELSE COLOCADO**********/
231   - if(!$conceitual)
232   - $array_val = array( "Cód. Aluno", "Nome do Aluno", "1ºB", "2ºB", "3ºB", "4ºB", "M.Parcial", "Exame", "M.Final", "Faltas");
233   - else
234   - $array_val = array( "Cód. Aluno", "Nome do Aluno", "1ºB", "2ºB", "3ºB", "4ºB", "", "", "", "Faltas");
235   - }
236   - else
237   - {
238   - if(!$conceitual)
239   - $array_val = array( "Cód. Aluno", "Nome do Aluno", $mostra_cabecalho[0], $mostra_cabecalho[1], $mostra_cabecalho[2], $mostra_cabecalho[3], "M.Parcial", "Exame", "M.Final", "Faltas");
240   - else
241   - $array_val = array( "Cód. Aluno", "Nome do Aluno", $mostra_cabecalho[0], $mostra_cabecalho[1], $mostra_cabecalho[2], $mostra_cabecalho[3], "", "", "", "Faltas");
242   - }
243   -// $relatorio->novalinha( $array_val,0,13,true,"arial",array( 60, 175, 30, 30, 30, 30, 55, 50, 50),"#515151","#d3d3d3","#ffffff",false,true);
244   - $relatorio->novalinha( $array_val,0,13,true,"arial",array( 40, 160, 30, 30, 30, 30, 55, 50, 50, 38),"#515151","#d3d3d3","#ffffff",false,true);
245   - foreach ($lst_matricula_turma as $matricula)
246   - {
247   -
248   -
249   - $consulta = "SELECT ref_cod_disciplina
250   - ,$campo_nota as nota
251   - ,modulo
252   - FROM pmieducar.nota_aluno
253   - LEFT OUTER JOIN
254   - pmieducar.tipo_avaliacao_valores
255   - ON ( ref_ref_cod_tipo_avaliacao = ref_cod_tipo_avaliacao
256   - AND ref_sequencial = sequencial )
257   - WHERE ref_cod_matricula = {$matricula['ref_cod_matricula']}
258   - AND ref_cod_escola = {$this->ref_cod_escola}
259   - AND ref_cod_serie = {$this->ref_cod_serie}
260   - AND ref_cod_disciplina = {$disciplina['ref_cod_disciplina']}
261   - AND nota_aluno.ativo = 1
262   - GROUP BY ref_cod_disciplina
263   - ,modulo
264   - ,$campo_nota
265   - ORDER BY modulo ASC ";
266   -
267   - $db->Consulta($consulta);
268   - $media_parcial = 0;
269   - $registro = null;
270   - $nota1 = '';
271   - $nota2 = '';
272   - $nota3 = '';
273   - $nota4 = '';
274   - $faltas = '';
275   - $nota_exame = '';
276   - $media_final = '';
277   -
278   -
279   - while ($db->ProximoRegistro())
280   - {
281   - $registro = $db->Tupla();
282   - $variavel = "nota{$registro['modulo']}";
283   - $$variavel = $conceitual ? $registro['nota'] : number_format( $registro['nota'] ,2,'.','');
284   - $ultimo_modulo = $registro['modulo'];
285   -
286   - if(!$conceitual)
287   - {
288   - $media_parcial = $media_parcial + $registro['nota'];
289   - /**
290   - * nota do exame
291   - */
292   - if($registro['modulo'] > $qtd_modulos)
293   - {
294   - $nota_exame = $conceitual ? '' : number_format( $registro['nota'] ,2,'.','');
295   - }
296   - else
297   - {
298   - $nota_exame = '';
299   - }
300   - }
301   - else
302   - $media_parcial = '';
303   - }
304   -
305   - if(!$conceitual)
306   - $media_parcial = number_format( $media_parcial / $ultimo_modulo,2,'.','');
307   -
308   - //exame ou total modulos
309   - if(($ultimo_modulo == $qtd_modulos || $ultimo_modulo - 1 == $qtd_modulos) && !$conceitual)
310   - {
311   - /**
312   - * calculo da media segue procedimento
313   - * normal com arredondamento etc..
314   - */
315   -
316   - $objNotaAluno = new clsPmieducarNotaAluno();
317   - if( $qtd_modulos == $ultimo_modulo )
318   - {
319   - if (!dbBool($det_serie["ultima_nota_define"]))
320   - {
321   -// $dsc=new clsPmieducarDisciplina($disciplina["ref_cod_disciplina"]);
322   -// $dsc=$dsc->detalhe();
323   -// echo "<pre>"; echo "<br><br><br>"; print_r($dsc); die();
324   - $media_final = $objNotaAluno->getMediaAluno($matricula['ref_cod_matricula'],$disciplina["ref_cod_disciplina"],$this->ref_cod_serie,$ultimo_modulo,$det_curso["media"]);
325   - }
326   - else
327   - {
328   - $media_final = $objNotaAluno->getUltimaNotaModulo($matricula["ref_cod_matricula"], $disciplina["ref_cod_disciplina"], $this->ref_cod_serie, $ultimo_modulo);
329   - }
330   - }
331   - else
332   - {
333   - $media_final = $objNotaAluno->getMediaAlunoExame($matricula["ref_cod_matricula"], $disciplina["ref_cod_disciplina"], $this->ref_cod_serie, $ultimo_modulo-1);
334   - }
335   - $media_final = number_format( $media_final ,2,'.','');
336   - }
337   - else
338   - {
339   - $media_final = $conceitual ? '' : '-';
340   - }
341   -
342   - $total_faltas = 0;
343   -
344   - if($det_curso['falta_ch_globalizada'])
345   - {
346   - $obj_falta = new clsPmieducarFaltas();
347   - $obj_falta->setOrderby("sequencial asc");
348   - $det_falta = $obj_falta->lista($matricula['ref_cod_matricula'],null,null,null,null,null);
349   -
350   - if(is_array($det_falta))
351   - {
352   - foreach ($det_falta as $key => $value)
353   - {
354   - $total_faltas += $det_falta[$key]['faltas'] = $value['falta'];
355   - }
356   -
357   - }
358   -
359   - }
360   - else
361   - {
362   - $obj_falta = new clsPmieducarFaltaAluno();
363   - $obj_falta->setOrderby("cod_falta_aluno asc");
364   - if($det_curso['padrao_ano_escolar'] == 1)
365   - $det_falta = $obj_falta->lista(null,null,null,$this->ref_cod_serie,$this->ref_cod_escola,$disciplina['ref_cod_disciplina'],$matricula['ref_cod_matricula'],null,null,null,null,null,1);
366   - else
367   - $det_falta = $obj_falta->lista(null,null,null,$this->ref_cod_serie,$this->ref_cod_escola,null,$matricula['ref_cod_matricula'],null,null,null,null,null,1,null,$disciplina['ref_cod_disciplina']);
368   -
369   - if(is_array($det_falta))
370   - {
371   - foreach ($det_falta as $key => $value)
372   - {
373   - $total_faltas += $det_falta[$key]['faltas'];
374   - }
375   - }
376   - }
377   -
378   - //$obj_matricula = new clsPmieducarMatricula();
379   - //$det_matricula = $obj_matricula->lista($matricula['ref_cod_matricula'], null, $this->ref_cod_escola, $this->ref_cod_serie, null, null, null, null);
380   - //$det_matricula = array_shift($det_matricula);
381   - if( strlen( $matricula['nome'] ) > 30 )
382   - {
383   - $matricula['nome'] = explode(" ",$matricula['nome']);
384   - if(is_array($matricula['nome'] ))
385   - {
386   - $nome_aluno = array_shift($matricula['nome']);
387   - }
388   - if(is_array($matricula['nome'] ))
389   - {
390   - $nome_aluno .= " ".array_shift($matricula['nome']);
391   - }
392   - if(is_array($matricula['nome'] ))
393   - {
394   - $nome_aluno .= " ".array_pop($matricula['nome']);
395   - }
396   - $matricula['nome'] = $nome_aluno;
397   - }
398   -
399   -// $relatorio->novalinha( array( "{$matricula['ref_cod_aluno']}", "{$matricula['nome']}", "{$nota1}", "{$nota2}", "{$nota3}", "{$nota4}", "{$media_parcial}", "{$nota_exame}", "{$media_final}", "{$total_faltas}"),0,12,false,"arial",array( 60, 175, 30, 30, 30, 40, 55, 50, 55),"#515151","#d3d3d3","#FFFFFF",false,true);
400   - if ($segue_padrão || !$conceitual)
401   - {
402   - $relatorio->novalinha( array( "{$matricula['ref_cod_aluno']}", "{$matricula['nome']}", "{$nota1}", "{$nota2}", "{$nota3}", "{$nota4}", "{$media_parcial}", "{$nota_exame}", "{$media_final}", "{$total_faltas}"),0,12,false,"arial",array( 35, 165, 30, 30, 30, 40, 55, 50, 55),"#515151","#d3d3d3","#FFFFFF",false,true);
403   - }
404   - else
405   - {
406   - $obj_matricula = new clsPmieducarMatricula($matricula["ref_cod_matricula"]);
407   - $situacao = $obj_matricula->detalhe();
408   - $situacao = $situacao["aprovado"];
409   - if ($situacao == 1)
410   - $situacao = "Apr.";
411   - elseif ($situacao == 2)
412   - $situacao = "Repr;";
413   - elseif ($situacao == 3)
414   - $situacao = "And.";
415   - $relatorio->novalinha( array( "{$matricula['ref_cod_aluno']}", "{$matricula['nome']}", "{$nota1}", "{$nota2}", "{$nota3}", "{$nota4}", "{$media_parcial}", "{$nota_exame}", "{$media_final}", "{$total_faltas}", $situacao),0,12,false,"arial",array( 40, 160, 30, 30, 30, 30, 55, 50, 50, 38),"#515151","#d3d3d3","#FFFFFF",false,true);
416   - }
417   - }
418   -
419   - //$relatorio->fillText();
420   - //$relatorio->fechaPagina();
421   - $relatorio->quebraPagina();
422   - }
423   -
424   - $this->get_link = $relatorio->fechaPdf();
425   - }
426   -
427   -
428   - echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=".$this->get_link."'}</script>";
429   -
430   - 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>
431   - <span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
432   -
433   - Clique na Imagem para Baixar o instalador<br><br>
434   - <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>
435   - </span>
436   - </center>";
437   - }
438   -
439   -
440   - function Editar()
441   - {
442   - return false;
443   - }
444   -
445   - function Excluir()
446   - {
447   - return false;
448   - }
  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 +
  78 + var $semestre;
  79 + var $is_padrao;
  80 +
  81 + var $ano;
  82 +
  83 + var $cursos = array();
  84 +
  85 + var $get_link;
  86 +
  87 + function renderHTML()
  88 + {
  89 + @session_start();
  90 + $this->pessoa_logada = $_SESSION['id_pessoa'];
  91 + @session_write_close();
  92 +
  93 + if ($_POST){
  94 + foreach ($_POST as $key => $value) {
  95 + $this->$key = $value;
  96 + }
  97 + }
  98 +
  99 + if ($this->ref_ref_cod_serie) {
  100 + $this->ref_cod_serie = $this->ref_ref_cod_serie;
  101 + }
  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 + $obj_matricula_turma = new clsPmieducarMatriculaTurma();
  164 + $obj_matricula_turma->setOrderby('nome_ascii');
  165 +
  166 + if (!$this->is_padrao && is_numeric($this->semestre) && $this->ano != 2007) {
  167 + $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula,
  168 + $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie,
  169 + $this->ref_cod_curso, $this->ref_cod_escola, $this->ref_cod_instituicao,
  170 + NULL, NULL, array(1,2,3), NULL, NULL, $this->ano, NULL, NULL, NULL, NULL,
  171 + TRUE, NULL, NULL, NULL, NULL, $this->semestre);
  172 + }
  173 + else {
  174 + $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula,
  175 + $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie,
  176 + $this->ref_cod_curso, $this->ref_cod_escola, $this->ref_cod_instituicao,
  177 + NULL, NULL, array(1,2,3), NULL, NULL, $this->ano, NULL, NULL, NULL, NULL, TRUE);
  178 + }
  179 +
  180 + $obj_disciplinas = new clsPmieducarEscolaSerieDisciplina();
  181 + $lst_disciplinas = $obj_disciplinas->lista($this->ref_cod_serie,
  182 + $this->ref_cod_escola, NULL, 1);
  183 +
  184 + // Caso o curso siga o padrão da escola
  185 + if ($det_curso["padrao_ano_escolar"]) {
  186 + $obj_ano_letivo_modulo = new clsPmieducarAnoLetivoModulo();
  187 + $lst_ano_letivo_modulo = $obj_ano_letivo_modulo->lista($this->ano, $this->ref_cod_escola);
  188 +
  189 + if (is_array($lst_ano_letivo_modulo)) {
  190 + // Guarda a qtd de módulos a serem cursados
  191 + $qtd_modulos = count($lst_ano_letivo_modulo);
  192 + $segue_padrão = TRUE;
  193 + }
  194 + }
  195 + // Caso o curso não siga o padrão da escola
  196 + else {
  197 + $obj_turma_modulo = new clsPmieducarTurmaModulo();
  198 + $lst_turma_modulo = $obj_turma_modulo->lista($this->ref_cod_turma);
  199 +
  200 + if (is_array($lst_turma_modulo)) {
  201 + // Guarda a qtd de módulos a serem cursados
  202 + $qtd_modulos = count($lst_turma_modulo);
  203 +
  204 + $aux_turma_modulo = array_shift($lst_turma_modulo);
  205 + $obj_modulo = new clsPmieducarModulo($aux_turma_modulo['ref_cod_modulo']);
  206 + $det_modulo = $obj_modulo->detalhe();
  207 + $nm_modulo = $det_modulo['nm_tipo'];
  208 + $segue_padrão = FALSE;
  209 + $mostra_cabecalho = array();
  210 + $nm_modulo = substr(strtoupper($nm_modulo), 0, 1);
  211 +
  212 + for ($i = 0; $i < $qtd_modulos; $i++) {
  213 + $mostra_cabecalho[$i] = ($i + 1) . 'º' . $nm_modulo;
  214 + }
  215 + }
  216 + }
  217 +
  218 + if ($lst_matricula_turma) {
  219 + $relatorio = new relatorios('Espelho de Notas Ano - ' . $this->ano, 210,
  220 + FALSE, 'Espelho de Notas', 'A4',
  221 + "{$this->nm_instituicao}\n{$this->nm_escola}\n{$this->nm_curso}\n{$this->nm_serie} - Turma: $this->nm_turma " . date('d/m/Y'));
  222 +
  223 + $relatorio->setMargem(20, 20, 20, 20);
  224 + $relatorio->exibe_produzido_por = FALSE;
  225 +
  226 + $db = new clsBanco();
  227 +
  228 + if (!$conceitual) {
  229 + $campo_nota = 'COALESCE(nota,valor) ';
  230 + }
  231 + else {
  232 + $campo_nota = 'nome ';
  233 + }
  234 +
  235 + foreach ($lst_disciplinas as $disciplina) {
  236 + $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
  237 + $det_disciplina = $obj_disciplina->detalhe();
  238 +
  239 + $relatorio->novalinha(array($det_disciplina['nm_disciplina']), 0, 16,
  240 + TRUE, 'arial', array(400), '#515151', '#D3D3D3', '#FFFFFF', FALSE, TRUE);
  241 +
  242 + if ($segue_padrão) {
  243 + if (!$conceitual) {
  244 + $array_val = array('Cód. Aluno', 'Nome do Aluno', '1ºB', '2ºB', '3ºB',
  245 + '4ºB', 'M.Parcial', 'Exame', 'M.Final', 'Faltas');
  246 + }
  247 + else {
  248 + $array_val = array('Cód. Aluno', 'Nome do Aluno', '1ºB', '2ºB', '3ºB',
  249 + '4ºB', '', '', '', 'Faltas');
  250 + }
  251 + }
  252 + else {
  253 + if (!$conceitual) {
  254 + $array_val = array('Cód. Aluno', 'Nome do Aluno', $mostra_cabecalho[0],
  255 + $mostra_cabecalho[1], $mostra_cabecalho[2], $mostra_cabecalho[3],
  256 + 'M.Parcial', 'Exame', 'M.Final', 'Faltas');
  257 + }
  258 + else {
  259 + $array_val = array('Cód. Aluno', 'Nome do Aluno', $mostra_cabecalho[0],
  260 + $mostra_cabecalho[1], $mostra_cabecalho[2], $mostra_cabecalho[3],
  261 + '', '', '', 'Faltas');
  262 + }
  263 + }
  264 +
  265 + $relatorio->novalinha($array_val, 0, 13, TRUE, 'arial',
  266 + array(40, 160, 30, 30, 30, 30, 55, 50, 50, 38), '#515151', '#D3D3D3',
  267 + '#FFFFFF', FALSE, TRUE);
  268 +
  269 + foreach ($lst_matricula_turma as $matricula) {
  270 + $consulta = "
  271 + SELECT
  272 + ref_cod_disciplina,
  273 + $campo_nota AS nota,
  274 + modulo
  275 + FROM
  276 + pmieducar.nota_aluno
  277 + LEFT OUTER JOIN
  278 + pmieducar.tipo_avaliacao_valores
  279 + ON
  280 + (
  281 + ref_ref_cod_tipo_avaliacao = ref_cod_tipo_avaliacao
  282 + AND ref_sequencial = sequencial
  283 + )
  284 + WHERE
  285 + ref_cod_matricula = {$matricula['ref_cod_matricula']}
  286 + AND ref_cod_escola = {$this->ref_cod_escola}
  287 + AND ref_cod_serie = {$this->ref_cod_serie}
  288 + AND ref_cod_disciplina = {$disciplina['ref_cod_disciplina']}
  289 + AND nota_aluno.ativo = 1
  290 + GROUP BY
  291 + ref_cod_disciplina,
  292 + modulo,
  293 + $campo_nota
  294 + ORDER BY
  295 + modulo ASC";
  296 +
  297 + $db->Consulta($consulta);
  298 +
  299 + $media_parcial = 0;
  300 + $registro = NULL;
  301 + $nota1 = '';
  302 + $nota2 = '';
  303 + $nota3 = '';
  304 + $nota4 = '';
  305 + $faltas = '';
  306 + $nota_exame = '';
  307 + $media_final = '';
  308 +
  309 + while ($db->ProximoRegistro()) {
  310 + $registro = $db->Tupla();
  311 + $variavel = "nota{$registro['modulo']}";
  312 + $$variavel = $conceitual ? $registro['nota'] : number_format( $registro['nota'] ,2,'.','');
  313 + $ultimo_modulo = $registro['modulo'];
  314 +
  315 + if (!$conceitual) {
  316 + $media_parcial = $media_parcial + $registro['nota'];
  317 + /**
  318 + * nota do exame
  319 + */
  320 + if ($registro['modulo'] > $qtd_modulos) {
  321 + $nota_exame = $conceitual ? '' : number_format($registro['nota'] ,2, '.', '');
  322 + }
  323 + else {
  324 + $nota_exame = '';
  325 + }
  326 + }
  327 + else {
  328 + $media_parcial = '';
  329 + }
  330 + }
  331 +
  332 + if (!$conceitual) {
  333 + $media_parcial = number_format($media_parcial / $ultimo_modulo, 2, '.', '');
  334 + }
  335 +
  336 + //exame ou total modulos
  337 + if (($ultimo_modulo == $qtd_modulos || $ultimo_modulo - 1 == $qtd_modulos) && !$conceitual) {
  338 + $objNotaAluno = new clsPmieducarNotaAluno();
  339 +
  340 + if ($qtd_modulos == $ultimo_modulo) {
  341 + if (!dbBool($det_serie['ultima_nota_define'])) {
  342 + $media_final = $objNotaAluno->getMediaAluno(
  343 + $matricula['ref_cod_matricula'], $disciplina['ref_cod_disciplina'],
  344 + $this->ref_cod_serie, $ultimo_modulo, $det_curso['media']
  345 + );
  346 + }
  347 + else {
  348 + $media_final = $objNotaAluno->getUltimaNotaModulo(
  349 + $matricula['ref_cod_matricula'], $disciplina['ref_cod_disciplina'],
  350 + $this->ref_cod_serie, $ultimo_modulo
  351 + );
  352 + }
  353 + }
  354 + else {
  355 + $media_final = $objNotaAluno->getMediaAlunoExame(
  356 + $matricula['ref_cod_matricula'], $disciplina['ref_cod_disciplina'],
  357 + $this->ref_cod_serie, $ultimo_modulo - 1
  358 + );
  359 + }
  360 +
  361 + $media_final = number_format($media_final, 2, '.', '');
  362 + }
  363 + else {
  364 + $media_final = $conceitual ? '' : '-';
  365 + }
  366 +
  367 + $total_faltas = 0;
  368 +
  369 + if ($det_curso['falta_ch_globalizada']) {
  370 + $obj_falta = new clsPmieducarFaltas();
  371 + $obj_falta->setOrderby('sequencial ASC');
  372 + $det_falta = $obj_falta->lista($matricula['ref_cod_matricula'], NULL,
  373 + NULL, NULL, NULL, NULL);
  374 +
  375 + if (is_array($det_falta)) {
  376 + foreach ($det_falta as $key => $value) {
  377 + $total_faltas += $det_falta[$key]['faltas'] = $value['falta'];
  378 + }
  379 + }
  380 + }
  381 + else {
  382 + $obj_falta = new clsPmieducarFaltaAluno();
  383 + $obj_falta->setOrderby("cod_falta_aluno asc");
  384 +
  385 + if ($det_curso['padrao_ano_escolar'] == 1) {
  386 + $det_falta = $obj_falta->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  387 + $this->ref_cod_escola, $disciplina['ref_cod_disciplina'],
  388 + $matricula['ref_cod_matricula'], NULL, NULL, NULL, NULL, NULL, 1);
  389 + }
  390 + else {
  391 + $det_falta = $obj_falta->lista(NULL, NULL, NULL, $this->ref_cod_serie,
  392 + $this->ref_cod_escola, NULL, $matricula['ref_cod_matricula'],
  393 + NULL, NULL, NULL, NULL, NULL, 1, NULL, $disciplina['ref_cod_disciplina']);
  394 + }
  395 +
  396 + if (is_array($det_falta)) {
  397 + foreach ($det_falta as $key => $value) {
  398 + $total_faltas += $det_falta[$key]['faltas'];
  399 + }
  400 + }
  401 + }
  402 +
  403 + if (strlen($matricula['nome']) > 30) {
  404 + $matricula['nome'] = explode(' ', $matricula['nome']);
  405 +
  406 + if (is_array($matricula['nome'])) {
  407 + $nome_aluno = array_shift($matricula['nome']);
  408 + }
  409 +
  410 + if (is_array($matricula['nome'])) {
  411 + $nome_aluno .= ' ' . array_shift($matricula['nome']);
  412 + }
  413 +
  414 + if (is_array($matricula['nome'])) {
  415 + $nome_aluno .= ' ' . array_pop($matricula['nome']);
  416 + }
  417 +
  418 + $matricula['nome'] = $nome_aluno;
  419 + }
  420 +
  421 + if ($segue_padrão || !$conceitual) {
  422 + $relatorio->novalinha(array($matricula['ref_cod_aluno'], $matricula['nome'],
  423 + $nota1, $nota2, $nota3, $nota4, $media_parcial, $nota_exame,
  424 + $media_final, $total_faltas), 0, 12, FALSE, 'arial',
  425 + array(35, 165, 30, 30, 30, 40, 55, 50, 55), '#515151', '#D3D3D3',
  426 + '#FFFFFF', FALSE, TRUE);
  427 + }
  428 + else {
  429 + $obj_matricula = new clsPmieducarMatricula($matricula["ref_cod_matricula"]);
  430 + $situacao = $obj_matricula->detalhe();
  431 + $situacao = $situacao["aprovado"];
  432 +
  433 + if ($situacao == 1) {
  434 + $situacao = 'Apr.';
  435 + }
  436 + elseif ($situacao == 2) {
  437 + $situacao = 'Repr;';
  438 + }
  439 + elseif ($situacao == 3) {
  440 + $situacao = 'And.';
  441 + }
  442 +
  443 + $relatorio->novalinha(array($matricula['ref_cod_aluno'], $matricula['nome'],
  444 + $nota1, $nota2, $nota3, $nota4, $media_parcial, $nota_exame, $media_final,
  445 + $total_faltas, $situacao), 0, 12, FALSE, 'arial',
  446 + array(40, 160, 30, 30, 30, 30, 55, 50, 50, 38), '#515151', '#D3D3D3',
  447 + '#FFFFFF', FALSE, TRUE);
  448 + }
  449 + }
  450 +
  451 + $relatorio->quebraPagina();
  452 + }
  453 +
  454 + $this->get_link = $relatorio->fechaPdf();
  455 + }
  456 +
  457 + echo sprintf('
  458 + <script>
  459 + window.onload=function()
  460 + {
  461 + parent.EscondeDiv("LoadImprimir");
  462 + window.location="download.php?filename=%s"
  463 + }
  464 + </script>', $this->get_link);
  465 +
  466 + echo sprintf('
  467 + <html>
  468 + <center>
  469 + Se o download não iniciar automaticamente <br>
  470 + <a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br>
  471 + <span style="font-size: 10px;">
  472 + Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
  473 + Clique na Imagem para Baixar o instalador<br><br>
  474 + <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>
  475 + </span>
  476 + </center>
  477 + </html>', $this->get_link);
  478 + }
  479 +
  480 +
  481 + function Editar()
  482 + {
  483 + return false;
  484 + }
  485 +
  486 + function Excluir()
  487 + {
  488 + return false;
  489 + }
449 490  
450 491 }
451 492  
452   -// cria uma extensao da classe base
  493 +// Instancia objeto de página
453 494 $pagina = new clsIndexBase();
454   -// cria o conteudo
  495 +
  496 +// Instancia objeto de conteúdo
455 497 $miolo = new indice();
456   -// adiciona o conteudo na clsBase
457   -$pagina->addForm( $miolo );
458   -// gera o html
459   -$pagina->MakeAll();
460 498  
  499 +// Atribui o conteúdo à página
  500 +$pagina->addForm($miolo);
461 501  
462   -?>
  502 +// Gera o código HTML
  503 +$pagina->MakeAll();
463 504 \ No newline at end of file
... ...