Commit c92c7f8c97d5bf7b822fd19bb2c97a3d9778f073
1 parent
a99b3ceb
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
330 additions
and
351 deletions
Show diff stats
ieducar/intranet/educar_relatorio_boletim.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 - Boletim" ); | ||
38 | - $this->processoAp = "664"; | ||
39 | - } | 49 | + function Formular() |
50 | + { | ||
51 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Boletim'); | ||
52 | + $this->processoAp = 664; | ||
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Ç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(!$nivel_usuario) | ||
127 | - //header("location: index.php"); | ||
128 | - | ||
129 | - if($_POST){ | ||
130 | - foreach ($_POST as $key => $value) { | ||
131 | - $this->$key = $value; | ||
132 | - | ||
133 | - } | ||
134 | - } | ||
135 | - | ||
136 | - $this->ano = $ano_atual = date("Y"); | ||
137 | - $this->mes = $mes_atual = date("n"); | ||
138 | - /* | ||
139 | - $lim = 5; | ||
140 | - for($a = date('Y') ; $a < $ano_atual + $lim ; $a++ ) | ||
141 | - $anos["{$a}"] = "{$a}"; | ||
142 | - | ||
143 | - $this->campoLista( "ano", "Ano",$anos, $this->ano,"",false ); | ||
144 | - */ | ||
145 | - $this->campoNumero( "ano", "Ano", $this->ano, 4, 4, true ); | ||
146 | - | ||
147 | - $this->campoCheck("em_branco","Relatório em branco",""); | ||
148 | - $this->campoNumero("numero_registros","Número de linhas","",3,3); | ||
149 | - | ||
150 | - //$this->campoLista( "mes", "Mês",$this->meses_do_ano, $this->mes,"",false ); | ||
151 | - | ||
152 | - $get_escola = true; | ||
153 | - //$obrigatorio = true; | ||
154 | - $exibe_nm_escola = true; | ||
155 | -// $get_escola_curso = true; | ||
156 | - $get_curso = true; | ||
157 | - $get_escola_curso_serie = true; | ||
158 | - $escola_obrigatorio = false; | ||
159 | - $curso_obrigatorio = false; | ||
160 | - $instituicao_obrigatorio = true; | ||
161 | - | ||
162 | - include("include/pmieducar/educar_campo_lista.php"); | ||
163 | - | ||
164 | - $this->campoLista("ref_cod_turma","Turma",array('' => 'Selecione'),'',"",false,"","",false,false); | ||
165 | - | ||
166 | - if($this->ref_cod_escola) | ||
167 | - $this->ref_ref_cod_escola = $this->ref_cod_escola; | ||
168 | - $this->campoLista( "ref_cod_matricula", "Aluno",array(''=>'Selecione'), "","",false,"Campo não obrigatório","",false,false ); | ||
169 | - if($this->get_link) | ||
170 | - $this->campoRotulo("rotulo11", "-", "<a href='$this->get_link' target='_blank'>Baixar Relatório</a>"); | ||
171 | - | ||
172 | - $this->url_cancelar = "educar_index.php"; | ||
173 | - $this->nome_url_cancelar = "Cancelar"; | ||
174 | - | ||
175 | - $this->acao_enviar = 'acao2()'; | ||
176 | - $this->acao_executa_submit = false; | ||
177 | - | ||
178 | - } | ||
179 | - | 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 | + $this->campoCheck('em_branco', 'Relatório em branco', ''); | ||
149 | + $this->campoNumero('numero_registros', 'Número de linhas', '', 3, 3); | ||
150 | + | ||
151 | + $get_escola = TRUE; | ||
152 | + $exibe_nm_escola = TRUE; | ||
153 | + $get_curso = TRUE; | ||
154 | + $get_escola_curso_serie = TRUE; | ||
155 | + $escola_obrigatorio = FALSE; | ||
156 | + $curso_obrigatorio = FALSE; | ||
157 | + $instituicao_obrigatorio = TRUE; | ||
158 | + | ||
159 | + include 'include/pmieducar/educar_campo_lista.php'; | ||
160 | + | ||
161 | + $this->campoLista('ref_cod_turma', 'Turma', array('' => 'Selecione'), '', '', | ||
162 | + FALSE, '', '', FALSE, FALSE); | ||
163 | + | ||
164 | + if ($this->ref_cod_escola) { | ||
165 | + $this->ref_ref_cod_escola = $this->ref_cod_escola; | ||
166 | + } | ||
167 | + | ||
168 | + $this->campoLista('ref_cod_matricula', 'Aluno', array('' => 'Selecione'), '', | ||
169 | + '', FALSE, 'Campo não obrigatório', '', FALSE, FALSE); | ||
170 | + | ||
171 | + if ($this->get_link) { | ||
172 | + $this->campoRotulo('rotulo11', '-', sprintf('<a href="%s" target="_blank">Baixar Relatório</a>', $this->get_link)); | ||
173 | + } | ||
174 | + | ||
175 | + $this->url_cancelar = 'educar_index.php'; | ||
176 | + $this->nome_url_cancelar = 'Cancelar'; | ||
177 | + | ||
178 | + $this->acao_enviar = 'acao2()'; | ||
179 | + $this->acao_executa_submit = FALSE; | ||
180 | + } | ||
180 | } | 181 | } |
181 | 182 | ||
182 | -// cria uma extensao da classe base | 183 | +// Instancia objeto de página |
183 | $pagina = new clsIndexBase(); | 184 | $pagina = new clsIndexBase(); |
184 | -// cria o conteudo | 185 | + |
186 | +// Instancia objeto de conteúdo | ||
185 | $miolo = new indice(); | 187 | $miolo = new indice(); |
186 | -// adiciona o conteudo na clsBase | ||
187 | -$pagina->addForm( $miolo ); | ||
188 | -// gera o html | ||
189 | -$pagina->MakeAll(); | ||
190 | 188 | ||
189 | +// Atribui o conteúdo à página | ||
190 | +$pagina->addForm($miolo); | ||
191 | 191 | ||
192 | +// Gera o código HTML | ||
193 | +$pagina->MakeAll(); | ||
192 | ?> | 194 | ?> |
193 | -<script> | ||
194 | - | ||
195 | - | 195 | +<script type="text/javascript"> |
196 | document.getElementById('ref_cod_escola').onchange = function() | 196 | document.getElementById('ref_cod_escola').onchange = function() |
197 | { | 197 | { |
198 | - setMatVisibility(); | ||
199 | - getEscolaCurso(); | ||
200 | - var campoTurma = document.getElementById( 'ref_cod_turma' ); | ||
201 | - getTurmaCurso(); | 198 | + setMatVisibility(); |
199 | + getEscolaCurso(); | ||
200 | + var campoTurma = document.getElementById('ref_cod_turma'); | ||
201 | + getTurmaCurso(); | ||
202 | } | 202 | } |
203 | 203 | ||
204 | document.getElementById('ref_cod_curso').onchange = function() | 204 | document.getElementById('ref_cod_curso').onchange = function() |
205 | { | 205 | { |
206 | - | ||
207 | - getEscolaCursoSerie(); | ||
208 | - getTurmaCurso(); | 206 | + getEscolaCursoSerie(); |
207 | + getTurmaCurso(); | ||
209 | } | 208 | } |
210 | 209 | ||
211 | document.getElementById('ano').onkeyup = function() | 210 | document.getElementById('ano').onkeyup = function() |
212 | { | 211 | { |
213 | - | ||
214 | - setMatVisibility(); | ||
215 | - getAluno(); | 212 | + setMatVisibility(); |
213 | + getAluno(); | ||
216 | } | 214 | } |
217 | 215 | ||
218 | document.getElementById('ref_ref_cod_serie').onchange = function() | 216 | document.getElementById('ref_ref_cod_serie').onchange = function() |
219 | { | 217 | { |
218 | + var campoEscola = document.getElementById('ref_cod_escola').value; | ||
219 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | ||
220 | 220 | ||
221 | - var campoEscola = document.getElementById( 'ref_cod_escola' ).value; | ||
222 | - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value; | ||
223 | - | ||
224 | - var xml1 = new ajax(getTurma_XML); | ||
225 | - strURL = "educar_turma_xml.php?esc="+campoEscola+"&ser="+campoSerie; | ||
226 | - xml1.envia(strURL); | 221 | + var xml1 = new ajax(getTurma_XML); |
222 | + strURL = 'educar_turma_xml.php?esc=' + campoEscola + '&ser=' + campoSerie; | ||
223 | + xml1.envia(strURL); | ||
227 | } | 224 | } |
228 | 225 | ||
229 | function getTurma_XML(xml) | 226 | function getTurma_XML(xml) |
230 | { | 227 | { |
228 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | ||
229 | + var campoTurma = document.getElementById('ref_cod_turma'); | ||
230 | + var turma = xml.getElementsByTagName('turma'); | ||
231 | 231 | ||
232 | + campoTurma.length = 1; | ||
233 | + campoTurma.options[0] = new Option('Selecione uma Turma', '', false, false); | ||
232 | 234 | ||
233 | - var campoSerie = document.getElementById( 'ref_ref_cod_serie' ).value; | ||
234 | - | ||
235 | - var campoTurma = document.getElementById( 'ref_cod_turma' ); | ||
236 | - | ||
237 | - var turma = xml.getElementsByTagName( "turma" ); | ||
238 | - | ||
239 | - campoTurma.length = 1; | ||
240 | - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false ); | ||
241 | - for ( var j = 0; j < turma.length; j++ ) | ||
242 | - { | 235 | + for (var j = 0; j < turma.length; j++) { |
236 | + campoTurma.options[campoTurma.options.length] = new Option( | ||
237 | + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false | ||
238 | + ); | ||
239 | + } | ||
243 | 240 | ||
244 | - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false ); | ||
245 | - | ||
246 | - } | ||
247 | - if ( campoTurma.length == 1 && campoSerie != '' ) { | ||
248 | - campoTurma.options[0] = new Option( 'A série não possui nenhuma turma', '', false, false ); | ||
249 | - } | ||
250 | - | ||
251 | - setMatVisibility(); | 241 | + if (campoTurma.length == 1 && campoSerie != '') { |
242 | + campoTurma.options[0] = new Option('A série não possui nenhuma turma', '', false, false); | ||
243 | + } | ||
252 | 244 | ||
245 | + setMatVisibility(); | ||
253 | } | 246 | } |
254 | 247 | ||
255 | function getTurmaCurso() | 248 | function getTurmaCurso() |
256 | { | 249 | { |
257 | - var campoCurso = document.getElementById('ref_cod_curso').value; | ||
258 | - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | 250 | + var campoCurso = document.getElementById('ref_cod_curso').value; |
251 | + var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | ||
259 | 252 | ||
260 | - var xml1 = new ajax(getTurmaCurso_XML); | ||
261 | - strURL = "educar_turma_xml.php?ins="+campoInstituicao+"&cur="+campoCurso; | 253 | + var xml1 = new ajax(getTurmaCurso_XML); |
254 | + strURL = 'educar_turma_xml.php?ins=' + campoInstituicao + '&cur=' + campoCurso; | ||
262 | 255 | ||
263 | - xml1.envia(strURL); | 256 | + xml1.envia(strURL); |
264 | } | 257 | } |
265 | 258 | ||
266 | function getTurmaCurso_XML(xml) | 259 | function getTurmaCurso_XML(xml) |
267 | { | 260 | { |
268 | - var turma = xml.getElementsByTagName( "turma" ); | ||
269 | - var campoTurma = document.getElementById( 'ref_cod_turma' ); | ||
270 | - var campoCurso = document.getElementById('ref_cod_curso'); | 261 | + var turma = xml.getElementsByTagName('turma'); |
262 | + var campoTurma = document.getElementById('ref_cod_turma'); | ||
263 | + var campoCurso = document.getElementById('ref_cod_curso'); | ||
271 | 264 | ||
272 | - campoTurma.length = 1; | ||
273 | - campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false ); | 265 | + campoTurma.length = 1; |
266 | + campoTurma.options[0] = new Option( 'Selecione uma Turma', '', false, false ); | ||
274 | 267 | ||
275 | - for ( var j = 0; j < turma.length; j++ ) | ||
276 | - { | 268 | + for (var j = 0; j < turma.length; j++) { |
269 | + campoTurma.options[campoTurma.options.length] = new Option( | ||
270 | + turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false | ||
271 | + ); | ||
272 | + } | ||
277 | 273 | ||
278 | - campoTurma.options[campoTurma.options.length] = new Option( turma[j].firstChild.nodeValue, turma[j].getAttribute('cod_turma'), false, false ); | ||
279 | - | ||
280 | - } | ||
281 | - /*if ( campoTurma.length == 1 && campoCurso != '' ) { | ||
282 | - campoTurma.options[0] = new Option( 'O curso não possui nenhuma turma', '', false, false ); | ||
283 | - }*/ | ||
284 | - setMatVisibility(); | 274 | + setMatVisibility(); |
285 | } | 275 | } |
286 | 276 | ||
287 | 277 | ||
288 | document.getElementById('ref_cod_turma').onchange = function() | 278 | document.getElementById('ref_cod_turma').onchange = function() |
289 | { | 279 | { |
290 | - getAluno(); | ||
291 | - var This = this; | ||
292 | - setMatVisibility(); | 280 | + getAluno(); |
281 | + var This = this; | ||
282 | + setMatVisibility(); | ||
293 | 283 | ||
294 | } | 284 | } |
295 | 285 | ||
296 | function setMatVisibility() | 286 | function setMatVisibility() |
297 | { | 287 | { |
298 | - var campoTurma = document.getElementById('ref_cod_turma'); | ||
299 | - var campoAluno = document.getElementById('ref_cod_matricula'); | ||
300 | - | ||
301 | - campoAluno.length = 1; | ||
302 | - | ||
303 | - if (campoTurma.value == '') | ||
304 | - { | ||
305 | - setVisibility('tr_ref_cod_matricula',false); | ||
306 | - setVisibility('ref_cod_matricula',false); | ||
307 | - } | ||
308 | - else | ||
309 | - { | ||
310 | - setVisibility('tr_ref_cod_matricula',true); | ||
311 | - setVisibility('ref_cod_matricula',true); | ||
312 | - } | 288 | + var campoTurma = document.getElementById('ref_cod_turma'); |
289 | + var campoAluno = document.getElementById('ref_cod_matricula'); | ||
290 | + | ||
291 | + campoAluno.length = 1; | ||
292 | + | ||
293 | + if (campoTurma.value == '') { | ||
294 | + setVisibility('tr_ref_cod_matricula', false); | ||
295 | + setVisibility('ref_cod_matricula', false); | ||
296 | + } | ||
297 | + else { | ||
298 | + setVisibility('tr_ref_cod_matricula', true); | ||
299 | + setVisibility('ref_cod_matricula', true); | ||
300 | + } | ||
313 | } | 301 | } |
302 | + | ||
314 | function getAluno() | 303 | function getAluno() |
315 | { | 304 | { |
305 | + var campoTurma = document.getElementById('ref_cod_turma').value; | ||
306 | + var campoAno = document.getElementById('ano').value; | ||
316 | 307 | ||
317 | - var campoTurma = document.getElementById('ref_cod_turma').value; | ||
318 | - var campoAno = document.getElementById('ano').value; | 308 | + var xml1 = new ajax(getAluno_XML); |
309 | + strURL = 'educar_matricula_turma_xml.php?tur=' + campoTurma + '&ano=' + campoAno; | ||
319 | 310 | ||
320 | - var xml1 = new ajax(getAluno_XML); | ||
321 | - strURL = "educar_matricula_turma_xml.php?tur="+campoTurma+"&ano="+campoAno; | ||
322 | - | ||
323 | - xml1.envia(strURL); | 311 | + xml1.envia(strURL); |
324 | } | 312 | } |
325 | 313 | ||
326 | function getAluno_XML(xml) | 314 | function getAluno_XML(xml) |
327 | { | 315 | { |
328 | - var aluno = xml.getElementsByTagName( "matricula" ); | ||
329 | - var campoTurma = document.getElementById( 'ref_cod_turma' ); | ||
330 | - var campoAluno = document.getElementById('ref_cod_matricula'); | ||
331 | - | ||
332 | - campoAluno.length = 1; | ||
333 | - //campoAluno.options[0] = new Option( 'Selecione uma Turma', '', false, false ); | ||
334 | - | ||
335 | - for ( var j = 0; j < aluno.length; j++ ) | ||
336 | - { | ||
337 | - | ||
338 | - campoAluno.options[campoAluno.options.length] = new Option( aluno[j].firstChild.nodeValue, aluno[j].getAttribute('cod_matricula'), false, false ); | ||
339 | - | ||
340 | - } | ||
341 | - /*if ( campoTurma.length == 1 && campoCurso != '' ) { | ||
342 | - campoTurma.options[0] = new Option( 'O curso não possui nenhuma turma', '', false, false ); | ||
343 | - }*/ | 316 | + var aluno = xml.getElementsByTagName('matricula'); |
317 | + var campoTurma = document.getElementById('ref_cod_turma'); | ||
318 | + var campoAluno = document.getElementById('ref_cod_matricula'); | ||
319 | + | ||
320 | + campoAluno.length = 1; | ||
321 | + | ||
322 | + for (var j = 0; j < aluno.length; j++) { | ||
323 | + campoAluno.options[campoAluno.options.length] = new Option( | ||
324 | + aluno[j].firstChild.nodeValue, aluno[j].getAttribute('cod_matricula'), | ||
325 | + false, false | ||
326 | + ); | ||
327 | + } | ||
328 | + | ||
329 | + if (campoTurma.length == 1 && campoCurso != '') { | ||
330 | + campoTurma.options[0] = new Option('O curso não possui nenhuma turma', '', false, false); | ||
331 | + } | ||
344 | } | 332 | } |
345 | 333 | ||
346 | - | ||
347 | setVisibility('tr_ref_cod_matricula',false); | 334 | setVisibility('tr_ref_cod_matricula',false); |
348 | -var func = function(){document.getElementById('btn_enviar').disabled= false;}; | ||
349 | -if( window.addEventListener ) { | ||
350 | - //mozilla | ||
351 | - document.getElementById('btn_enviar').addEventListener('click',func,false); | ||
352 | - } else if ( window.attachEvent ) { | ||
353 | - //ie | ||
354 | - document.getElementById('btn_enviar').attachEvent('onclick',func); | ||
355 | - } | ||
356 | - | ||
357 | -function acao2() | 335 | +var func = function() |
358 | { | 336 | { |
337 | + document.getElementById('btn_enviar').disabled= false; | ||
338 | +}; | ||
359 | 339 | ||
360 | - var em_branco = document.getElementById( "em_branco" ); | ||
361 | - | ||
362 | - if(em_branco.checked) | ||
363 | - { | ||
364 | - | ||
365 | - } | ||
366 | - else | ||
367 | - { | ||
368 | - if(!acao()) | ||
369 | - return; | ||
370 | - else | ||
371 | - { | ||
372 | - if (!(/[^ ]/.test( document.getElementById("ref_cod_instituicao").value ))) | ||
373 | - { | ||
374 | - mudaClassName( 'formdestaque', 'obrigatorio' ); | ||
375 | - document.getElementById("ref_cod_instituicao").className = "formdestaque"; | ||
376 | - alert( 'Preencha o campo \'Instituição\' corretamente!' ); | ||
377 | - document.getElementById("ref_cod_instituicao").focus(); | ||
378 | - return false; | ||
379 | - } | ||
380 | - if (!(/[^ ]/.test( document.getElementById("ref_cod_curso").value ))) | ||
381 | - { | ||
382 | - mudaClassName( 'formdestaque', 'obrigatorio' ); | ||
383 | - document.getElementById("ref_cod_curso").className = "formdestaque"; | ||
384 | - alert( 'Preencha o campo \'Curso\' corretamente!' ); | ||
385 | - document.getElementById("ref_cod_curso").focus(); | ||
386 | - return false; | ||
387 | - } | ||
388 | - | ||
389 | - | ||
390 | - if (!(/[^ ]/.test( document.getElementById("ref_cod_turma").value ))) | ||
391 | - { | ||
392 | - mudaClassName( 'formdestaque', 'obrigatorio' ); | ||
393 | - document.getElementById("ref_cod_turma").className = "formdestaque"; | ||
394 | - alert( 'Preencha o campo \'Turma\' corretamente!' ); | ||
395 | - document.getElementById("ref_cod_turma").focus(); | ||
396 | - return false; | ||
397 | - } | ||
398 | - } | ||
399 | - } | ||
400 | - | ||
401 | - showExpansivelImprimir(400, 200,'',[], "Boletim"); | ||
402 | - | ||
403 | - document.formcadastro.target = 'miolo_'+(DOM_divs.length-1); | ||
404 | - | ||
405 | - document.getElementById( 'btn_enviar' ).disabled =false; | ||
406 | - | ||
407 | - document.formcadastro.submit(); | 340 | +if (window.addEventListener) { |
341 | + // mozilla | ||
342 | + document.getElementById('btn_enviar').addEventListener('click',func,false); | ||
343 | +} | ||
344 | +else if (window.attachEvent) { | ||
345 | + // ie | ||
346 | + document.getElementById('btn_enviar').attachEvent('onclick',func); | ||
347 | +} | ||
408 | 348 | ||
349 | +function acao2() | ||
350 | +{ | ||
351 | + var em_branco = document.getElementById('em_branco'); | ||
352 | + | ||
353 | + if(em_branco.checked) { | ||
354 | + } | ||
355 | + else { | ||
356 | + if (!acao()) { | ||
357 | + return; | ||
358 | + } | ||
359 | + else { | ||
360 | + if (!(/[^ ]/.test(document.getElementById('ref_cod_instituicao').value))) { | ||
361 | + mudaClassName('formdestaque', 'obrigatorio'); | ||
362 | + document.getElementById('ref_cod_instituicao').className = 'formdestaque'; | ||
363 | + alert('Preencha o campo \'Instituição\' corretamente!'); | ||
364 | + document.getElementById('ref_cod_instituicao').focus(); | ||
365 | + return false; | ||
366 | + } | ||
367 | + | ||
368 | + if (!(/[^ ]/.test(document.getElementById('ref_cod_curso').value))) { | ||
369 | + mudaClassName('formdestaque', 'obrigatorio'); | ||
370 | + document.getElementById("ref_cod_curso").className = 'formdestaque'; | ||
371 | + alert('Preencha o campo \'Curso\' corretamente!'); | ||
372 | + document.getElementById('ref_cod_curso').focus(); | ||
373 | + return false; | ||
374 | + } | ||
375 | + | ||
376 | + if (!(/[^ ]/.test( document.getElementById('ref_cod_turma').value))) { | ||
377 | + mudaClassName('formdestaque', 'obrigatorio'); | ||
378 | + document.getElementById('ref_cod_turma').className = 'formdestaque'; | ||
379 | + alert('Preencha o campo \'Turma\' corretamente!'); | ||
380 | + document.getElementById('ref_cod_turma').focus(); | ||
381 | + return false; | ||
382 | + } | ||
383 | + } | ||
384 | + } | ||
385 | + | ||
386 | + showExpansivelImprimir(400, 200,'',[], "Boletim"); | ||
387 | + document.formcadastro.target = 'miolo_'+(DOM_divs.length-1); | ||
388 | + document.getElementById('btn_enviar').disabled = false; | ||
389 | + document.formcadastro.submit(); | ||
409 | } | 390 | } |
410 | 391 | ||
411 | document.formcadastro.action = 'educar_relatorio_boletim_proc.php'; | 392 | document.formcadastro.action = 'educar_relatorio_boletim_proc.php'; |
412 | 393 | ||
413 | document.getElementById('em_branco').onclick = function() | 394 | document.getElementById('em_branco').onclick = function() |
414 | { | 395 | { |
415 | - if(this.checked) | ||
416 | - { | ||
417 | - $('ref_cod_instituicao').disabled = true; | ||
418 | - $('ref_cod_escola').disabled = true; | ||
419 | - $('ref_cod_curso').disabled = true; | ||
420 | - $('ref_ref_cod_serie').disabled = true; | ||
421 | - $('ref_cod_turma').disabled = true; | ||
422 | - $('ref_cod_matricula').disabled = true; | ||
423 | - } | ||
424 | - else | ||
425 | - { | ||
426 | - $('ref_cod_instituicao').disabled = false; | ||
427 | - $('ref_cod_escola').disabled = false; | ||
428 | - $('ref_cod_curso').disabled = false; | ||
429 | - $('ref_ref_cod_serie').disabled = false; | ||
430 | - $('ref_cod_turma').disabled = false; | ||
431 | - $('ref_cod_matricula').disabled = false; | ||
432 | - } | 396 | + if(this.checked) { |
397 | + $('ref_cod_instituicao').disabled = true; | ||
398 | + $('ref_cod_escola').disabled = true; | ||
399 | + $('ref_cod_curso').disabled = true; | ||
400 | + $('ref_ref_cod_serie').disabled = true; | ||
401 | + $('ref_cod_turma').disabled = true; | ||
402 | + $('ref_cod_matricula').disabled = true; | ||
403 | + } | ||
404 | + else { | ||
405 | + $('ref_cod_instituicao').disabled = false; | ||
406 | + $('ref_cod_escola').disabled = false; | ||
407 | + $('ref_cod_curso').disabled = false; | ||
408 | + $('ref_ref_cod_serie').disabled = false; | ||
409 | + $('ref_cod_turma').disabled = false; | ||
410 | + $('ref_cod_matricula').disabled = false; | ||
411 | + } | ||
433 | } | 412 | } |
434 | -</script> | 413 | -</script> |
414 | +</script> | ||
435 | \ No newline at end of file | 415 | \ No newline at end of file |