Commit 7f9d9e54ded28e25f306534bd42b43fbd8b0aa92
1 parent
5516a061
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
1388 additions
and
1541 deletions
Show diff stats
ieducar/intranet/educar_turma_cad.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 | 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 | + | |
36 | +/** | |
37 | + * clsIndexBase class. | |
38 | + * | |
39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
40 | + * @category i-Educar | |
41 | + * @license @@license@@ | |
42 | + * @package iEd_Pmieducar | |
43 | + * @since Classe disponível desde a versão 1.0.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
32 | 46 | class clsIndexBase extends clsBase |
33 | 47 | { |
34 | - function Formular() | |
35 | - { | |
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Turma" ); | |
37 | - $this->processoAp = "586"; | |
38 | - //$this->scripts[] = "ajax"; | |
39 | - } | |
48 | + function Formular() | |
49 | + { | |
50 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Turma'); | |
51 | + $this->processoAp = 586; | |
52 | + } | |
40 | 53 | } |
41 | 54 | |
55 | +/** | |
56 | + * indice class. | |
57 | + * | |
58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
59 | + * @category i-Educar | |
60 | + * @license @@license@@ | |
61 | + * @package iEd_Pmieducar | |
62 | + * @since Classe disponível desde a versão 1.0.0 | |
63 | + * @version @@package_version@@ | |
64 | + */ | |
42 | 65 | class indice extends clsCadastro |
43 | 66 | { |
44 | - /** | |
45 | - * Referencia pega da session para o idpes do usuario atual | |
46 | - * | |
47 | - * @var int | |
48 | - */ | |
49 | - var $pessoa_logada; | |
50 | - | |
51 | - var $cod_turma; | |
52 | - var $ref_usuario_exc; | |
53 | - var $ref_usuario_cad; | |
54 | - var $ref_ref_cod_serie; | |
55 | - var $ref_ref_cod_escola; | |
56 | - var $ref_cod_infra_predio_comodo; | |
57 | - var $nm_turma; | |
58 | - var $sgl_turma; | |
59 | - var $max_aluno; | |
60 | - var $multiseriada; | |
61 | - var $data_cadastro; | |
62 | - var $data_exclusao; | |
63 | - var $ativo; | |
64 | - var $ref_cod_turma_tipo; | |
65 | - var $hora_inicial; | |
66 | - var $hora_final; | |
67 | - var $hora_inicio_intervalo; | |
68 | - var $hora_fim_intervalo; | |
69 | - | |
70 | - var $ref_cod_instituicao; | |
71 | - var $ref_cod_curso; | |
72 | - var $ref_cod_escola; | |
73 | - | |
74 | - var $padrao_ano_escolar; | |
75 | - | |
76 | - var $ref_cod_regente; | |
77 | - var $ref_cod_instituicao_regente; | |
78 | - | |
79 | - var $ref_ref_cod_serie_mult; | |
80 | - | |
81 | -//------INCLUI MODULO------// | |
82 | - var $turma_modulo; | |
83 | - var $incluir_modulo; | |
84 | - var $excluir_modulo; | |
85 | - | |
86 | -//------INCLUI DIA_SEMANA------// | |
87 | - var $dia_semana; | |
88 | - var $ds_hora_inicial; | |
89 | - var $ds_hora_final; | |
90 | - var $turma_dia_semana; | |
91 | - var $incluir_dia_semana; | |
92 | - var $excluir_dia_semana; | |
93 | - var $visivel; | |
94 | - | |
95 | - var $dias_da_semana = array( '' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado' ); | |
96 | - | |
97 | - function Inicializar() | |
98 | - { | |
99 | - $retorno = "Novo"; | |
100 | - @session_start(); | |
101 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
102 | - @session_write_close(); | |
103 | - | |
104 | - $this->cod_turma=$_GET["cod_turma"]; | |
105 | - | |
106 | - $obj_permissoes = new clsPermissoes(); | |
107 | - $obj_permissoes->permissao_cadastra( 586, $this->pessoa_logada, 7, "educar_turma_lst.php" ); | |
108 | - | |
109 | - if ( is_numeric( $this->cod_turma ) ) { | |
110 | - $obj = new clsPmieducarTurma( $this->cod_turma ); | |
111 | - $registro = $obj->detalhe(); | |
112 | - $obj_esc = new clsPmieducarEscola( $registro["ref_ref_cod_escola"] ); | |
113 | - $det_esc = $obj_esc->detalhe(); | |
114 | - $obj_ser = new clsPmieducarSerie( $registro["ref_ref_cod_serie"] ); | |
115 | - $det_ser = $obj_ser->detalhe(); | |
116 | - $this->ref_cod_escola = $det_esc["cod_escola"]; | |
117 | - $this->ref_cod_instituicao = $det_esc["ref_cod_instituicao"]; | |
118 | - $this->ref_cod_curso = $det_ser["ref_cod_curso"]; | |
119 | - $obj_curso = new clsPmieducarCurso(($this->ref_cod_curso)); | |
120 | - $det_curso = $obj_curso->detalhe(); | |
121 | - $this->padrao_ano_escolar = $det_curso['padrao_ano_escolar']; | |
122 | - if ( $registro ) | |
123 | - { | |
124 | - foreach ( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto | |
125 | - $this->$campo = $val; | |
126 | - | |
127 | - $this->fexcluir = $obj_permissoes->permissao_excluir( 586, $this->pessoa_logada, 7, "educar_turma_lst.php" ); | |
128 | - $retorno = "Editar"; | |
129 | - } | |
130 | - } | |
131 | - $this->url_cancelar = ( $retorno == "Editar" ) ? "educar_turma_det.php?cod_turma={$registro["cod_turma"]}" : "educar_turma_lst.php"; | |
132 | - $this->nome_url_cancelar = "Cancelar"; | |
133 | - return $retorno; | |
134 | - } | |
135 | - | |
136 | - function Gerar() | |
137 | - { | |
138 | - if( $_POST ) | |
139 | - foreach( $_POST AS $campo => $val ) | |
140 | - $this->$campo = ( $this->$campo ) ? $this->$campo : $val; | |
141 | - | |
142 | - //echo "<pre>";print_r($this); | |
143 | - | |
144 | - $this->campoOculto( "cod_turma", $this->cod_turma ); | |
145 | - | |
146 | - // foreign keys | |
147 | - $obrigatorio = false; | |
148 | - $instituicao_obrigatorio = true; | |
149 | - $escola_curso_obrigatorio = true; | |
150 | - $curso_obrigatorio = true; | |
151 | - $get_escola = true; | |
152 | -// $get_escola_curso = true; | |
153 | - $get_escola_curso_serie = false; | |
154 | - $sem_padrao = true; | |
155 | - $get_curso = true; | |
156 | - /*if( isset($_GET["cl"]) ) | |
157 | - {*/ | |
158 | - include("include/pmieducar/educar_campo_lista.php"); | |
159 | - /*} | |
160 | - else | |
161 | - { | |
162 | - include("include/pmieducar/educar_campo_lista.php"); | |
163 | - }*/ | |
164 | - | |
165 | - if ( $this->ref_cod_escola ) | |
166 | - { | |
167 | - $this->ref_ref_cod_escola = $this->ref_cod_escola; | |
168 | - } | |
169 | - | |
170 | - | |
171 | - /** | |
172 | - * *********************************COLOCADO*****************************************/ | |
173 | -// getEscolaCursoSerie(); | |
174 | - $opcoes_serie = array( "" => "Selecione" ); | |
175 | - // EDITAR | |
176 | - if ( $this->ref_cod_curso ) | |
177 | - { | |
178 | - $obj_serie = new clsPmieducarSerie(); | |
179 | - $obj_serie->setOrderby("nm_serie ASC"); | |
180 | - $lst_serie = $obj_serie->lista( null,null,null,$this->ref_cod_curso,null,null,null,null,null,null,null,null,1); | |
181 | - if ( is_array( $lst_serie ) && count( $lst_serie ) ) | |
182 | - { | |
183 | - foreach ( $lst_serie as $serie ) | |
184 | - { | |
185 | - $opcoes_serie["{$serie["cod_serie"]}"] = $serie['nm_serie']; | |
186 | - } | |
187 | - } | |
188 | - } | |
189 | - $script = "javascript:showExpansivelIframe(520, 550, 'educar_serie_cad_pop.php?ref_ref_cod_serie=sim');"; | |
190 | - if ($this->ref_cod_instituicao && $this->ref_cod_escola && $this->ref_cod_curso) | |
191 | - { | |
192 | - $script = "<img id='img_colecao' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; | |
193 | -// $this->campoLista( "ref_ref_cod_serie", "Série", $opcoes_serie, $this->ref_cod_serie, "", false, "", $script, true); | |
194 | - } | |
195 | - else | |
196 | - { | |
197 | - $script = "<img id='img_colecao' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; | |
198 | - | |
199 | - } | |
200 | - $this->campoLista( "ref_ref_cod_serie", "Série", $opcoes_serie, $this->ref_ref_cod_serie, "", false, "", $script); | |
201 | - | |
202 | - /***********************************COLOCADO****************************************/ | |
203 | - | |
204 | -// if( class_exists( "clsPmieducarTurma" ) ) | |
205 | -// { | |
206 | -// $todas_turmas_sala = "turma_sala = new Array();\n"; | |
207 | -// $objTemp = new clsPmieducarTurma(); | |
208 | -// $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,null,null,null,null,null,1 ); | |
209 | -// if ( is_array( $lista ) && count( $lista ) ) | |
210 | -// { | |
211 | -// foreach ( $lista as $registro ) | |
212 | -// { | |
213 | -// $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo( $registro['ref_cod_infra_predio_comodo'] ); | |
214 | -// $det_infra_predio_comodo = $obj_infra_predio_comodo->detalhe(); | |
215 | -// | |
216 | -// $obj_infra_predio = new clsPmieducarInfraPredio( $det_infra_predio_comodo["ref_cod_infra_predio"] ); | |
217 | -// $det_infra_prefalsedio = $obj_infra_predio->detalhe(); | |
218 | -// | |
219 | -// $registro['hora_inicial'] = substr($registro['hora_inicial'],0,5); | |
220 | -// $registro['hora_final'] = substr($registro['hora_final'],0,5); | |
221 | -// | |
222 | -// $todas_turmas_sala .= "turma_sala[turma_sala.length] = new Array( {$registro["cod_turma"]}, '{$registro['ref_cod_infra_predio_comodo']}', '{$det_infra_predio['ref_cod_escola']}', '{$registro['hora_inicial']}', '{$registro['hora_final']}' );\n"; | |
223 | -// } | |
224 | -// } | |
225 | -// echo "<script type='text/javascript'>{$todas_turmas_sala}</script>"; | |
226 | -// } | |
227 | - | |
228 | - //-------------------INFRA PREDIO COMODO----------------------// | |
229 | - $opcoes = array( "" => "Selecione" ); | |
230 | - //if( class_exists( "clsPmieducarInfraPredio" ) && class_exists( "clsPmieducarInfraPredioComodo" ) ) | |
231 | - //{ | |
232 | -// $todos_comodos_predios = "comodo = new Array();\n"; | |
233 | -// $obj_infra_predio = new clsPmieducarInfraPredio(); | |
234 | -// $obj_infra_predio->setOrderby("nm_predio ASC"); | |
235 | -// $lst_infra_predio = $obj_infra_predio->lista( null,null,null,null,null,null,null,null,null,null,null,1 ); | |
236 | -// if ( is_array( $lst_infra_predio ) && count( $lst_infra_predio ) ) | |
237 | -// { | |
238 | -// foreach ( $lst_infra_predio as $predio ) | |
239 | -// { | |
240 | -// $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo(); | |
241 | -// $lst_infra_predio_comodo = $obj_infra_predio_comodo->lista( null,null,null,null,$predio["cod_infra_predio"],null,null,null,null,null,null,null,1 ); | |
242 | -// if ( is_array( $lst_infra_predio_comodo ) && count( $lst_infra_predio_comodo ) ) | |
243 | -// { | |
244 | -// foreach ( $lst_infra_predio_comodo as $comodo ) | |
245 | -// { | |
246 | -// $todos_comodos_predios .= "comodo[comodo.length] = new Array( {$comodo["cod_infra_predio_comodo"]}, '{$comodo['nm_comodo']}', {$predio["ref_cod_escola"]} );\n"; | |
247 | -// } | |
248 | -// } | |
249 | -// } | |
250 | -// } | |
251 | -// echo "<script type='text/javascript'>{$todos_comodos_predios}</script>"; | |
252 | - | |
253 | - // EDITAR | |
254 | - if ( $this->ref_ref_cod_escola ) | |
255 | - { | |
256 | - $obj_infra_predio = new clsPmieducarInfraPredio(); | |
257 | - $obj_infra_predio->setOrderby("nm_predio ASC"); | |
258 | - $lst_infra_predio = $obj_infra_predio->lista( null,null,null,$this->ref_ref_cod_escola,null,null,null,null,null,null,null,1 ); | |
259 | - if ( is_array( $lst_infra_predio ) && count( $lst_infra_predio ) ) | |
260 | - { | |
261 | - foreach ( $lst_infra_predio as $predio ) | |
262 | - { | |
263 | - $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo(); | |
264 | - $lst_infra_predio_comodo = $obj_infra_predio_comodo->lista( null,null,null,null,$predio["cod_infra_predio"],null,null,null,null,null,null,null,1 ); | |
265 | - if ( is_array( $lst_infra_predio_comodo ) && count( $lst_infra_predio_comodo ) ) | |
266 | - { | |
267 | - foreach ( $lst_infra_predio_comodo as $comodo ) | |
268 | - { | |
269 | - $opcoes["{$comodo["cod_infra_predio_comodo"]}"] = $comodo['nm_comodo']; | |
270 | - } | |
271 | - } | |
272 | - } | |
273 | - } | |
274 | - } | |
275 | - //} | |
276 | - ////else | |
277 | - //{ | |
278 | - //echo "<!--\nErro\nClasse(s) clsPmieducarInfraPredio / clsPmieducarInfraPredioComodo não encontrada(s)\n-->"; | |
279 | - //$opcoes_cursos_escola = array( "" => "Erro na geração" ); | |
280 | - //} | |
281 | - $this->campoLista( "ref_cod_infra_predio_comodo", "Sala", $opcoes, $this->ref_cod_infra_predio_comodo,null,null,null,null,null,false); | |
282 | - | |
283 | - $array_servidor = array( '' => "Selecione um servidor" ); | |
284 | - if($this->ref_cod_regente) | |
285 | - { | |
286 | - $obj_pessoa = new clsPessoa_($this->ref_cod_regente); | |
287 | - $det = $obj_pessoa->detalhe(); | |
288 | - $array_servidor[$this->ref_cod_regente] = $det['nome']; | |
289 | - | |
290 | - } | |
291 | - $this->campoListaPesq( "ref_cod_regente", "Professor/Regente", $array_servidor, $this->ref_cod_regente, "", "", false, "", "", null, null, "", true, false, false); | |
292 | - //-------------------TURMA TIPO----------------------// | |
293 | - $opcoes = array( "" => "Selecione" ); | |
294 | -// $todos_tipos_turma = "tipo_turma = new Array();\n"; | |
295 | -// $objTemp = new clsPmieducarTurmaTipo(); | |
296 | -// $objTemp->setOrderby("nm_tipo ASC"); | |
297 | -// $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,1 ); | |
298 | -// if ( is_array( $lista ) && count( $lista ) ) | |
299 | -// { | |
300 | -// foreach ( $lista as $registro ) | |
301 | -// { | |
302 | -// $todos_tipos_turma .= "tipo_turma[tipo_turma.length] = new Array( {$registro["cod_turma_tipo"]}, '{$registro['nm_tipo']}', {$registro["ref_cod_instituicao"]} );\n"; | |
303 | -// } | |
304 | -// } | |
305 | -// echo "<script type='text/javascript'>{$todos_tipos_turma}</script>"; | |
306 | - | |
307 | - // EDITAR | |
308 | - if ($this->ref_cod_instituicao) | |
309 | - { | |
310 | - $objTemp = new clsPmieducarTurmaTipo(); | |
311 | - $objTemp->setOrderby("nm_tipo ASC"); | |
312 | - $lista = $objTemp->lista( null,null,null,null,null,null,null,null,null,1,$this->ref_cod_instituicao ); | |
313 | - if ( is_array( $lista ) && count( $lista ) ) | |
314 | - { | |
315 | - foreach ( $lista as $registro ) | |
316 | - { | |
317 | - $opcoes["{$registro['cod_turma_tipo']}"] = "{$registro['nm_tipo']}"; | |
318 | - } | |
319 | - } | |
320 | - } | |
321 | - | |
322 | - | |
323 | - $script = "javascript:showExpansivelIframe(520, 170, 'educar_turma_tipo_cad_pop.php');"; | |
324 | - if ($this->ref_cod_instituicao && $this->ref_cod_escola && $this->ref_cod_curso) | |
325 | - { | |
326 | - $script = "<img id='img_turma' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; | |
327 | -// $this->campoLista( "ref_ref_cod_serie", "Série", $opcoes_serie, $this->ref_cod_serie, "", false, "", $script, true); | |
328 | - } | |
329 | - else | |
330 | - { | |
331 | - $script = "<img id='img_turma' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; | |
332 | - | |
333 | - } | |
334 | - | |
335 | - $this->campoLista( "ref_cod_turma_tipo", "Tipo de Turma", $opcoes, $this->ref_cod_turma_tipo, "", false, "", $script ); | |
336 | - | |
337 | - // text | |
338 | - $this->campoTexto( "nm_turma", "Turma", $this->nm_turma, 30, 255, true ); | |
339 | - $this->campoTexto( "sgl_turma", "Sigla", $this->sgl_turma, 15, 15, false ); | |
340 | - | |
341 | - $this->campoNumero( "max_aluno", "Máximo de Alunos", $this->max_aluno, 3, 3, true ); | |
342 | - $this->campoCheck("visivel", "Ativo", dbBool($this->visivel)); | |
343 | - // checkbox | |
344 | - $this->campoCheck( "multiseriada", "Multi-Seriada", $this->multiseriada, "", false, false ); | |
345 | - | |
346 | - $this->campoLista("ref_ref_cod_serie_mult","Série",array('' => 'Selecione'),'',"",false,"","","",false); | |
347 | - $this->campoOculto("ref_ref_cod_serie_mult_",$this->ref_ref_cod_serie_mult); | |
348 | - | |
349 | - | |
350 | - $this->campoQuebra2(); | |
351 | - | |
352 | -//-----------------SE EM CURSO, PADRAO_ANO_ESCOLA == 1-------------------// | |
353 | - // hora | |
354 | - $this->campoHora( "hora_inicial", "Hora Inicial", $this->hora_inicial,false ); | |
355 | - $this->campoHora( "hora_final", "Hora Final", $this->hora_final,false ); | |
356 | - $this->campoHora( "hora_inicio_intervalo", "Hora Início Intervalo", $this->hora_inicio_intervalo,false ); | |
357 | - $this->campoHora( "hora_fim_intervalo", "Hora Fim Intervalo", $this->hora_fim_intervalo,false ); | |
358 | - | |
359 | -//-----------------SENAO, PADRAO_ANO_ESCOLA == 0-------------------// | |
360 | - | |
361 | - //---------------------INCLUI MODULO---------------------// | |
362 | - $this->campoQuebra(); | |
363 | - | |
364 | - if ( $_POST["turma_modulo"] ) | |
365 | - $this->turma_modulo = unserialize( urldecode( $_POST["turma_modulo"] ) ); | |
366 | - $qtd_modulo = ( count( $this->turma_modulo ) == 0 ) ? 1 : ( count( $this->turma_modulo ) + 1); | |
367 | - if( is_numeric( $this->cod_turma) && !$_POST) | |
368 | - { | |
369 | - $obj = new clsPmieducarTurmaModulo(); | |
370 | - $registros = $obj->lista( $this->cod_turma ); | |
371 | - if( $registros ) | |
372 | - { | |
373 | - foreach ( $registros AS $campo ) | |
374 | - { | |
375 | - $this->turma_modulo[$campo[$qtd_modulo]]["sequencial_"] = $campo["sequencial"]; | |
376 | - $this->turma_modulo[$campo[$qtd_modulo]]["ref_cod_modulo_"] = $campo["ref_cod_modulo"]; | |
377 | - $this->turma_modulo[$campo[$qtd_modulo]]["data_inicio_"] = dataFromPgToBr($campo["data_inicio"]); | |
378 | - $this->turma_modulo[$campo[$qtd_modulo]]["data_fim_"] = dataFromPgToBr($campo["data_fim"]); | |
379 | - $qtd_modulo++; | |
380 | - } | |
381 | - } | |
382 | - } | |
383 | - if ( $_POST["ref_cod_modulo"] && $_POST["data_inicio"] && $_POST["data_fim"] ) | |
384 | - { | |
385 | - $this->turma_modulo[$qtd_modulo]["sequencial_"] = $qtd_modulo; | |
386 | - $this->turma_modulo[$qtd_modulo]["ref_cod_modulo_"] = $_POST["ref_cod_modulo"]; | |
387 | - $this->turma_modulo[$qtd_modulo]["data_inicio_"] = $_POST["data_inicio"]; | |
388 | - $this->turma_modulo[$qtd_modulo]["data_fim_"] = $_POST["data_fim"]; | |
389 | - $qtd_modulo++; | |
390 | - unset( $this->ref_cod_modulo ); | |
391 | - unset( $this->data_inicio ); | |
392 | - unset( $this->data_fim ); | |
393 | - } | |
394 | - | |
395 | - $this->campoOculto( "excluir_modulo", "" ); | |
396 | - $qtd_modulo = 1; | |
397 | - unset($aux); | |
398 | - | |
399 | - if ( $this->turma_modulo ) | |
400 | - { | |
401 | - foreach ( $this->turma_modulo as $campo ) | |
402 | - { | |
403 | - if ( $this->excluir_modulo == $campo["sequencial_"] ) | |
404 | - { | |
405 | - $this->turma_modulo[$campo["sequencial"]] = null; | |
406 | - $this->excluir_modulo = null; | |
407 | - } | |
408 | - else | |
409 | - { | |
410 | - $obj_modulo = new clsPmieducarModulo($campo["ref_cod_modulo_"]); | |
411 | - $det_modulo = $obj_modulo->detalhe(); | |
412 | - $nm_tipo_modulo = $det_modulo["nm_tipo"]; | |
413 | - $this->campoTextoInv( "ref_cod_modulo_{$campo["sequencial_"]}", "", $nm_tipo_modulo, 30, 255, false, false, true,"","","","","ref_cod_modulo" ); | |
414 | - $this->campoTextoInv( "data_inicio_{$campo["sequencial_"]}", "", $campo["data_inicio_"], 10, 10, false, false, true,"","","","","" ); | |
415 | - $this->campoTextoInv( "data_fim_{$campo["sequencial_"]}", "", $campo["data_fim_"], 10, 10, false, false, false, "", "<a href='#' onclick=\"document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>","","","" ); | |
416 | - $aux[$qtd_modulo]["sequencial_"] = $qtd_modulo; | |
417 | - $aux[$qtd_modulo]["ref_cod_modulo_"] = $campo["ref_cod_modulo_"]; | |
418 | - $aux[$qtd_modulo]["data_inicio_"] = $campo["data_inicio_"]; | |
419 | - $aux[$qtd_modulo]["data_fim_"] = $campo["data_fim_"]; | |
420 | - $qtd_modulo++; | |
421 | - } | |
422 | - | |
423 | - } | |
424 | - unset($this->turma_modulo); | |
425 | - $this->turma_modulo = $aux; | |
426 | - } | |
427 | - $this->campoOculto( "turma_modulo", serialize( $this->turma_modulo ) ); | |
428 | - | |
429 | - //-------------------MODULO----------------------// | |
430 | - // foreign keys | |
431 | - $opcoes = array( "" => "Selecione" ); | |
432 | - //if( class_exists( "clsPmieducarModulo" ) ) | |
433 | - //{ | |
434 | -// $todos_modulos = "modulo = new Array();\n"; | |
435 | -// $objTemp = new clsPmieducarModulo(); | |
436 | -// $objTemp->setOrderby("nm_tipo ASC"); | |
437 | -// $lista = $objTemp->lista(null,null,null,null,null,null,null,null,null,null,null,1); | |
438 | -// if ( is_array( $lista ) && count( $lista ) ) | |
439 | -// { | |
440 | -// foreach ( $lista as $registro ) | |
441 | -// { | |
442 | -// $todos_modulos .= "modulo[modulo.length] = new Array( {$registro["cod_modulo"]}, '{$registro['nm_tipo']}', '{$registro["ref_cod_instituicao"]}' );\n"; | |
443 | -// } | |
444 | -// } | |
445 | -// echo "<script type='text/javascript'>{$todos_modulos}</script>"; | |
446 | - | |
447 | - // EDITAR | |
448 | - if ($this->ref_cod_instituicao) | |
449 | - { | |
450 | - $objTemp = new clsPmieducarModulo(); | |
451 | - $objTemp->setOrderby("nm_tipo ASC"); | |
452 | - $lista = $objTemp->lista(null,null,null,null,null,null,null,null,null,null,null,1,$this->ref_cod_instituicao); | |
453 | - if ( is_array( $lista ) && count( $lista ) ) | |
454 | - { | |
455 | - foreach ( $lista as $registro ) | |
456 | - { | |
457 | - $opcoes["{$registro['cod_modulo']}"] = "{$registro['nm_tipo']}"; | |
458 | - } | |
459 | - } | |
460 | - } | |
461 | - //} | |
462 | - //else | |
463 | - //{ | |
464 | - // echo "<!--\nErro\nClasse clsPmieducarModulo nao encontrada\n-->"; | |
465 | - // $opcoes = array( "" => "Erro na geracao" ); | |
466 | - //} | |
467 | - $this->campoLista( "ref_cod_modulo", "Módulo", $opcoes, $this->ref_cod_modulo,null,null,null,null,null,false ); | |
468 | - $this->campoData( "data_inicio", "Data Início", $this->data_inicio,false ); | |
469 | - $this->campoData( "data_fim", "Data Fim", $this->data_fim,false ); | |
470 | - | |
471 | - $this->campoOculto( "incluir_modulo", "" ); | |
472 | - $this->campoRotulo( "bt_incluir_modulo", "Módulo", "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>" ); | |
473 | - | |
474 | - $this->campoQuebra(); | |
475 | - //---------------------FIM INCLUI MODULO---------------------// | |
476 | - | |
477 | - | |
478 | - //-----------------------INCLUI DIA SEMANA------------------------// | |
479 | - $this->campoQuebra(); | |
480 | - | |
481 | - if ( $_POST["turma_dia_semana"] ) | |
482 | - $this->turma_dia_semana = unserialize( urldecode( $_POST["turma_dia_semana"] ) ); | |
483 | - if( is_numeric( $this->cod_turma ) && !$_POST ) | |
484 | - { | |
485 | - $obj = new clsPmieducarTurmaDiaSemana(); | |
486 | - $registros = $obj->lista( null,$this->cod_turma ); | |
487 | - if( $registros ) | |
488 | - { | |
489 | - foreach ( $registros AS $campo ) | |
490 | - { | |
491 | - $aux["dia_semana_"]= $campo["dia_semana"]; | |
492 | - $aux["hora_inicial_"]= $campo["hora_inicial"]; | |
493 | - $aux["hora_final_"]= $campo["hora_final"]; | |
494 | - $this->turma_dia_semana[] = $aux; | |
495 | - } | |
496 | - } | |
497 | - } | |
498 | - | |
499 | - unset($aux); | |
500 | - | |
501 | - if ( $_POST["dia_semana"] && $_POST["ds_hora_inicial"] && $_POST["ds_hora_final"] ) | |
502 | - { | |
503 | - $aux["dia_semana_"] = $_POST["dia_semana"]; | |
504 | - $aux["hora_inicial_"] = $_POST["ds_hora_inicial"]; | |
505 | - $aux["hora_final_"] = $_POST["ds_hora_final"]; | |
506 | - $this->turma_dia_semana[] = $aux; | |
507 | - unset( $this->dia_semana ); | |
508 | - unset( $this->ds_hora_inicial ); | |
509 | - unset( $this->ds_hora_final ); | |
510 | - } | |
511 | - | |
512 | - $this->campoOculto( "excluir_dia_semana", "" ); | |
513 | - unset($aux); | |
514 | - | |
515 | - if ( $this->turma_dia_semana ) | |
516 | - { | |
517 | - foreach ( $this->turma_dia_semana as $key => $dias_semana) | |
518 | - { | |
519 | - if ( $this->excluir_dia_semana == $dias_semana["dia_semana_"] ) | |
520 | - { | |
521 | - unset($this->turma_dia_semana[$key]); | |
522 | - unset($this->excluir_dia_semana); | |
523 | - } | |
524 | - else | |
525 | - { | |
526 | - $nm_dia_semana = $this->dias_da_semana[$dias_semana["dia_semana_"]]; | |
527 | - | |
528 | - $this->campoTextoInv( "dia_semana_{$dias_semana["dia_semana_"]}", "", $nm_dia_semana, 8, 8, false, false, true,"","","","","dia_semana" ); | |
529 | - $this->campoTextoInv( "hora_inicial_{$dias_semana["dia_semana_"]}", "", $dias_semana['hora_inicial_'], 5, 5, false, false, true, "","","","","ds_hora_inicial_" ); | |
530 | - $this->campoTextoInv( "hora_final_{$dias_semana["dia_semana_"]}", "", $dias_semana['hora_final_'], 5, 5, false, false, false, "", "<a href='#' onclick=\"document.getElementById('excluir_dia_semana').value = '{$dias_semana["dia_semana_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>","","","ds_hora_final_" ); | |
531 | - $aux["dia_semana_"] = $dias_semana["dia_semana_"]; | |
532 | - $aux["hora_inicial_"] = $dias_semana['hora_inicial_']; | |
533 | - $aux["hora_final_"] = $dias_semana['hora_final_']; | |
534 | - } | |
535 | - } | |
536 | - } | |
537 | - $this->campoOculto( "turma_dia_semana", serialize( $this->turma_dia_semana ) ); | |
538 | - | |
539 | - if( class_exists( "clsPmieducarTurmaDiaSemana" ) ) | |
540 | - { | |
541 | - $opcoes = $this->dias_da_semana; | |
542 | - } | |
543 | - else | |
544 | - { | |
545 | - echo "<!--\nErro\nClasse clsPmieducarTurmaDiaSemana não encontrada\n-->"; | |
546 | - $opcoes = array( "" => "Erro na geração" ); | |
547 | - } | |
548 | - $this->campoLista( "dia_semana", "Dia Semana", $opcoes, $this->dia_semana,null,false,"","",false,false); | |
549 | - $this->campoHora( "ds_hora_inicial", "Hora Inicial", $this->ds_hora_inicial,false ); | |
550 | - $this->campoHora( "ds_hora_final", "Hora Final", $this->ds_hora_final,false ); | |
551 | - | |
552 | - $this->campoOculto( "incluir_dia_semana", "" ); | |
553 | - $this->campoRotulo( "bt_incluir_dia_semana", "Dia Semana", "<a href='#' onclick=\"document.getElementById('incluir_dia_semana').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>" ); | |
554 | - | |
555 | - $this->campoQuebra(); | |
556 | - //-----------------------FIM DIA SEMANA------------------------// | |
557 | - | |
558 | - $this->campoOculto( "padrao_ano_escolar", $this->padrao_ano_escolar ); | |
559 | - | |
560 | - $this->acao_enviar = "valida()"; | |
561 | - } | |
562 | - | |
563 | - function Novo() | |
564 | - { | |
565 | - @session_start(); | |
566 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
567 | - @session_write_close(); | |
568 | - $this->ref_cod_instituicao_regente = $this->ref_cod_instituicao; | |
569 | - if ( $this->multiseriada == "on" ) | |
570 | - $this->multiseriada = 1; | |
571 | - else | |
572 | - $this->multiseriada = 0; | |
573 | - | |
574 | - if ($this->visivel == "on") | |
575 | - { | |
576 | - $this->visivel = true; | |
577 | - } | |
578 | - else | |
579 | - { | |
580 | - $this->visivel = false; | |
581 | - } | |
582 | - | |
583 | - // não segue o padrao do curso | |
584 | - if ($this->padrao_ano_escolar == 0) | |
585 | - { | |
586 | - $this->turma_modulo = unserialize( urldecode( $this->turma_modulo ) ); | |
587 | - $this->turma_dia_semana = unserialize( urldecode( $this->turma_dia_semana ) ); | |
588 | - if ($this->turma_modulo && $this->turma_dia_semana) | |
589 | - { | |
590 | - $obj = new clsPmieducarTurma( null, null, $this->pessoa_logada, $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, null, null, 1, $this->ref_cod_turma_tipo,null,null,null,null,$this->ref_cod_regente,$this->ref_cod_instituicao_regente,$this->ref_cod_instituicao,$this->ref_cod_curso,$this->ref_ref_cod_serie_mult,$this->ref_cod_escola, $this->visivel); | |
591 | - $cadastrou = $obj->cadastra(); | |
592 | - if( $cadastrou ) | |
593 | - { | |
594 | - //--------------CADASTRA MODULO--------------// | |
595 | - foreach ( $this->turma_modulo AS $campo ) | |
596 | - { | |
597 | - $campo["data_inicio_"] = dataToBanco($campo["data_inicio_"]); | |
598 | - $campo["data_fim_"] = dataToBanco($campo["data_fim_"]); | |
599 | - | |
600 | - $obj = new clsPmieducarTurmaModulo( $cadastrou, $campo["ref_cod_modulo_"], $campo["sequencial_"], $campo["data_inicio_"], $campo["data_fim_"] ); | |
601 | - $cadastrou1 = $obj->cadastra(); | |
602 | - if( !$cadastrou1 ) | |
603 | - { | |
604 | - $this->mensagem = "Cadastro não realizado.<br>"; | |
605 | - echo "<!--\nErro ao cadastrar clsPmieducarTurmaModulo\nvalores obrigatorios\nis_numeric( $cadastrou ) && is_numeric( {$campo["ref_cod_modulo_"]} ) && is_numeric( {$campo["sequencial_"]} ) && is_string( {$campo["data_inicio_"]} ) && is_string( {$campo["data_fim_"]} )\n-->"; | |
606 | - return false; | |
607 | - } | |
608 | - } | |
609 | - //--------------FIM CADASTRA MODULO--------------// | |
610 | - | |
611 | - //-----------------------CADASTRA DIA SEMANA------------------------// | |
612 | - foreach ( $this->turma_dia_semana AS $campo ) | |
613 | - { | |
614 | - $obj = new clsPmieducarTurmaDiaSemana( $campo["dia_semana_"], $cadastrou, $campo["hora_inicial_"], $campo["hora_final_"] ); | |
615 | - $cadastrou2 = $obj->cadastra(); | |
616 | - if ( !$cadastrou2 ) | |
617 | - { | |
618 | - $this->mensagem = "Cadastro não realizado.<br>"; | |
619 | - echo "<!--\nErro ao cadastrar clsPmieducarTurmaDiaSemana\nvalores obrigatórios\nis_numeric( $cadastrou ) && is_numeric( {$campo["dia_semana_"]} ) && is_string( {$campo["hora_inicial_"]} ) && is_string( {$campo["hora_final_"]} )\n-->"; | |
620 | - return false; | |
621 | - } | |
622 | - } | |
623 | - $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | |
624 | - header( "Location: educar_turma_lst.php" ); | |
625 | - die(); | |
626 | - return true; | |
627 | - //-----------------------FIM CADASTRA DIA SEMANA------------------------// | |
628 | - } | |
629 | - $this->mensagem = "Cadastro não realizado.<br>"; | |
630 | - echo "<!--\nErro ao cadastrar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
631 | - return false; | |
632 | - } | |
633 | - echo "<script type='text/javascript'> alert('É necessário adicionar pelo menos 1 Módulo e 1 Dia da Semana!') </script>"; | |
634 | - $this->mensagem = "Cadastro não realizado.<br>"; | |
635 | - return false; | |
636 | - } // segue o padrao do curso | |
637 | - else if ($this->padrao_ano_escolar == 1) | |
638 | - { | |
639 | - $obj = new clsPmieducarTurma( null, null, $this->pessoa_logada, $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, null, null, 1, $this->ref_cod_turma_tipo, $this->hora_inicial, $this->hora_final, $this->hora_inicio_intervalo, $this->hora_fim_intervalo,$this->ref_cod_regente,$this->ref_cod_instituicao_regente,$this->ref_cod_instituicao,$this->ref_cod_curso, $this->ref_ref_cod_serie_mult,$this->ref_cod_escola, $this->visivel ); | |
640 | - $cadastrou = $obj->cadastra(); | |
641 | - if( $cadastrou ) | |
642 | - { | |
643 | - $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | |
644 | - header( "Location: educar_turma_lst.php" ); | |
645 | - die(); | |
646 | - return true; | |
647 | - } | |
648 | - $this->mensagem = "Cadastro não realizado.<br>"; | |
649 | - echo "<!--\nErro ao cadastrar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
650 | - return false; | |
651 | - } | |
652 | - } | |
653 | - | |
654 | - function Editar() | |
655 | - { | |
656 | - @session_start(); | |
657 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
658 | - @session_write_close(); | |
659 | - $this->ref_cod_instituicao_regente = $this->ref_cod_instituicao; | |
660 | - | |
661 | - if ( $this->multiseriada == "on" ) | |
662 | - $this->multiseriada = 1; | |
663 | - else | |
664 | - $this->multiseriada = 0; | |
665 | - | |
666 | - if ($this->visivel == "on") | |
667 | - { | |
668 | - $this->visivel = true; | |
669 | - } | |
670 | - else | |
671 | - { | |
672 | - $this->visivel = false; | |
673 | - } | |
674 | - | |
675 | - // não segue o padrao do curso | |
676 | - if ($this->padrao_ano_escolar == 0) | |
677 | - { | |
678 | - $this->turma_modulo = unserialize( urldecode( $this->turma_modulo ) ); | |
679 | - $this->turma_dia_semana = unserialize( urldecode( $this->turma_dia_semana ) ); | |
680 | - if ($this->turma_modulo && $this->turma_dia_semana) | |
681 | - { | |
682 | - $obj = new clsPmieducarTurma( $this->cod_turma, $this->pessoa_logada, null, $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, null, null, 1, $this->ref_cod_turma_tipo,null,null,null,null,$this->ref_cod_regente,$this->ref_cod_instituicao_regente,$this->ref_cod_instituicao,$this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, $this->visivel ); | |
683 | - $editou = $obj->edita(); | |
684 | - if( $editou ) | |
685 | - { | |
686 | - //--------------EDITA MODULO--------------// | |
687 | - $obj = new clsPmieducarTurmaModulo(); | |
688 | - $excluiu = $obj->excluirTodos($this->cod_turma); | |
689 | - if ( $excluiu ) | |
690 | - { | |
691 | - foreach ( $this->turma_modulo AS $campo ) | |
692 | - { | |
693 | - $campo["data_inicio_"] = dataToBanco($campo["data_inicio_"]); | |
694 | - $campo["data_fim_"] = dataToBanco($campo["data_fim_"]); | |
695 | - | |
696 | - $obj = new clsPmieducarTurmaModulo( $this->cod_turma, $campo["ref_cod_modulo_"], $campo["sequencial_"], $campo["data_inicio_"], $campo["data_fim_"] ); | |
697 | - $cadastrou1 = $obj->cadastra(); | |
698 | - if( !$cadastrou1 ) | |
699 | - { | |
700 | - $this->mensagem = "Edição não realizada.<br>"; | |
701 | - echo "<!--\nErro ao editar clsPmieducarTurmaModulo\nvalores obrigatorios\nis_numeric( $this->cod_turma ) && is_numeric( {$campo["ref_cod_modulo_"]} ) \n-->"; | |
702 | - return false; | |
703 | - } | |
704 | - } | |
705 | - } | |
706 | - //--------------FIM EDITA MODULO--------------// | |
707 | - | |
708 | - //-----------------------EDITA DIA SEMANA------------------------// | |
709 | - $obj = new clsPmieducarTurmaDiaSemana( null, $this->cod_turma ); | |
710 | - $excluiu = $obj->excluirTodos(); | |
711 | - if ( $excluiu ) | |
712 | - { | |
713 | - foreach ( $this->turma_dia_semana AS $campo ) | |
714 | - { | |
715 | - $obj = new clsPmieducarTurmaDiaSemana( $campo["dia_semana_"], $this->cod_turma, $campo["hora_inicial_"], $campo["hora_final_"] ); | |
716 | - $cadastrou2 = $obj->cadastra(); | |
717 | - if ( !$cadastrou2 ) | |
718 | - { | |
719 | - $this->mensagem = "Edição não realizada.<br>"; | |
720 | - echo "<!--\nErro ao editar clsPmieducarTurmaDiaSemana\nvalores obrigatórios\nis_numeric( $this->cod_turma ) && is_numeric( {$campo["dia_semana_"]} ) \n-->"; | |
721 | - return false; | |
722 | - } | |
723 | - } | |
724 | - } | |
725 | - //-----------------------FIM EDITA DIA SEMANA------------------------// | |
726 | - } | |
727 | - else | |
728 | - { | |
729 | - $this->mensagem = "Edição não realizada.<br>"; | |
730 | - echo "<!--\nErro ao editar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
731 | - return false; | |
732 | - } | |
733 | - } | |
734 | - else | |
735 | - { | |
736 | - echo "<script type='text/javascript'> alert('É necessário adicionar pelo menos 1 Módulo e 1 Dia da Semana!') </script>"; | |
737 | - $this->mensagem = "Edição não realizada.<br>"; | |
738 | - return false; | |
739 | - } | |
740 | - } // segue o padrao do curso | |
741 | - else if ($this->padrao_ano_escolar == 1) | |
742 | - { | |
743 | - $obj = new clsPmieducarTurma( $this->cod_turma, $this->pessoa_logada, null, $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, null, null, 1, $this->ref_cod_turma_tipo, $this->hora_inicial, $this->hora_final, $this->hora_inicio_intervalo, $this->hora_fim_intervalo,$this->ref_cod_regente,$this->ref_cod_instituicao_regente,$this->ref_cod_instituicao,$this->ref_cod_curso, $this->ref_ref_cod_serie_mult,$this->ref_cod_escola, $this->visivel ); | |
744 | - $editou = $obj->edita(); | |
745 | - } | |
746 | - | |
747 | - if( $editou ) | |
748 | - { | |
749 | - $this->mensagem .= "Edição efetuada com sucesso.<br>"; | |
750 | - header( "Location: educar_turma_lst.php" ); | |
751 | - die(); | |
752 | - return true; | |
753 | - } | |
754 | - else | |
755 | - { | |
756 | - $this->mensagem = "Edição não realizada.<br>"; | |
757 | - echo "<!--\nErro ao editar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
758 | - return false; | |
759 | - } | |
760 | - } | |
761 | - | |
762 | - function Excluir() | |
763 | - { | |
764 | - @session_start(); | |
765 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
766 | - @session_write_close(); | |
767 | - | |
768 | - $obj = new clsPmieducarTurma( $this->cod_turma, $this->pessoa_logada, null,null,null,null,null,null,null,null,null,null, 0); | |
769 | - $excluiu = $obj->excluir(); | |
770 | - if( $excluiu ) | |
771 | - { | |
772 | - $obj = new clsPmieducarTurmaModulo(); | |
773 | - $excluiu1 = $obj->excluirTodos($this->cod_turma); | |
774 | - if ( $excluiu1 ) | |
775 | - { | |
776 | - $obj = new clsPmieducarTurmaDiaSemana( null, $this->cod_turma ); | |
777 | - $excluiu2 = $obj->excluirTodos(); | |
778 | - if ( $excluiu2 ) | |
779 | - { | |
780 | - $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; | |
781 | - header( "Location: educar_turma_lst.php" ); | |
782 | - die(); | |
783 | - return true; | |
784 | - } | |
785 | - else | |
786 | - { | |
787 | - $this->mensagem = "Exclusão não realizada.<br>"; | |
788 | - echo "<!--\nErro ao excluir clsPmieducarTurma\nvalores obrigatorios\nif( is_numeric( $this->cod_turma ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
789 | - return false; | |
790 | - } | |
791 | - } | |
792 | - else | |
793 | - { | |
794 | - $this->mensagem = "Exclusão não realizada.<br>"; | |
795 | - echo "<!--\nErro ao excluir clsPmieducarTurma\nvalores obrigatorios\nif( is_numeric( $this->cod_turma ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
796 | - return false; | |
797 | - } | |
798 | - } | |
799 | - | |
800 | - $this->mensagem = "Exclusão não realizada.<br>"; | |
801 | - echo "<!--\nErro ao excluir clsPmieducarTurma\nvalores obrigatorios\nif( is_numeric( $this->cod_turma ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
802 | - return false; | |
803 | - } | |
67 | + var $pessoa_logada; | |
68 | + | |
69 | + var $cod_turma; | |
70 | + var $ref_usuario_exc; | |
71 | + var $ref_usuario_cad; | |
72 | + var $ref_ref_cod_serie; | |
73 | + var $ref_ref_cod_escola; | |
74 | + var $ref_cod_infra_predio_comodo; | |
75 | + var $nm_turma; | |
76 | + var $sgl_turma; | |
77 | + var $max_aluno; | |
78 | + var $multiseriada; | |
79 | + var $data_cadastro; | |
80 | + var $data_exclusao; | |
81 | + var $ativo; | |
82 | + var $ref_cod_turma_tipo; | |
83 | + var $hora_inicial; | |
84 | + var $hora_final; | |
85 | + var $hora_inicio_intervalo; | |
86 | + var $hora_fim_intervalo; | |
87 | + | |
88 | + var $ref_cod_instituicao; | |
89 | + var $ref_cod_curso; | |
90 | + var $ref_cod_escola; | |
91 | + | |
92 | + var $padrao_ano_escolar; | |
93 | + | |
94 | + var $ref_cod_regente; | |
95 | + var $ref_cod_instituicao_regente; | |
96 | + | |
97 | + var $ref_ref_cod_serie_mult; | |
98 | + | |
99 | + // Inclui módulo | |
100 | + var $turma_modulo; | |
101 | + var $incluir_modulo; | |
102 | + var $excluir_modulo; | |
103 | + | |
104 | + // Inclui dia da semana | |
105 | + var $dia_semana; | |
106 | + var $ds_hora_inicial; | |
107 | + var $ds_hora_final; | |
108 | + var $turma_dia_semana; | |
109 | + var $incluir_dia_semana; | |
110 | + var $excluir_dia_semana; | |
111 | + var $visivel; | |
112 | + | |
113 | + var $dias_da_semana = array( | |
114 | + '' => 'Selecione', | |
115 | + 1 => 'Domingo', | |
116 | + 2 => 'Segunda', | |
117 | + 3 => 'Terça', | |
118 | + 4 => 'Quarta', | |
119 | + 5 => 'Quinta', | |
120 | + 6 => 'Sexta', | |
121 | + 7 => 'Sábado' | |
122 | + ); | |
123 | + | |
124 | + function Inicializar() | |
125 | + { | |
126 | + $retorno = 'Novo'; | |
127 | + | |
128 | + @session_start(); | |
129 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
130 | + @session_write_close(); | |
131 | + | |
132 | + $this->cod_turma = $_GET['cod_turma']; | |
133 | + | |
134 | + $obj_permissoes = new clsPermissoes(); | |
135 | + $obj_permissoes->permissao_cadastra(586, $this->pessoa_logada, 7, 'educar_turma_lst.php'); | |
136 | + | |
137 | + if (is_numeric($this->cod_turma)) { | |
138 | + $obj = new clsPmieducarTurma($this->cod_turma); | |
139 | + $registro = $obj->detalhe(); | |
140 | + $obj_esc = new clsPmieducarEscola($registro['ref_ref_cod_escola']); | |
141 | + $det_esc = $obj_esc->detalhe(); | |
142 | + $obj_ser = new clsPmieducarSerie($registro['ref_ref_cod_serie']); | |
143 | + $det_ser = $obj_ser->detalhe(); | |
144 | + | |
145 | + $this->ref_cod_escola = $det_esc['cod_escola']; | |
146 | + $this->ref_cod_instituicao = $det_esc['ref_cod_instituicao']; | |
147 | + $this->ref_cod_curso = $det_ser['ref_cod_curso']; | |
148 | + | |
149 | + $obj_curso = new clsPmieducarCurso(($this->ref_cod_curso)); | |
150 | + $det_curso = $obj_curso->detalhe(); | |
151 | + $this->padrao_ano_escolar = $det_curso['padrao_ano_escolar']; | |
152 | + | |
153 | + if ($registro) { | |
154 | + foreach ($registro as $campo => $val) { | |
155 | + $this->$campo = $val; | |
156 | + } | |
157 | + | |
158 | + $this->fexcluir = $obj_permissoes->permissao_excluir( | |
159 | + 586, $this->pessoa_logada, 7, 'educar_turma_lst.php' | |
160 | + ); | |
161 | + | |
162 | + $retorno = 'Editar'; | |
163 | + } | |
164 | + } | |
165 | + | |
166 | + $this->url_cancelar = $retorno == 'Editar' ? | |
167 | + 'educar_turma_det.php?cod_turma=' . $registro['cod_turma'] : 'educar_turma_lst.php'; | |
168 | + $this->nome_url_cancelar = 'Cancelar'; | |
169 | + | |
170 | + return $retorno; | |
171 | + } | |
172 | + | |
173 | + function Gerar() | |
174 | + { | |
175 | + if ($_POST) { | |
176 | + foreach ($_POST as $campo => $val) { | |
177 | + $this->$campo = $this->$campo ? $this->$campo : $val; | |
178 | + } | |
179 | + } | |
180 | + | |
181 | + $this->campoOculto('cod_turma', $this->cod_turma); | |
182 | + | |
183 | + // foreign keys | |
184 | + $obrigatorio = FALSE; | |
185 | + $instituicao_obrigatorio = TRUE; | |
186 | + $escola_curso_obrigatorio = TRUE; | |
187 | + $curso_obrigatorio = TRUE; | |
188 | + $get_escola = TRUE; | |
189 | + $get_escola_curso_serie = FALSE; | |
190 | + $sem_padrao = TRUE; | |
191 | + $get_curso = TRUE; | |
192 | + | |
193 | + include 'include/pmieducar/educar_campo_lista.php'; | |
194 | + | |
195 | + if ($this->ref_cod_escola) { | |
196 | + $this->ref_ref_cod_escola = $this->ref_cod_escola; | |
197 | + } | |
198 | + | |
199 | + $opcoes_serie = array('' => 'Selecione'); | |
200 | + | |
201 | + // Editar | |
202 | + if ($this->ref_cod_curso) { | |
203 | + $obj_serie = new clsPmieducarSerie(); | |
204 | + $obj_serie->setOrderby('nm_serie ASC'); | |
205 | + $lst_serie = $obj_serie->lista(NULL, NULL, NULL, $this->ref_cod_curso, NULL, | |
206 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
207 | + | |
208 | + if (is_array($lst_serie) && count($lst_serie)) { | |
209 | + foreach ($lst_serie as $serie) { | |
210 | + $opcoes_serie[$serie['cod_serie']] = $serie['nm_serie']; | |
211 | + } | |
212 | + } | |
213 | + } | |
214 | + | |
215 | + $script = "javascript:showExpansivelIframe(520, 550, 'educar_serie_cad_pop.php?ref_ref_cod_serie=sim');"; | |
216 | + | |
217 | + if ($this->ref_cod_instituicao && $this->ref_cod_escola && $this->ref_cod_curso) { | |
218 | + $script = sprintf("<img id='img_colecao' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick='%s'>", | |
219 | + $script); | |
220 | + } | |
221 | + else { | |
222 | + $script = sprintf("<img id='img_colecao' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick='%s'>", | |
223 | + $script); | |
224 | + } | |
225 | + | |
226 | + $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, | |
227 | + '', FALSE, '', $script); | |
228 | + | |
229 | + // Infra prédio cômodo | |
230 | + $opcoes = array('' => 'Selecione'); | |
231 | + | |
232 | + // Editar | |
233 | + if ($this->ref_ref_cod_escola) { | |
234 | + $obj_infra_predio = new clsPmieducarInfraPredio(); | |
235 | + $obj_infra_predio->setOrderby('nm_predio ASC'); | |
236 | + $lst_infra_predio = $obj_infra_predio->lista(NULL, NULL, NULL, | |
237 | + $this->ref_ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
238 | + | |
239 | + if (is_array($lst_infra_predio) && count($lst_infra_predio)) { | |
240 | + foreach ($lst_infra_predio as $predio) { | |
241 | + $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo(); | |
242 | + $lst_infra_predio_comodo = $obj_infra_predio_comodo->lista(NULL, NULL, | |
243 | + NULL, NULL, $predio['cod_infra_predio'], NULL, NULL, NULL, NULL, NULL, | |
244 | + NULL, NULL, 1); | |
245 | + | |
246 | + if (is_array($lst_infra_predio_comodo) && count($lst_infra_predio_comodo)) { | |
247 | + foreach ($lst_infra_predio_comodo as $comodo) { | |
248 | + $opcoes[$comodo['cod_infra_predio_comodo']] = $comodo['nm_comodo']; | |
249 | + } | |
250 | + } | |
251 | + } | |
252 | + } | |
253 | + } | |
254 | + | |
255 | + $this->campoLista('ref_cod_infra_predio_comodo', 'Sala', $opcoes, | |
256 | + $this->ref_cod_infra_predio_comodo, NULL, NULL, NULL, NULL, NULL, FALSE); | |
257 | + | |
258 | + $array_servidor = array( '' => 'Selecione um servidor' ); | |
259 | + if ($this->ref_cod_regente) { | |
260 | + $obj_pessoa = new clsPessoa_($this->ref_cod_regente); | |
261 | + $det = $obj_pessoa->detalhe(); | |
262 | + $array_servidor[$this->ref_cod_regente] = $det['nome']; | |
263 | + } | |
264 | + | |
265 | + $this->campoListaPesq('ref_cod_regente', 'Professor/Regente', $array_servidor, | |
266 | + $this->ref_cod_regente, '', '', FALSE, '', '', NULL, NULL, '', TRUE, FALSE, FALSE); | |
267 | + | |
268 | + // Turma tipo | |
269 | + $opcoes = array('' => 'Selecione'); | |
270 | + | |
271 | + // Editar | |
272 | + if ($this->ref_cod_instituicao) { | |
273 | + $objTemp = new clsPmieducarTurmaTipo(); | |
274 | + $objTemp->setOrderby('nm_tipo ASC'); | |
275 | + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
276 | + NULL, 1, $this->ref_cod_instituicao); | |
277 | + | |
278 | + if (is_array($lista) && count($lista)) { | |
279 | + foreach ($lista as $registro) { | |
280 | + $opcoes[$registro['cod_turma_tipo']] = $registro['nm_tipo']; | |
281 | + } | |
282 | + } | |
283 | + } | |
284 | + | |
285 | + $script = "javascript:showExpansivelIframe(520, 170, 'educar_turma_tipo_cad_pop.php');"; | |
286 | + | |
287 | + if ($this->ref_cod_instituicao && $this->ref_cod_escola && $this->ref_cod_curso) { | |
288 | + $script = sprintf("<img id='img_turma' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick='%s'>", | |
289 | + $script); | |
290 | + } | |
291 | + else { | |
292 | + $script = sprintf("<img id='img_turma' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick='%s'>", | |
293 | + $script); | |
294 | + } | |
295 | + | |
296 | + $this->campoLista('ref_cod_turma_tipo', 'Tipo de Turma', $opcoes, | |
297 | + $this->ref_cod_turma_tipo, '', FALSE, '', $script); | |
298 | + | |
299 | + $this->campoTexto('nm_turma', 'Turma', $this->nm_turma, 30, 255, TRUE); | |
300 | + | |
301 | + $this->campoTexto('sgl_turma', 'Sigla', $this->sgl_turma, 15, 15, FALSE); | |
302 | + | |
303 | + $this->campoNumero('max_aluno', 'Máximo de Alunos', $this->max_aluno, 3, 3, TRUE); | |
304 | + | |
305 | + $this->campoCheck('visivel', 'Ativo', dbBool($this->visivel)); | |
306 | + | |
307 | + $this->campoCheck('multiseriada', 'Multi-Seriada', $this->multiseriada, '', | |
308 | + FALSE, FALSE); | |
309 | + | |
310 | + $this->campoLista('ref_ref_cod_serie_mult','Série', array('' => 'Selecione'), | |
311 | + '', '', FALSE, '', '', '', FALSE); | |
312 | + | |
313 | + $this->campoOculto('ref_ref_cod_serie_mult_',$this->ref_ref_cod_serie_mult); | |
314 | + | |
315 | + $this->campoQuebra2(); | |
316 | + | |
317 | + // hora | |
318 | + $this->campoHora('hora_inicial', 'Hora Inicial', $this->hora_inicial, FALSE); | |
319 | + | |
320 | + $this->campoHora('hora_final', 'Hora Final', $this->hora_final, FALSE); | |
321 | + | |
322 | + $this->campoHora('hora_inicio_intervalo', 'Hora Início Intervalo', | |
323 | + $this->hora_inicio_intervalo, FALSE); | |
324 | + | |
325 | + $this->campoHora( 'hora_fim_intervalo', 'Hora Fim Intervalo', $this->hora_fim_intervalo, FALSE); | |
326 | + | |
327 | + // Inclui módulo | |
328 | + $this->campoQuebra(); | |
329 | + | |
330 | + if ($_POST['turma_modulo']) { | |
331 | + $this->turma_modulo = unserialize(urldecode($_POST['turma_modulo'])); | |
332 | + } | |
333 | + | |
334 | + $qtd_modulo = count($this->turma_modulo) == 0 ? 1 : (count($this->turma_modulo) + 1); | |
335 | + | |
336 | + if (is_numeric($this->cod_turma) && !$_POST) { | |
337 | + $obj = new clsPmieducarTurmaModulo(); | |
338 | + $registros = $obj->lista($this->cod_turma); | |
339 | + | |
340 | + if ($registros) { | |
341 | + foreach ($registros as $campo) { | |
342 | + $this->turma_modulo[$campo[$qtd_modulo]]['sequencial_'] = $campo['sequencial']; | |
343 | + $this->turma_modulo[$campo[$qtd_modulo]]['ref_cod_modulo_'] = $campo['ref_cod_modulo']; | |
344 | + $this->turma_modulo[$campo[$qtd_modulo]]['data_inicio_'] = dataFromPgToBr($campo['data_inicio']); | |
345 | + $this->turma_modulo[$campo[$qtd_modulo]]['data_fim_'] = dataFromPgToBr($campo['data_fim']); | |
346 | + $qtd_modulo++; | |
347 | + } | |
348 | + } | |
349 | + } | |
350 | + | |
351 | + if ($_POST["ref_cod_modulo"] && $_POST["data_inicio"] && $_POST["data_fim"]) { | |
352 | + $this->turma_modulo[$qtd_modulo]["sequencial_"] = $qtd_modulo; | |
353 | + $this->turma_modulo[$qtd_modulo]["ref_cod_modulo_"] = $_POST["ref_cod_modulo"]; | |
354 | + $this->turma_modulo[$qtd_modulo]["data_inicio_"] = $_POST["data_inicio"]; | |
355 | + $this->turma_modulo[$qtd_modulo]["data_fim_"] = $_POST["data_fim"]; | |
356 | + $qtd_modulo++; | |
357 | + | |
358 | + unset($this->ref_cod_modulo); | |
359 | + unset($this->data_inicio); | |
360 | + unset($this->data_fim); | |
361 | + } | |
362 | + | |
363 | + $this->campoOculto("excluir_modulo", ""); | |
364 | + | |
365 | + $qtd_modulo = 1; | |
366 | + | |
367 | + unset($aux); | |
368 | + | |
369 | + if ($this->turma_modulo) { | |
370 | + foreach ($this->turma_modulo as $campo) { | |
371 | + if ($this->excluir_modulo == $campo['sequencial_']) { | |
372 | + $this->turma_modulo[$campo['sequencial']] = NULL; | |
373 | + $this->excluir_modulo = NULL; | |
374 | + } | |
375 | + else { | |
376 | + $obj_modulo = new clsPmieducarModulo($campo['ref_cod_modulo_']); | |
377 | + $det_modulo = $obj_modulo->detalhe(); | |
378 | + $nm_tipo_modulo = $det_modulo['nm_tipo']; | |
379 | + | |
380 | + $this->campoTextoInv('ref_cod_modulo_' . $campo['sequencial_'], '', | |
381 | + $nm_tipo_modulo, 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_modulo'); | |
382 | + | |
383 | + $this->campoTextoInv('data_inicio_' . $campo['sequencial_'], '', | |
384 | + $campo['data_inicio_'], 10, 10, FALSE, FALSE, TRUE, '', '', '', '', ''); | |
385 | + | |
386 | + $this->campoTextoInv('data_fim_' . $campo['sequencial_'], '', $campo['data_fim_'], | |
387 | + 10, 10, FALSE, FALSE, FALSE, '', | |
388 | + "<a href='#' onclick=\"document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", | |
389 | + '', '', ''); | |
390 | + | |
391 | + $aux[$qtd_modulo]['sequencial_'] = $qtd_modulo; | |
392 | + $aux[$qtd_modulo]['ref_cod_modulo_'] = $campo['ref_cod_modulo_']; | |
393 | + $aux[$qtd_modulo]['data_inicio_'] = $campo['data_inicio_']; | |
394 | + $aux[$qtd_modulo]['data_fim_'] = $campo['data_fim_']; | |
395 | + $qtd_modulo++; | |
396 | + } | |
397 | + | |
398 | + } | |
399 | + unset($this->turma_modulo); | |
400 | + $this->turma_modulo = $aux; | |
401 | + } | |
402 | + | |
403 | + $this->campoOculto('turma_modulo', serialize($this->turma_modulo)); | |
404 | + | |
405 | + // Módulo | |
406 | + // foreign keys | |
407 | + $opcoes = array('' => 'Selecione'); | |
408 | + | |
409 | + // Editar | |
410 | + if ($this->ref_cod_instituicao) { | |
411 | + $objTemp = new clsPmieducarModulo(); | |
412 | + $objTemp->setOrderby('nm_tipo ASC'); | |
413 | + $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | |
414 | + NULL, NULL, NULL, 1, $this->ref_cod_instituicao); | |
415 | + | |
416 | + if (is_array($lista) && count($lista)) { | |
417 | + foreach ($lista as $registro) { | |
418 | + $opcoes[$registro['cod_modulo']] = $registro['nm_tipo']; | |
419 | + } | |
420 | + } | |
421 | + } | |
422 | + | |
423 | + $this->campoLista('ref_cod_modulo', 'Módulo', $opcoes, $this->ref_cod_modulo, | |
424 | + NULL, NULL, NULL, NULL, NULL, FALSE); | |
425 | + | |
426 | + $this->campoData('data_inicio', 'Data Início', $this->data_inicio, FALSE); | |
427 | + $this->campoData('data_fim', 'Data Fim', $this->data_fim, FALSE); | |
428 | + | |
429 | + $this->campoOculto('incluir_modulo', ''); | |
430 | + | |
431 | + $this->campoRotulo('bt_incluir_modulo', 'Módulo', | |
432 | + "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>" | |
433 | + ); | |
434 | + | |
435 | + $this->campoQuebra(); | |
436 | + | |
437 | + // Inclui dia da semana | |
438 | + $this->campoQuebra(); | |
439 | + | |
440 | + if ($_POST['turma_dia_semana']) { | |
441 | + $this->turma_dia_semana = unserialize(urldecode($_POST['turma_dia_semana'])); | |
442 | + } | |
443 | + | |
444 | + if (is_numeric($this->cod_turma) && !$_POST) { | |
445 | + $obj = new clsPmieducarTurmaDiaSemana(); | |
446 | + $registros = $obj->lista(NULL, $this->cod_turma); | |
447 | + | |
448 | + if ($registros) { | |
449 | + foreach ($registros as $campo) { | |
450 | + $aux['dia_semana_'] = $campo['dia_semana']; | |
451 | + $aux['hora_inicial_'] = $campo['hora_inicial']; | |
452 | + $aux['hora_final_'] = $campo['hora_final']; | |
453 | + | |
454 | + $this->turma_dia_semana[] = $aux; | |
455 | + } | |
456 | + } | |
457 | + } | |
458 | + | |
459 | + unset($aux); | |
460 | + | |
461 | + if ($_POST['dia_semana'] && $_POST['ds_hora_inicial'] && $_POST['ds_hora_final']) { | |
462 | + $aux['dia_semana_'] = $_POST['dia_semana']; | |
463 | + $aux['hora_inicial_'] = $_POST['ds_hora_inicial']; | |
464 | + $aux['hora_final_'] = $_POST['ds_hora_final']; | |
465 | + | |
466 | + $this->turma_dia_semana[] = $aux; | |
467 | + | |
468 | + unset($this->dia_semana); | |
469 | + unset($this->ds_hora_inicial); | |
470 | + unset($this->ds_hora_final); | |
471 | + } | |
472 | + | |
473 | + $this->campoOculto('excluir_dia_semana', ''); | |
474 | + unset($aux); | |
475 | + | |
476 | + if ($this->turma_dia_semana) { | |
477 | + foreach ($this->turma_dia_semana as $key => $dias_semana) { | |
478 | + if ($this->excluir_dia_semana == $dias_semana['dia_semana_']) { | |
479 | + unset($this->turma_dia_semana[$key]); | |
480 | + unset($this->excluir_dia_semana); | |
481 | + } | |
482 | + else { | |
483 | + $nm_dia_semana = $this->dias_da_semana[$dias_semana['dia_semana_']]; | |
484 | + | |
485 | + $this->campoTextoInv('dia_semana_' . $dias_semana['dia_semana_'], '', | |
486 | + $nm_dia_semana, 8, 8, FALSE, FALSE, TRUE, '', '', '', '', 'dia_semana'); | |
487 | + | |
488 | + $this->campoTextoInv('hora_inicial_' . $dias_semana['dia_semana_'], '', | |
489 | + $dias_semana['hora_inicial_'], 5, 5, FALSE, FALSE, TRUE, '', '', '', | |
490 | + '', 'ds_hora_inicial_'); | |
491 | + | |
492 | + $this->campoTextoInv('hora_final_' . $dias_semana['dia_semana_'], '', | |
493 | + $dias_semana['hora_final_'], 5, 5, FALSE, FALSE, FALSE, '', | |
494 | + "<a href='#' onclick=\"document.getElementById('excluir_dia_semana').value = '{$dias_semana["dia_semana_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", | |
495 | + '', '', 'ds_hora_final_' | |
496 | + ); | |
497 | + | |
498 | + $aux['dia_semana_'] = $dias_semana['dia_semana_']; | |
499 | + $aux['hora_inicial_'] = $dias_semana['hora_inicial_']; | |
500 | + $aux['hora_final_'] = $dias_semana['hora_final_']; | |
501 | + } | |
502 | + } | |
503 | + } | |
504 | + | |
505 | + $this->campoOculto('turma_dia_semana', serialize($this->turma_dia_semana)); | |
506 | + | |
507 | + if (class_exists('clsPmieducarTurmaDiaSemana')) { | |
508 | + $opcoes = $this->dias_da_semana; | |
509 | + } | |
510 | + else { | |
511 | + echo '<!--\nErro\nClasse clsPmieducarTurmaDiaSemana não encontrada\n-->'; | |
512 | + $opcoes = array('' => 'Erro na geração'); | |
513 | + } | |
514 | + | |
515 | + $this->campoLista('dia_semana', 'Dia Semana', $opcoes, $this->dia_semana, NULL, | |
516 | + false, '', '', false, false); | |
517 | + | |
518 | + $this->campoHora('ds_hora_inicial', 'Hora Inicial', $this->ds_hora_inicial, FALSE); | |
519 | + | |
520 | + $this->campoHora('ds_hora_final', 'Hora Final', $this->ds_hora_final, FALSE); | |
521 | + | |
522 | + $this->campoOculto('incluir_dia_semana', ''); | |
523 | + | |
524 | + $this->campoRotulo('bt_incluir_dia_semana', 'Dia Semana', | |
525 | + "<a href='#' onclick=\"document.getElementById('incluir_dia_semana').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>" | |
526 | + ); | |
527 | + | |
528 | + $this->campoQuebra(); | |
529 | + | |
530 | + $this->campoOculto('padrao_ano_escolar', $this->padrao_ano_escolar); | |
531 | + | |
532 | + $this->acao_enviar = 'valida()'; | |
533 | + } | |
534 | + | |
535 | + function Novo() | |
536 | + { | |
537 | + @session_start(); | |
538 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
539 | + @session_write_close(); | |
540 | + | |
541 | + $this->ref_cod_instituicao_regente = $this->ref_cod_instituicao; | |
542 | + | |
543 | + if ($this->multiseriada == 'on') { | |
544 | + $this->multiseriada = 1; | |
545 | + } | |
546 | + else { | |
547 | + $this->multiseriada = 0; | |
548 | + } | |
549 | + | |
550 | + if ($this->visivel == 'on') { | |
551 | + $this->visivel = TRUE; | |
552 | + } | |
553 | + else { | |
554 | + $this->visivel = FALSE; | |
555 | + } | |
556 | + | |
557 | + // Não segue o padrao do curso | |
558 | + if ($this->padrao_ano_escolar == 0) { | |
559 | + $this->turma_modulo = unserialize(urldecode($this->turma_modulo)); | |
560 | + $this->turma_dia_semana = unserialize(urldecode($this->turma_dia_semana)); | |
561 | + | |
562 | + if ($this->turma_modulo && $this->turma_dia_semana) { | |
563 | + $obj = new clsPmieducarTurma(NULL, NULL, $this->pessoa_logada, | |
564 | + $this->ref_ref_cod_serie, $this->ref_cod_escola, | |
565 | + $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, | |
566 | + $this->max_aluno, $this->multiseriada, NULL, NULL, 1, | |
567 | + $this->ref_cod_turma_tipo, NULL, NULL, NULL, NULL, $this->ref_cod_regente, | |
568 | + $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, | |
569 | + $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, | |
570 | + $this->visivel); | |
571 | + | |
572 | + $cadastrou = $obj->cadastra(); | |
573 | + | |
574 | + if ($cadastrou) { | |
575 | + // Cadastra módulo | |
576 | + foreach ($this->turma_modulo as $campo) { | |
577 | + $campo['data_inicio_'] = dataToBanco($campo['data_inicio_']); | |
578 | + $campo['data_fim_'] = dataToBanco($campo['data_fim_']); | |
579 | + | |
580 | + $obj = new clsPmieducarTurmaModulo($cadastrou, $campo['ref_cod_modulo_'], | |
581 | + $campo['sequencial_'], $campo['data_inicio_'], $campo['data_fim_']); | |
582 | + | |
583 | + $cadastrou1 = $obj->cadastra(); | |
584 | + | |
585 | + if (!$cadastrou1) { | |
586 | + $this->mensagem = 'Cadastro não realizado.'; | |
587 | + echo "<!--\nErro ao cadastrar clsPmieducarTurmaModulo\nvalores obrigatorios\nis_numeric( $cadastrou ) && is_numeric( {$campo["ref_cod_modulo_"]} ) && is_numeric( {$campo["sequencial_"]} ) && is_string( {$campo["data_inicio_"]} ) && is_string( {$campo["data_fim_"]} )\n-->"; | |
588 | + | |
589 | + return FALSE; | |
590 | + } | |
591 | + } | |
592 | + | |
593 | + // Cadastra dia semana | |
594 | + foreach ($this->turma_dia_semana as $campo) { | |
595 | + $obj = new clsPmieducarTurmaDiaSemana($campo["dia_semana_"], | |
596 | + $cadastrou, $campo["hora_inicial_"], $campo["hora_final_"]); | |
597 | + | |
598 | + $cadastrou2 = $obj->cadastra(); | |
599 | + | |
600 | + if (!$cadastrou2) { | |
601 | + $this->mensagem = 'Cadastro não realizado.'; | |
602 | + echo "<!--\nErro ao cadastrar clsPmieducarTurmaDiaSemana\nvalores obrigatórios\nis_numeric( $cadastrou ) && is_numeric( {$campo["dia_semana_"]} ) && is_string( {$campo["hora_inicial_"]} ) && is_string( {$campo["hora_final_"]} )\n-->"; | |
603 | + | |
604 | + return FALSE; | |
605 | + } | |
606 | + } | |
607 | + | |
608 | + $this->mensagem .= 'Cadastro efetuado com sucesso.'; | |
609 | + header('Location: educar_turma_lst.php'); | |
610 | + | |
611 | + die(); | |
612 | + } | |
613 | + | |
614 | + $this->mensagem = 'Cadastro não realizado.'; | |
615 | + echo "<!--\nErro ao cadastrar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
616 | + | |
617 | + return FALSE; | |
618 | + } | |
619 | + | |
620 | + echo '<script type="text/javascript">alert("É necessário adicionar pelo menos 1 módulo e 1 dia da semana!")</script>'; | |
621 | + $this->mensagem = "Cadastro não realizado."; | |
622 | + | |
623 | + return FALSE; | |
624 | + } | |
625 | + | |
626 | + // Segue o padrão do ano escolar | |
627 | + elseif ($this->padrao_ano_escolar == 1) { | |
628 | + $obj = new clsPmieducarTurma(null, null, $this->pessoa_logada, | |
629 | + $this->ref_ref_cod_serie, $this->ref_cod_escola, | |
630 | + $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, | |
631 | + $this->max_aluno, $this->multiseriada, null, null, 1, | |
632 | + $this->ref_cod_turma_tipo, $this->hora_inicial, $this->hora_final, | |
633 | + $this->hora_inicio_intervalo, $this->hora_fim_intervalo, | |
634 | + $this->ref_cod_regente, $this->ref_cod_instituicao_regente, | |
635 | + $this->ref_cod_instituicao, $this->ref_cod_curso, | |
636 | + $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, $this->visivel); | |
637 | + | |
638 | + $cadastrou = $obj->cadastra(); | |
639 | + | |
640 | + if ($cadastrou) { | |
641 | + $this->mensagem .= 'Cadastro efetuado com sucesso.'; | |
642 | + header('Location: educar_turma_lst.php'); | |
643 | + die(); | |
644 | + } | |
645 | + | |
646 | + $this->mensagem = 'Cadastro não realizado.'; | |
647 | + echo "<!--\nErro ao cadastrar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
648 | + | |
649 | + return FALSE; | |
650 | + } | |
651 | + } | |
652 | + | |
653 | + function Editar() | |
654 | + { | |
655 | + @session_start(); | |
656 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
657 | + @session_write_close(); | |
658 | + | |
659 | + $this->ref_cod_instituicao_regente = $this->ref_cod_instituicao; | |
660 | + | |
661 | + if ($this->multiseriada == 'on') { | |
662 | + $this->multiseriada = 1; | |
663 | + } | |
664 | + else { | |
665 | + $this->multiseriada = 0; | |
666 | + } | |
667 | + | |
668 | + if ($this->visivel == 'on') { | |
669 | + $this->visivel = TRUE; | |
670 | + } | |
671 | + else { | |
672 | + $this->visivel = FALSE; | |
673 | + } | |
674 | + | |
675 | + // Não segue o padrão do curso | |
676 | + if ($this->padrao_ano_escolar == 0) { | |
677 | + $this->turma_modulo = unserialize(urldecode($this->turma_modulo)); | |
678 | + $this->turma_dia_semana = unserialize(urldecode($this->turma_dia_semana)); | |
679 | + | |
680 | + if ($this->turma_modulo && $this->turma_dia_semana) { | |
681 | + $obj = new clsPmieducarTurma($this->cod_turma, $this->pessoa_logada, NULL, | |
682 | + $this->ref_ref_cod_serie, $this->ref_cod_escola, | |
683 | + $this->ref_cod_infra_predio_comodo, $this->nm_turma, $this->sgl_turma, | |
684 | + $this->max_aluno, $this->multiseriada, NULL, NULL, 1, | |
685 | + $this->ref_cod_turma_tipo, NULL, NULL, NULL, NULL, $this->ref_cod_regente, | |
686 | + $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, | |
687 | + $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, | |
688 | + $this->visivel); | |
689 | + | |
690 | + $editou = $obj->edita(); | |
691 | + | |
692 | + if ($editou) { | |
693 | + $obj = new clsPmieducarTurmaModulo(); | |
694 | + $excluiu = $obj->excluirTodos($this->cod_turma); | |
695 | + | |
696 | + if ($excluiu) { | |
697 | + foreach ($this->turma_modulo as $campo) { | |
698 | + $campo['data_inicio_'] = dataToBanco($campo['data_inicio_']); | |
699 | + $campo['data_fim_'] = dataToBanco($campo['data_fim_']); | |
700 | + | |
701 | + $obj = new clsPmieducarTurmaModulo($this->cod_turma, | |
702 | + $campo['ref_cod_modulo_'], $campo['sequencial_'], | |
703 | + $campo['data_inicio_'], $campo['data_fim_']); | |
704 | + | |
705 | + $cadastrou1 = $obj->cadastra(); | |
706 | + if (!$cadastrou1) { | |
707 | + $this->mensagem = 'Edição não realizada.'; | |
708 | + echo "<!--\nErro ao editar clsPmieducarTurmaModulo\nvalores obrigatorios\nis_numeric( $this->cod_turma ) && is_numeric( {$campo["ref_cod_modulo_"]} ) \n-->"; | |
709 | + | |
710 | + return FALSE; | |
711 | + } | |
712 | + } | |
713 | + } | |
714 | + | |
715 | + // Edita o dia da semana | |
716 | + $obj = new clsPmieducarTurmaDiaSemana(NULL, $this->cod_turma); | |
717 | + $excluiu = $obj->excluirTodos(); | |
718 | + | |
719 | + if ($excluiu) { | |
720 | + foreach ($this->turma_dia_semana as $campo) { | |
721 | + $obj = new clsPmieducarTurmaDiaSemana($campo["dia_semana_"], | |
722 | + $this->cod_turma, $campo["hora_inicial_"], $campo["hora_final_"]); | |
723 | + | |
724 | + $cadastrou2 = $obj->cadastra(); | |
725 | + | |
726 | + if (!$cadastrou2) { | |
727 | + $this->mensagem = 'Edição não realizada.'; | |
728 | + echo "<!--\nErro ao editar clsPmieducarTurmaDiaSemana\nvalores obrigatórios\nis_numeric( $this->cod_turma ) && is_numeric( {$campo["dia_semana_"]} ) \n-->"; | |
729 | + | |
730 | + return FALSE; | |
731 | + } | |
732 | + } | |
733 | + } | |
734 | + } | |
735 | + else { | |
736 | + $this->mensagem = 'Edição não realizada.'; | |
737 | + echo "<!--\nErro ao editar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
738 | + | |
739 | + return FALSE; | |
740 | + } | |
741 | + } | |
742 | + else { | |
743 | + echo '<script type="text/javascript">alert("É necessário adicionar pelo menos 1 módulo e 1 dia da semana!")</script>'; | |
744 | + $this->mensagem = 'Edição não realizada.'; | |
745 | + | |
746 | + return FALSE; | |
747 | + } | |
748 | + } | |
749 | + | |
750 | + // Segue o padrão do curso | |
751 | + elseif ($this->padrao_ano_escolar == 1) { | |
752 | + $obj = new clsPmieducarTurma($this->cod_turma, $this->pessoa_logada, NULL, | |
753 | + $this->ref_ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_infra_predio_comodo, | |
754 | + $this->nm_turma, $this->sgl_turma, $this->max_aluno, $this->multiseriada, | |
755 | + NULL, NULL, 1, $this->ref_cod_turma_tipo, $this->hora_inicial, $this->hora_final, | |
756 | + $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, | |
757 | + $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, | |
758 | + $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, | |
759 | + $this->visivel); | |
760 | + | |
761 | + $editou = $obj->edita(); | |
762 | + } | |
763 | + | |
764 | + if ($editou) { | |
765 | + $this->mensagem .= 'Edição efetuada com sucesso.'; | |
766 | + header('Location: educar_turma_lst.php'); | |
767 | + die(); | |
768 | + } | |
769 | + else { | |
770 | + $this->mensagem = 'Edição não realizada.'; | |
771 | + echo "<!--\nErro ao editar clsPmieducarTurma\nvalores obrigatorios\nis_numeric( $this->pessoa_logada ) && is_numeric( $this->ref_ref_cod_serie ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->ref_cod_infra_predio_comodo ) && is_string( $this->nm_turma ) && is_numeric( $this->max_aluno ) && is_numeric( $this->multiseriada ) && is_numeric( $this->ref_cod_turma_tipo )\n-->"; | |
772 | + | |
773 | + return FALSE; | |
774 | + } | |
775 | + } | |
776 | + | |
777 | + function Excluir() | |
778 | + { | |
779 | + @session_start(); | |
780 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
781 | + @session_write_close(); | |
782 | + | |
783 | + $obj = new clsPmieducarTurma($this->cod_turma, $this->pessoa_logada, null, | |
784 | + null, null, null, null, null, null, null, null, null, 0); | |
785 | + | |
786 | + $excluiu = $obj->excluir(); | |
787 | + | |
788 | + if ($excluiu) { | |
789 | + $obj = new clsPmieducarTurmaModulo(); | |
790 | + $excluiu1 = $obj->excluirTodos($this->cod_turma); | |
791 | + | |
792 | + if ($excluiu1) { | |
793 | + $obj = new clsPmieducarTurmaDiaSemana(NULL, $this->cod_turma); | |
794 | + $excluiu2 = $obj->excluirTodos(); | |
795 | + | |
796 | + if ($excluiu2) { | |
797 | + $this->mensagem .= 'Exclusão efetuada com sucesso.'; | |
798 | + header('Location: educar_turma_lst.php'); | |
799 | + die(); | |
800 | + } | |
801 | + else { | |
802 | + $this->mensagem = 'Exclusão não realizada.'; | |
803 | + echo "<!--\nErro ao excluir clsPmieducarTurma\nvalores obrigatorios\nif( is_numeric( $this->cod_turma ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
804 | + | |
805 | + return FALSE; | |
806 | + } | |
807 | + } | |
808 | + else | |
809 | + { | |
810 | + $this->mensagem = 'Exclusão não realizada.'; | |
811 | + echo "<!--\nErro ao excluir clsPmieducarTurma\nvalores obrigatorios\nif( is_numeric( $this->cod_turma ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
812 | + | |
813 | + return FALSE; | |
814 | + } | |
815 | + } | |
816 | + | |
817 | + $this->mensagem = 'Exclusão não realizada.'; | |
818 | + echo "<!--\nErro ao excluir clsPmieducarTurma\nvalores obrigatorios\nif( is_numeric( $this->cod_turma ) && is_numeric( $this->pessoa_logada ) )\n-->"; | |
819 | + | |
820 | + return FALSE; | |
821 | + } | |
804 | 822 | } |
805 | 823 | |
806 | -// cria uma extensao da classe base | |
824 | +// Instancia objeto de página | |
807 | 825 | $pagina = new clsIndexBase(); |
808 | -// cria o conteudo | |
826 | + | |
827 | +// Instancia objeto de conteúdo | |
809 | 828 | $miolo = new indice(); |
810 | -// adiciona o conteudo na clsBase | |
811 | -$pagina->addForm( $miolo ); | |
812 | -// gera o html | |
829 | + | |
830 | +// Atribui o conteúdo à página | |
831 | +$pagina->addForm($miolo); | |
832 | + | |
833 | +// Gera o código HTML | |
813 | 834 | $pagina->MakeAll(); |
814 | 835 | ?> |
815 | - | |
816 | 836 | <script type='text/javascript'> |
817 | - | |
818 | 837 | function getComodo() |
819 | 838 | { |
820 | - //setTimeout( function() { | |
821 | - var campoEscola = document.getElementById('ref_cod_escola').value; | |
822 | - var campoComodo = document.getElementById('ref_cod_infra_predio_comodo'); | |
823 | - campoComodo.disabled = true; | |
824 | - | |
825 | - campoComodo.length = 1; | |
826 | - campoComodo.options[0] = new Option( 'Selecione uma sala', '', false, false ); | |
827 | - | |
828 | - var xml1 = new ajax(atualizaTurmaCad_TipoComodo); | |
829 | - strURL = "educar_escola_comodo_xml.php?esc="+campoEscola; | |
830 | - xml1.envia(strURL); | |
831 | -// DOM_execute_when_xmlhttpChange = function() { atualizaTurmaCad_TipoComodo(); }; | |
832 | -// strURL = "educar_escola_comodo_xml.php?esc="+campoEscola; | |
833 | -// DOM_loadXMLDoc( strURL ); | |
834 | - //}, 1500 ); | |
835 | - | |
836 | - // var campoEscola = document.getElementById('ref_cod_escola').value; | |
837 | -// var campoComodo = document.getElementById('ref_cod_infra_predio_comodo'); | |
838 | -// | |
839 | -// campoComodo.length = 1; | |
840 | -// campoComodo.options[0] = new Option( 'Selecione uma sala', '', false, false ); | |
841 | -// for (var j = 0; j < comodo.length; j++) | |
842 | -// { | |
843 | -// if (comodo[j][2] == campoEscola) | |
844 | -// { | |
845 | -// campoComodo.options[campoComodo.options.length] = new Option( comodo[j][1], comodo[j][0],false,false); | |
846 | -// } | |
847 | -// } | |
848 | -// if ( campoComodo.length == 1 && campoEscola != '' ) | |
849 | -// { | |
850 | -// campoComodo.options[0] = new Option( 'A escola não possui nenhuma sala', '', false, false ); | |
851 | -// } | |
839 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
840 | + var campoComodo = document.getElementById('ref_cod_infra_predio_comodo'); | |
841 | + campoComodo.disabled = true; | |
842 | + | |
843 | + campoComodo.length = 1; | |
844 | + campoComodo.options[0] = new Option('Selecione uma sala', '', false, false); | |
845 | + | |
846 | + var xml1 = new ajax(atualizaTurmaCad_TipoComodo); | |
847 | + strURL = 'educar_escola_comodo_xml.php?esc=' + campoEscola; | |
848 | + xml1.envia(strURL); | |
852 | 849 | } |
853 | 850 | |
854 | 851 | function atualizaTurmaCad_TipoComodo(xml) |
855 | 852 | { |
856 | - var campoComodo = document.getElementById('ref_cod_infra_predio_comodo'); | |
857 | - campoComodo.disabled = false; | |
858 | - | |
859 | - var tipo_comodo = xml.getElementsByTagName( "item" ); | |
860 | - | |
861 | - if(tipo_comodo.length) | |
862 | - { | |
863 | - for(var i = 0; i < tipo_comodo.length; i+=2 ) | |
864 | - { | |
865 | - campoComodo.options[campoComodo.options.length] = new Option( tipo_comodo[i+1].firstChild.data, tipo_comodo[i].firstChild.data,false,false); | |
866 | - } | |
867 | - } | |
868 | - else | |
869 | - { | |
870 | - campoComodo.length = 1; | |
871 | - campoComodo.options[0] = new Option( 'A escola não possui nenhuma Sala', '', false, false ); | |
872 | - } | |
853 | + var campoComodo = document.getElementById('ref_cod_infra_predio_comodo'); | |
854 | + campoComodo.disabled = false; | |
855 | + | |
856 | + var tipo_comodo = xml.getElementsByTagName('item'); | |
857 | + | |
858 | + if (tipo_comodo.length) { | |
859 | + for (var i = 0; i < tipo_comodo.length; i += 2) { | |
860 | + campoComodo.options[campoComodo.options.length] = new Option( | |
861 | + tipo_comodo[i + 1].firstChild.data, tipo_comodo[i].firstChild.data, false, false | |
862 | + ); | |
863 | + } | |
864 | + } | |
865 | + else { | |
866 | + campoComodo.length = 1; | |
867 | + campoComodo.options[0] = new Option('A escola não possui nenhuma Sala', '', false, false); | |
868 | + } | |
873 | 869 | } |
874 | 870 | |
875 | 871 | function getTipoTurma() |
876 | 872 | { |
877 | - //setTimeout( function() { | |
878 | - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
879 | - var campoTipoTurma = document.getElementById('ref_cod_turma_tipo'); | |
880 | - campoTipoTurma.disabled = true; | |
881 | - | |
882 | - campoTipoTurma.length = 1; | |
883 | - campoTipoTurma.options[0] = new Option( 'Selecione um tipo de turma', '', false, false ); | |
884 | - | |
885 | - var xml1 = new ajax(atualizaTurmaCad_TipoTurma); | |
886 | - strURL = "educar_tipo_turma_xml.php?ins="+campoInstituicao; | |
887 | - xml1.envia(strURL); | |
888 | - | |
889 | -// DOM_execute_when_xmlhttpChange = function() { atualizaTurmaCad_TipoTurma(); }; | |
890 | -// strURL = "educar_tipo_turma_xml.php?ins="+campoInstituicao; | |
891 | -// DOM_loadXMLDoc( strURL ); | |
892 | - //}, 1500 ); | |
893 | - | |
894 | -// for (var j = 0; j < tipo_turma.length; j++) | |
895 | -// { | |
896 | -// if (tipo_turma[j][2] == campoEscola) | |
897 | -// { | |
898 | -// campoTipoTurma.options[campoTipoTurma.options.length] = new Option( tipo_turma[j][1], tipo_turma[j][0],false,false); | |
899 | -// } | |
900 | -// } | |
901 | -// if ( campoTipoTurma.length == 1 && campoEscola != '' ) | |
902 | -// { | |
903 | -// campoTipoTurma.options[0] = new Option( 'A instituição não possui nenhum tipo de turma', '', false, false ); | |
904 | -// } | |
873 | + var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
874 | + var campoTipoTurma = document.getElementById('ref_cod_turma_tipo'); | |
875 | + campoTipoTurma.disabled = true; | |
876 | + | |
877 | + campoTipoTurma.length = 1; | |
878 | + campoTipoTurma.options[0] = new Option('Selecione um tipo de turma', '', false, false); | |
879 | + | |
880 | + var xml1 = new ajax(atualizaTurmaCad_TipoTurma); | |
881 | + strURL = 'educar_tipo_turma_xml.php?ins=' + campoInstituicao; | |
882 | + xml1.envia(strURL); | |
905 | 883 | } |
906 | 884 | |
907 | 885 | function atualizaTurmaCad_TipoTurma(xml) |
908 | 886 | { |
909 | - var tipo_turma = xml.getElementsByTagName( "item" ); | |
910 | - var campoTipoTurma = document.getElementById('ref_cod_turma_tipo'); | |
911 | - campoTipoTurma.disabled = false; | |
912 | - | |
913 | - if(tipo_turma.length) | |
914 | - { | |
915 | - for(var i = 0; i < tipo_turma.length; i+=2 ) | |
916 | - { | |
917 | - campoTipoTurma.options[campoTipoTurma.options.length] = new Option( tipo_turma[i+1].firstChild.data, tipo_turma[i].firstChild.data,false,false); | |
918 | - } | |
919 | - } | |
920 | - else | |
921 | - { | |
922 | - campoTipoTurma.length = 1; | |
923 | - campoTipoTurma.options[0] = new Option( 'A instituição não possui nenhum Tipo de Turma', '', false, false ); | |
924 | - } | |
887 | + var tipo_turma = xml.getElementsByTagName('item'); | |
888 | + var campoTipoTurma = document.getElementById('ref_cod_turma_tipo'); | |
889 | + campoTipoTurma.disabled = false; | |
890 | + | |
891 | + if (tipo_turma.length) { | |
892 | + for (var i = 0; i < tipo_turma.length; i += 2) { | |
893 | + campoTipoTurma.options[campoTipoTurma.options.length] = new Option( | |
894 | + tipo_turma[i + 1].firstChild.data, tipo_turma[i].firstChild.data, false, false | |
895 | + ); | |
896 | + } | |
897 | + } | |
898 | + else { | |
899 | + campoTipoTurma.length = 1; | |
900 | + campoTipoTurma.options[0] = new Option( | |
901 | + 'A instituição não possui nenhum Tipo de Turma', '', false, false | |
902 | + ); | |
903 | + } | |
925 | 904 | } |
926 | 905 | |
927 | 906 | function getModulo() |
928 | 907 | { |
929 | - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
930 | - var campoEscola = document.getElementById('ref_cod_instituicao').value; | |
931 | - var campoModulo = document.getElementById('ref_cod_modulo'); | |
932 | - | |
933 | - /*campoModulo.length = 1; | |
934 | - campoModulo.options[0] = new Option( 'Selecione um módulo', '', false, false ); | |
935 | - for (var j = 0; j < modulo.length; j++) | |
936 | - { | |
937 | - if (modulo[j][2] == campoInstituicao) | |
938 | - { | |
939 | - campoModulo.options[campoModulo.options.length] = new Option( modulo[j][1], modulo[j][0],false,false); | |
940 | - } | |
941 | - } | |
942 | - if ( campoModulo.length == 1 && campoInstituicao != '' ) | |
943 | - { | |
944 | - campoModulo.options[0] = new Option( 'A Instituição não possui nenhum módulo', '', false, false ); | |
945 | - }*/ | |
946 | - | |
947 | - //var campoInstituicao = $('ref_cod_instituicao').value; | |
948 | - | |
949 | - var url = "educar_modulo_instituicao_xml.php"; | |
950 | - var pars = '?inst=' + campoInstituicao; | |
951 | - | |
952 | - var xml1 = new ajax(getModulo_xml); | |
953 | - strURL = url+pars; | |
954 | - xml1.envia(strURL); | |
955 | - | |
956 | -// var myAjax = new Ajax.Request( | |
957 | -// url, | |
958 | -// { | |
959 | -// method: 'get', | |
960 | -// parameters: pars, | |
961 | -// onComplete: getModulo_xml | |
962 | -// }); | |
963 | - //setTimeout( function() { | |
964 | -// DOM_execute_when_xmlhttpChange = function() { getModulo_xml(); }; | |
965 | -// strURL = "educar_modulo_instituicao_xml.php?inst="+campoInstituicao; | |
966 | -// DOM_loadXMLDoc( strURL ); | |
967 | - //} | |
968 | - //,1500); | |
969 | -} | |
970 | - | |
971 | -function getModulo_xml(xml) | |
972 | -{ | |
973 | - | |
974 | - var campoModulo = document.getElementById('ref_cod_modulo'); | |
975 | - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
976 | - campoModulo.length = 1; | |
977 | - campoModulo.options[0] = new Option( 'Selecione um módulo', '', false, false ); | |
908 | + var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
909 | + var campoEscola = document.getElementById('ref_cod_instituicao').value; | |
910 | + var campoModulo = document.getElementById('ref_cod_modulo'); | |
978 | 911 | |
979 | - var DOM_modulos = xml.getElementsByTagName( "item" ); | |
912 | + var url = 'educar_modulo_instituicao_xml.php'; | |
913 | + var pars = '?inst=' + campoInstituicao; | |
980 | 914 | |
981 | - for (var j = 0; j < DOM_modulos.length; j+=2) | |
982 | - { | |
983 | - | |
984 | - campoModulo.options[campoModulo.options.length] = new Option( DOM_modulos[j+1].firstChild.nodeValue, DOM_modulos[j].firstChild.nodeValue,false,false); | |
985 | - | |
986 | - } | |
987 | - if ( campoModulo.length == 1 && campoInstituicao != '' ) | |
988 | - { | |
989 | - campoModulo.options[0] = new Option( 'A Instituição não possui nenhum módulo', '', false, false ); | |
990 | - } | |
915 | + var xml1 = new ajax(getModulo_xml); | |
916 | + strURL = url + pars; | |
917 | + xml1.envia(strURL); | |
991 | 918 | } |
992 | -// SE PADRAO_ANO_ESCOLAR == 1 | |
993 | 919 | |
994 | -var evtOnLoad =function() | |
995 | -{ | |
996 | - | |
997 | -setVisibility('tr_hora_inicial',false); | |
998 | -setVisibility('tr_hora_final',false); | |
999 | -setVisibility('tr_hora_inicio_intervalo',false); | |
1000 | -setVisibility('tr_hora_fim_intervalo',false); | |
1001 | - | |
1002 | -// SE PADRAO_ANO_ESCOLAR == 0 | |
1003 | - // INCLUI MODULO | |
1004 | -setVisibility('tr_ref_cod_modulo',false); | |
1005 | -setVisibility('ref_cod_modulo',false); | |
1006 | -setVisibility('tr_data_inicio',false); | |
1007 | -setVisibility('tr_data_fim',false); | |
1008 | -setVisibility('tr_bt_incluir_modulo',false); | |
1009 | - | |
1010 | -// SE PADRAO_ANO_ESCOLAR == 0 | |
1011 | - // INCLUI DIA SEMANA | |
1012 | -setVisibility('tr_dia_semana',false); | |
1013 | -setVisibility('tr_ds_hora_inicial',false); | |
1014 | -setVisibility('tr_ds_hora_final',false); | |
1015 | -setVisibility('tr_bt_incluir_dia_semana',false); | |
1016 | - | |
1017 | -if(!document.getElementById('ref_ref_cod_serie').value){ | |
1018 | - setVisibility('tr_multiseriada',false); | |
1019 | - setVisibility('tr_ref_ref_cod_serie_mult',document.getElementById('multiseriada').checked ? true : false); | |
1020 | - setVisibility('ref_ref_cod_serie_mult',document.getElementById('multiseriada').checked ? true : false); | |
1021 | - | |
1022 | -}else | |
920 | +function getModulo_xml(xml) | |
1023 | 921 | { |
1024 | - | |
1025 | - if(document.getElementById('multiseriada').checked){ | |
1026 | - changeMultiSerie(); | |
1027 | - document.getElementById('ref_ref_cod_serie_mult').value = document.getElementById('ref_ref_cod_serie_mult_').value; | |
1028 | - }else | |
1029 | - { | |
1030 | - | |
1031 | - setVisibility('tr_ref_ref_cod_serie_mult',document.getElementById('multiseriada').checked ? true : false); | |
1032 | - setVisibility('ref_ref_cod_serie_mult',document.getElementById('multiseriada').checked ? true : false); | |
1033 | - } | |
1034 | - | |
922 | + var campoModulo = document.getElementById('ref_cod_modulo'); | |
923 | + var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
924 | + | |
925 | + campoModulo.length = 1; | |
926 | + campoModulo.options[0] = new Option('Selecione um módulo', '', false, false); | |
927 | + | |
928 | + var DOM_modulos = xml.getElementsByTagName('item'); | |
929 | + | |
930 | + for (var j = 0; j < DOM_modulos.length; j += 2) { | |
931 | + campoModulo.options[campoModulo.options.length] = new Option( | |
932 | + DOM_modulos[j + 1].firstChild.nodeValue, DOM_modulos[j].firstChild.nodeValue, | |
933 | + false, false | |
934 | + ); | |
935 | + } | |
936 | + | |
937 | + if (campoModulo.length == 1 && campoInstituicao != '') { | |
938 | + campoModulo.options[0] = new Option( | |
939 | + 'A Instituição não possui nenhum módulo', '', false, false | |
940 | + ); | |
941 | + } | |
1035 | 942 | } |
1036 | 943 | |
1037 | -// HIDE quebra de linha | |
1038 | - | |
1039 | -var hr_tag = document.getElementsByTagName('hr'); | |
1040 | -for(var ct = 0;ct <hr_tag.length;ct++) | |
944 | +var evtOnLoad = function() | |
1041 | 945 | { |
1042 | - setVisibility(hr_tag[ct].parentNode.parentNode,false); | |
946 | + setVisibility('tr_hora_inicial',false); | |
947 | + setVisibility('tr_hora_final',false); | |
948 | + setVisibility('tr_hora_inicio_intervalo',false); | |
949 | + setVisibility('tr_hora_fim_intervalo',false); | |
950 | + | |
951 | + // Inclui módulo | |
952 | + setVisibility('tr_ref_cod_modulo',false); | |
953 | + setVisibility('ref_cod_modulo',false); | |
954 | + setVisibility('tr_data_inicio',false); | |
955 | + setVisibility('tr_data_fim',false); | |
956 | + setVisibility('tr_bt_incluir_modulo',false); | |
957 | + | |
958 | + // Inclui dia da semana | |
959 | + setVisibility('tr_dia_semana',false); | |
960 | + setVisibility('tr_ds_hora_inicial',false); | |
961 | + setVisibility('tr_ds_hora_final',false); | |
962 | + setVisibility('tr_bt_incluir_dia_semana',false); | |
963 | + | |
964 | + if (!document.getElementById('ref_ref_cod_serie').value) { | |
965 | + setVisibility('tr_multiseriada',false); | |
966 | + setVisibility('tr_ref_ref_cod_serie_mult', document.getElementById('multiseriada').checked ? true : false); | |
967 | + setVisibility('ref_ref_cod_serie_mult', document.getElementById('multiseriada').checked ? true : false); | |
968 | + } | |
969 | + else { | |
970 | + if(document.getElementById('multiseriada').checked){ | |
971 | + changeMultiSerie(); | |
972 | + document.getElementById('ref_ref_cod_serie_mult').value = | |
973 | + document.getElementById('ref_ref_cod_serie_mult_').value; | |
974 | + } | |
975 | + else { | |
976 | + setVisibility('tr_ref_ref_cod_serie_mult', document.getElementById('multiseriada').checked ? true : false); | |
977 | + setVisibility('ref_ref_cod_serie_mult', document.getElementById('multiseriada').checked ? true : false); | |
978 | + } | |
979 | + } | |
980 | + | |
981 | + // HIDE quebra de linha | |
982 | + var hr_tag = document.getElementsByTagName('hr'); | |
983 | + | |
984 | + for (var ct = 0; ct < hr_tag.length; ct++) { | |
985 | + setVisibility(hr_tag[ct].parentNode.parentNode, false); | |
986 | + } | |
987 | + | |
988 | + if (document.getElementById('ref_cod_curso').value) { | |
989 | + if (document.getElementById('padrao_ano_escolar').value == 1) { | |
990 | + setVisibility('tr_hora_inicial', true); | |
991 | + setVisibility('tr_hora_final', true); | |
992 | + setVisibility('tr_hora_inicio_intervalo', true); | |
993 | + setVisibility('tr_hora_fim_intervalo', true); | |
994 | + } | |
995 | + else if (document.getElementById('padrao_ano_escolar').value == 0) { | |
996 | + setVisibility('tr_ref_cod_modulo', true); | |
997 | + setVisibility('ref_cod_modulo', true); | |
998 | + setVisibility('tr_data_inicio', true); | |
999 | + setVisibility('tr_data_fim', true); | |
1000 | + setVisibility('tr_bt_incluir_modulo', true); | |
1001 | + | |
1002 | + setVisibility('tr_dia_semana', true); | |
1003 | + setVisibility('tr_ds_hora_inicial', true); | |
1004 | + setVisibility('tr_ds_hora_final', true); | |
1005 | + setVisibility('tr_bt_incluir_dia_semana', true); | |
1006 | + | |
1007 | + var hr_tag = document.getElementsByTagName('hr'); | |
1008 | + for (var ct = 0;ct < hr_tag.length; ct++) { | |
1009 | + setVisibility(hr_tag[ct].parentNode.parentNode, true); | |
1010 | + } | |
1011 | + } | |
1012 | + } | |
1043 | 1013 | } |
1044 | 1014 | |
1045 | - | |
1046 | -if ( document.getElementById('ref_cod_curso').value ) | |
1047 | -{ | |
1048 | - /*var aux; | |
1049 | - var inc = 0; | |
1050 | - if(document.getElementById('ref_cod_escola').value) | |
1051 | - { | |
1052 | - | |
1053 | - aux = escola_curso; | |
1054 | - } | |
1055 | - else | |
1056 | - { | |
1057 | - aux = curso; | |
1058 | - inc = 1; | |
1059 | - }*/ | |
1060 | - | |
1061 | - | |
1062 | -// for (var j = 0; j < aux.length; j++) | |
1063 | - ///{ | |
1064 | - //if (aux[j][0] == document.getElementById('ref_cod_curso').value) | |
1065 | - //{ | |
1066 | - if (document.getElementById('padrao_ano_escolar').value /*aux[j][3 + inc]*/ == 1) | |
1067 | - { | |
1068 | - setVisibility('tr_hora_inicial',true); | |
1069 | - setVisibility('tr_hora_final',true); | |
1070 | - setVisibility('tr_hora_inicio_intervalo',true); | |
1071 | - setVisibility('tr_hora_fim_intervalo',true); | |
1072 | - } | |
1073 | - else if (document.getElementById('padrao_ano_escolar').value /*aux[j][3 + inc]*/ == 0) | |
1074 | - { | |
1075 | - setVisibility('tr_ref_cod_modulo',true); | |
1076 | - setVisibility('ref_cod_modulo',true); | |
1077 | - setVisibility('tr_data_inicio',true); | |
1078 | - setVisibility('tr_data_fim',true); | |
1079 | - setVisibility('tr_bt_incluir_modulo',true); | |
1080 | - | |
1081 | - setVisibility('tr_dia_semana',true); | |
1082 | - setVisibility('tr_ds_hora_inicial',true); | |
1083 | - setVisibility('tr_ds_hora_final',true); | |
1084 | - setVisibility('tr_bt_incluir_dia_semana',true); | |
1085 | - | |
1086 | - // SHOW quebra de linha | |
1087 | - var hr_tag = document.getElementsByTagName('hr'); | |
1088 | - for(var ct = 0;ct <hr_tag.length;ct++) | |
1089 | - { | |
1090 | - setVisibility(hr_tag[ct].parentNode.parentNode,true); | |
1091 | - } | |
1092 | - } | |
1093 | - //} | |
1094 | - //} | |
1015 | +if (window.addEventListener) { | |
1016 | + // Mozilla | |
1017 | + window.addEventListener('load', evtOnLoad, false); | |
1095 | 1018 | } |
1096 | - | |
1019 | +else if (window.attachEvent) { | |
1020 | + // IE | |
1021 | + window.attachEvent('onload', evtOnLoad); | |
1097 | 1022 | } |
1098 | 1023 | |
1099 | -if( window.addEventListener ) { | |
1100 | - //mozilla | |
1101 | - window.addEventListener('load',evtOnLoad,false); | |
1102 | -} else if ( window.attachEvent ) { | |
1103 | - //ie | |
1104 | - window.attachEvent('onload',evtOnLoad); | |
1105 | -} | |
1106 | 1024 | before_getEscola = function() |
1107 | 1025 | { |
1108 | - | |
1109 | - getModulo(); | |
1110 | - getTipoTurma(); | |
1111 | - //hideMultiSerie(); | |
1112 | - //PadraoAnoEscolar(null); | |
1113 | - document.getElementById('ref_cod_escola').onchange(); | |
1026 | + getModulo(); | |
1027 | + getTipoTurma(); | |
1028 | + document.getElementById('ref_cod_escola').onchange(); | |
1114 | 1029 | } |
1115 | 1030 | |
1116 | 1031 | document.getElementById('ref_cod_escola').onchange = function() |
1117 | 1032 | { |
1118 | - getEscolaCurso(); | |
1119 | - getComodo(); | |
1120 | - changeMultiSerie(); | |
1121 | - getEscolaCursoSerie(); | |
1122 | - PadraoAnoEscolar(null); | |
1123 | - changeMultiSerie(); | |
1124 | - hideMultiSerie(); | |
1125 | - if(document.getElementById('ref_cod_escola').value == '') | |
1126 | - { | |
1127 | - getCurso(); | |
1128 | - } | |
1129 | - $('img_colecao').style.display = 'none;'; | |
1130 | - if ($F('ref_cod_instituicao') == '') | |
1131 | - { | |
1132 | - $('img_turma').style.display = 'none;'; | |
1133 | - } | |
1134 | - else | |
1135 | - { | |
1136 | - $('img_turma').style.display = ''; | |
1137 | - } | |
1138 | -// getModulo(); | |
1033 | + getEscolaCurso(); | |
1034 | + getComodo(); | |
1035 | + changeMultiSerie(); | |
1036 | + getEscolaCursoSerie(); | |
1037 | + PadraoAnoEscolar(null); | |
1038 | + changeMultiSerie(); | |
1039 | + hideMultiSerie(); | |
1040 | + | |
1041 | + if (document.getElementById('ref_cod_escola').value == '') { | |
1042 | + getCurso(); | |
1043 | + } | |
1044 | + | |
1045 | + $('img_colecao').style.display = 'none;'; | |
1046 | + | |
1047 | + if ($F('ref_cod_instituicao') == '') { | |
1048 | + $('img_turma').style.display = 'none;'; | |
1049 | + } | |
1050 | + else { | |
1051 | + $('img_turma').style.display = ''; | |
1052 | + } | |
1139 | 1053 | } |
1140 | 1054 | |
1141 | -//before_getEscola = function() { getTipoTurma(); } | |
1142 | - | |
1143 | 1055 | document.getElementById('ref_cod_curso').onchange = function() |
1144 | 1056 | { |
1145 | - setVisibility('tr_multiseriada',document.getElementById('ref_ref_cod_serie').value ? true : false); | |
1146 | - setVisibility('tr_ref_ref_cod_serie_mult',document.getElementById('multiseriada').checked ? true : false); | |
1147 | - setVisibility('ref_ref_cod_serie_mult',document.getElementById('multiseriada').checked ? true : false); | |
1148 | - | |
1149 | - hideMultiSerie(); | |
1150 | - getEscolaCursoSerie(); | |
1151 | - //if(this.value) | |
1152 | - //{ | |
1153 | - | |
1154 | - PadraoAnoEscolar_xml(); | |
1155 | - //PadraoAnoEscolar(); | |
1156 | - //} | |
1157 | - if (this.value == '') | |
1158 | - { | |
1159 | - $('img_colecao').style.display = 'none;'; | |
1160 | - } | |
1161 | - else | |
1162 | - { | |
1163 | - $('img_colecao').style.display = ''; | |
1164 | - } | |
1057 | + setVisibility('tr_multiseriada', document.getElementById('ref_ref_cod_serie').value ? true : false); | |
1058 | + setVisibility('tr_ref_ref_cod_serie_mult', document.getElementById('multiseriada').checked ? true : false); | |
1059 | + setVisibility('ref_ref_cod_serie_mult', document.getElementById('multiseriada').checked ? true : false); | |
1060 | + | |
1061 | + hideMultiSerie(); | |
1062 | + getEscolaCursoSerie(); | |
1063 | + | |
1064 | + PadraoAnoEscolar_xml(); | |
1065 | + | |
1066 | + if (this.value == '') { | |
1067 | + $('img_colecao').style.display = 'none;'; | |
1068 | + } | |
1069 | + else { | |
1070 | + $('img_colecao').style.display = ''; | |
1071 | + } | |
1165 | 1072 | } |
1166 | 1073 | |
1167 | 1074 | function PadraoAnoEscolar_xml() |
1168 | 1075 | { |
1169 | - //if(document.getElementById('ref_cod_escola').value) | |
1170 | - //{ | |
1171 | - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
1172 | - var xml1 = new ajax(PadraoAnoEscolar); | |
1173 | - strURL = "educar_curso_xml.php?ins="+campoInstituicao; | |
1174 | - xml1.envia(strURL); | |
1175 | - //} | |
1176 | - //else{ | |
1177 | - //PadraoAnoEscolar(null); | |
1178 | - //} | |
1076 | + var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
1077 | + var xml1 = new ajax(PadraoAnoEscolar); | |
1078 | + strURL = 'educar_curso_xml.php?ins=' + campoInstituicao; | |
1079 | + xml1.envia(strURL); | |
1179 | 1080 | } |
1081 | + | |
1180 | 1082 | function changeMultiSerie() |
1181 | 1083 | { |
1084 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
1085 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
1182 | 1086 | |
1183 | - var campoCurso = document.getElementById('ref_cod_curso').value; | |
1184 | - var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
1087 | + var xml1 = new ajax(atualizaMultiSerie); | |
1088 | + strURL = 'educar_sequencia_serie_xml.php?cur=' + campoCurso + '&ser_dif=' + campoSerie; | |
1185 | 1089 | |
1186 | - var xml1 = new ajax(atualizaMultiSerie); | |
1187 | - strURL = "educar_sequencia_serie_xml.php?cur="+campoCurso+"&ser_dif="+campoSerie; | |
1188 | - xml1.envia(strURL); | |
1189 | - | |
1190 | -// DOM_execute_when_xmlhttpChange = function() { atualizaMultiSerie(); }; | |
1191 | -// strURL = "educar_sequencia_serie_xml.php?cur="+campoCurso+"&ser_dif="+campoSerie; | |
1192 | -// DOM_loadXMLDoc( strURL ); | |
1090 | + xml1.envia(strURL); | |
1193 | 1091 | } |
1194 | 1092 | |
1195 | 1093 | function atualizaMultiSerie(xml) |
1196 | 1094 | { |
1095 | + var campoMultiSeriada = document.getElementById('multiseriada'); | |
1096 | + var checked = campoMultiSeriada.checked; | |
1197 | 1097 | |
1198 | - var campoMultiSeriada = document.getElementById('multiseriada'); | |
1199 | - var checked = campoMultiSeriada.checked; | |
1200 | - | |
1201 | - setVisibility('tr_ref_ref_cod_serie_mult', (document.getElementById('multiseriada').checked == true && document.getElementById('ref_ref_cod_serie').value != "") ? true : false); | |
1202 | - setVisibility('ref_ref_cod_serie_mult', (document.getElementById('multiseriada').checked == true && document.getElementById('ref_ref_cod_serie').value != "") ? true : false); | |
1098 | + var multiBool = (document.getElementById('multiseriada').checked == true && | |
1099 | + document.getElementById('ref_ref_cod_serie').value != '') ? true : false; | |
1203 | 1100 | |
1204 | - if(!checked){ | |
1205 | - document.getElementById('ref_ref_cod_serie_mult').value = ''; | |
1206 | - return; | |
1207 | - } | |
1101 | + setVisibility('tr_ref_ref_cod_serie_mult', multiBool); | |
1102 | + setVisibility('ref_ref_cod_serie_mult', multiBool); | |
1208 | 1103 | |
1104 | + if (!checked){ | |
1105 | + document.getElementById('ref_ref_cod_serie_mult').value = ''; | |
1106 | + return; | |
1107 | + } | |
1209 | 1108 | |
1210 | - var campoEscola = document.getElementById('ref_cod_escola').value; | |
1211 | - var campoCurso = document.getElementById('ref_cod_curso').value; | |
1212 | - var campoSerieMult = document.getElementById('ref_ref_cod_serie_mult'); | |
1213 | - var campoSerie = document.getElementById('ref_ref_cod_serie'); | |
1109 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
1110 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
1111 | + var campoSerieMult = document.getElementById('ref_ref_cod_serie_mult'); | |
1112 | + var campoSerie = document.getElementById('ref_ref_cod_serie'); | |
1214 | 1113 | |
1215 | - campoSerieMult.length = 1; | |
1216 | - campoSerieMult.options[0] = new Option( 'Selecione uma série', '', false, false ); | |
1217 | - /*for (var j = 0; j < serie.length; j++) | |
1218 | - { | |
1219 | - if ((serie[j][2] == campoEscola) && (serie[j][3] == campoCurso) && (serie[j][0] != campoSerie.value)) | |
1220 | - { | |
1221 | - campoSerieMult.options[campoSerieMult.options.length] = new Option( serie[j][1], serie[j][0],false,false); | |
1222 | - } | |
1223 | - } */ | |
1224 | - var multi_serie = xml.getElementsByTagName( "serie" ); | |
1225 | - if(multi_serie.length) | |
1226 | - { | |
1227 | - for(var i = 0; i < multi_serie.length; i++ ) | |
1228 | - { | |
1229 | - campoSerieMult.options[campoSerieMult.options.length] = new Option( multi_serie[i].firstChild.data, multi_serie[i].getAttribute("cod_serie"),false,false); | |
1230 | - } | |
1231 | - } | |
1114 | + campoSerieMult.length = 1; | |
1115 | + campoSerieMult.options[0] = new Option('Selecione uma série', '', false, false); | |
1232 | 1116 | |
1117 | + var multi_serie = xml.getElementsByTagName('serie'); | |
1233 | 1118 | |
1234 | - if ( campoSerieMult.length == 1 && campoCurso != '' ) { | |
1235 | - campoSerieMult.options[0] = new Option( 'O curso não possui nenhuma série', '', false, false ); | |
1236 | - } | |
1237 | - | |
1238 | - document.getElementById('ref_ref_cod_serie_mult').value = document.getElementById('ref_ref_cod_serie_mult_').value; | |
1119 | + if (multi_serie.length) { | |
1120 | + for (var i = 0; i < multi_serie.length; i++) { | |
1121 | + campoSerieMult.options[campoSerieMult.options.length] = new Option( | |
1122 | + multi_serie[i].firstChild.data, multi_serie[i].getAttribute('cod_serie'), false, false | |
1123 | + ); | |
1124 | + } | |
1125 | + } | |
1239 | 1126 | |
1127 | + if (campoSerieMult.length == 1 && campoCurso != '') { | |
1128 | + campoSerieMult.options[0] = new Option('O curso não possui nenhuma série', '', false, false); | |
1129 | + } | |
1240 | 1130 | |
1131 | + document.getElementById('ref_ref_cod_serie_mult').value = document.getElementById('ref_ref_cod_serie_mult_').value; | |
1241 | 1132 | } |
1242 | 1133 | |
1243 | 1134 | document.getElementById('multiseriada').onclick = function() |
1244 | 1135 | { |
1245 | - changeMultiSerie(); | |
1136 | + changeMultiSerie(); | |
1246 | 1137 | } |
1247 | 1138 | |
1248 | 1139 | document.getElementById('ref_ref_cod_serie').onchange = function() |
1249 | 1140 | { |
1141 | + if (this.value) { | |
1142 | + getHoraEscolaSerie(); | |
1143 | + } | |
1250 | 1144 | |
1145 | + if(document.getElementById('multiseriada').checked == true) { | |
1146 | + changeMultiSerie(); | |
1147 | + } | |
1251 | 1148 | |
1252 | - if(this.value) | |
1253 | - { | |
1254 | - getHoraEscolaSerie(); | |
1255 | - } | |
1256 | - if(document.getElementById('multiseriada').checked == true) | |
1257 | - { | |
1258 | - changeMultiSerie(); | |
1259 | - } | |
1260 | - hideMultiSerie(); | |
1149 | + hideMultiSerie(); | |
1261 | 1150 | } |
1262 | 1151 | |
1263 | 1152 | function hideMultiSerie() |
1264 | 1153 | { |
1265 | - setVisibility('tr_multiseriada',document.getElementById('ref_ref_cod_serie').value != "" ? true : false); | |
1266 | - setVisibility('ref_ref_cod_serie_mult', (document.getElementById('multiseriada').checked == true && document.getElementById('ref_ref_cod_serie').value != "") ? true : false); | |
1267 | - setVisibility('tr_ref_ref_cod_serie_mult',(document.getElementById('multiseriada').checked == true && document.getElementById('ref_ref_cod_serie').value != "") ? true : false); | |
1154 | + setVisibility('tr_multiseriada', document.getElementById('ref_ref_cod_serie').value != '' ? true : false); | |
1155 | + | |
1156 | + var multiBool = (document.getElementById('multiseriada').checked == true && | |
1157 | + document.getElementById('ref_ref_cod_serie').value != '') ? true : false; | |
1158 | + | |
1159 | + setVisibility('ref_ref_cod_serie_mult', multiBool); | |
1160 | + setVisibility('tr_ref_ref_cod_serie_mult',multiBool); | |
1268 | 1161 | } |
1269 | 1162 | function PadraoAnoEscolar(xml) |
1270 | 1163 | { |
1271 | -// esconde tudo | |
1272 | - | |
1273 | - var escola_curso_ = new Array(); | |
1274 | - if(xml != null) | |
1275 | - escola_curso_ = xml.getElementsByTagName( "curso" ); | |
1276 | - | |
1277 | - campoCurso = document.getElementById('ref_cod_curso').value; | |
1278 | - for (var j = 0; j < escola_curso_.length; j++) | |
1279 | - { | |
1280 | - if (escola_curso_[j].getAttribute('cod_curso') == campoCurso) | |
1281 | - { | |
1282 | - document.getElementById('padrao_ano_escolar').value = escola_curso_[j].getAttribute('padrao_ano_escolar') ; | |
1283 | - } | |
1284 | - } | |
1285 | - setVisibility('tr_ref_cod_modulo',false); | |
1286 | - setVisibility('ref_cod_modulo',false); | |
1287 | - setVisibility('tr_data_inicio',false); | |
1288 | - setVisibility('tr_data_fim',false); | |
1289 | - setVisibility('tr_bt_incluir_modulo',false); | |
1290 | - | |
1291 | - var modulos = document.getElementsByName('tr_ref_cod_modulo'); | |
1292 | - for (var i = 0; i < modulos.length; i++) | |
1293 | - { | |
1294 | - setVisibility(modulos[i].id,false); | |
1295 | - } | |
1296 | - | |
1297 | - setVisibility('tr_dia_semana',false); | |
1298 | - setVisibility('tr_ds_hora_inicial',false); | |
1299 | - setVisibility('tr_ds_hora_final',false); | |
1300 | - setVisibility('tr_bt_incluir_dia_semana',false); | |
1301 | - | |
1302 | - if ( document.getElementById('tr_dia_semana_1') ) | |
1303 | - setVisibility('tr_dia_semana_1',false); | |
1304 | - if ( document.getElementById('tr_dia_semana_2') ) | |
1305 | - setVisibility('tr_dia_semana_2',false); | |
1306 | - if ( document.getElementById('tr_dia_semana_3') ) | |
1307 | - setVisibility('tr_dia_semana_3',false); | |
1308 | - if ( document.getElementById('tr_dia_semana_4') ) | |
1309 | - setVisibility('tr_dia_semana_4',false); | |
1310 | - if ( document.getElementById('tr_dia_semana_5') ) | |
1311 | - setVisibility('tr_dia_semana_5',false); | |
1312 | - if ( document.getElementById('tr_dia_semana_6') ) | |
1313 | - setVisibility('tr_dia_semana_6',false); | |
1314 | - if ( document.getElementById('tr_dia_semana_7') ) | |
1315 | - setVisibility('tr_dia_semana_7',false); | |
1316 | - | |
1317 | - setVisibility('tr_hora_inicial',false); | |
1318 | - setVisibility('tr_hora_final',false); | |
1319 | - setVisibility('tr_hora_inicio_intervalo',false); | |
1320 | - setVisibility('tr_hora_fim_intervalo',false); | |
1321 | - | |
1322 | - if(campoCurso == ""){ | |
1323 | - return; | |
1324 | - } | |
1325 | - | |
1326 | - var campoCurso = document.getElementById('ref_cod_curso').value; | |
1327 | - if(document.getElementById('padrao_ano_escolar').value == 1 ) | |
1328 | - { | |
1329 | - setVisibility('tr_hora_inicial',true); | |
1330 | - setVisibility('tr_hora_final',true); | |
1331 | - setVisibility('tr_hora_inicio_intervalo',true); | |
1332 | - setVisibility('tr_hora_fim_intervalo',true); | |
1333 | - } | |
1334 | - else if(document.getElementById('padrao_ano_escolar').value == 0 ) | |
1335 | - { | |
1336 | - setVisibility('tr_ref_cod_modulo',true); | |
1337 | - setVisibility('ref_cod_modulo',true); | |
1338 | - setVisibility('tr_data_inicio',true); | |
1339 | - setVisibility('tr_data_fim',true); | |
1340 | - setVisibility('tr_bt_incluir_modulo',true); | |
1341 | - | |
1342 | - var modulos = document.getElementsByName('tr_ref_cod_modulo'); | |
1343 | - for (var i = 0; i < modulos.length; i++) | |
1344 | - { | |
1345 | - setVisibility(modulos[i].id,true); | |
1346 | - } | |
1347 | - | |
1348 | - setVisibility('tr_dia_semana',true); | |
1349 | - setVisibility('tr_ds_hora_inicial',true); | |
1350 | - setVisibility('tr_ds_hora_final',true); | |
1351 | - setVisibility('tr_bt_incluir_dia_semana',true); | |
1352 | - | |
1353 | - if ( document.getElementById('tr_dia_semana_1') ) | |
1354 | - setVisibility('tr_dia_semana_1',true); | |
1355 | - if ( document.getElementById('tr_dia_semana_2') ) | |
1356 | - setVisibility('tr_dia_semana_2',true); | |
1357 | - if ( document.getElementById('tr_dia_semana_3') ) | |
1358 | - setVisibility('tr_dia_semana_3',true); | |
1359 | - if ( document.getElementById('tr_dia_semana_4') ) | |
1360 | - setVisibility('tr_dia_semana_4',true); | |
1361 | - if ( document.getElementById('tr_dia_semana_5') ) | |
1362 | - setVisibility('tr_dia_semana_5',true); | |
1363 | - if ( document.getElementById('tr_dia_semana_6') ) | |
1364 | - setVisibility('tr_dia_semana_6',true); | |
1365 | - if ( document.getElementById('tr_dia_semana_7') ) | |
1366 | - setVisibility('tr_dia_semana_7',true); | |
1367 | - } | |
1164 | + var escola_curso_ = new Array(); | |
1165 | + | |
1166 | + if (xml != null) { | |
1167 | + escola_curso_ = xml.getElementsByTagName('curso'); | |
1168 | + } | |
1169 | + | |
1170 | + campoCurso = document.getElementById('ref_cod_curso').value; | |
1171 | + | |
1172 | + for (var j = 0; j < escola_curso_.length; j++) { | |
1173 | + if (escola_curso_[j].getAttribute('cod_curso') == campoCurso) { | |
1174 | + document.getElementById('padrao_ano_escolar').value = | |
1175 | + escola_curso_[j].getAttribute('padrao_ano_escolar') ; | |
1176 | + } | |
1177 | + } | |
1178 | + | |
1179 | + setVisibility('tr_ref_cod_modulo', false); | |
1180 | + setVisibility('ref_cod_modulo', false); | |
1181 | + setVisibility('tr_data_inicio', false); | |
1182 | + setVisibility('tr_data_fim', false); | |
1183 | + setVisibility('tr_bt_incluir_modulo', false); | |
1184 | + | |
1185 | + var modulos = document.getElementsByName('tr_ref_cod_modulo'); | |
1186 | + | |
1187 | + for (var i = 0; i < modulos.length; i++) { | |
1188 | + setVisibility(modulos[i].id, false); | |
1189 | + } | |
1190 | + | |
1191 | + setVisibility('tr_dia_semana', false); | |
1192 | + setVisibility('tr_ds_hora_inicial', false); | |
1193 | + setVisibility('tr_ds_hora_final', false); | |
1194 | + setVisibility('tr_bt_incluir_dia_semana', false); | |
1195 | + | |
1196 | + if (document.getElementById('tr_dia_semana_1')) { | |
1197 | + setVisibility('tr_dia_semana_1', false); | |
1198 | + } | |
1199 | + | |
1200 | + if (document.getElementById('tr_dia_semana_2')) { | |
1201 | + setVisibility('tr_dia_semana_2', false); | |
1202 | + } | |
1203 | + | |
1204 | + if (document.getElementById('tr_dia_semana_3')) { | |
1205 | + setVisibility('tr_dia_semana_3', false); | |
1206 | + } | |
1207 | + | |
1208 | + if (document.getElementById('tr_dia_semana_4')) { | |
1209 | + setVisibility('tr_dia_semana_4', false); | |
1210 | + } | |
1211 | + | |
1212 | + if (document.getElementById('tr_dia_semana_5')) { | |
1213 | + setVisibility('tr_dia_semana_5', false); | |
1214 | + } | |
1215 | + | |
1216 | + if (document.getElementById('tr_dia_semana_6')) { | |
1217 | + setVisibility('tr_dia_semana_6', false); | |
1218 | + } | |
1219 | + | |
1220 | + if (document.getElementById('tr_dia_semana_7')) { | |
1221 | + setVisibility('tr_dia_semana_7', false); | |
1222 | + } | |
1223 | + | |
1224 | + setVisibility('tr_hora_inicial',false); | |
1225 | + setVisibility('tr_hora_final',false); | |
1226 | + setVisibility('tr_hora_inicio_intervalo',false); | |
1227 | + setVisibility('tr_hora_fim_intervalo',false); | |
1228 | + | |
1229 | + if (campoCurso == ''){ | |
1230 | + return; | |
1231 | + } | |
1232 | + | |
1233 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
1234 | + | |
1235 | + if (document.getElementById('padrao_ano_escolar').value == 1) { | |
1236 | + setVisibility('tr_hora_inicial', true); | |
1237 | + setVisibility('tr_hora_final', true); | |
1238 | + setVisibility('tr_hora_inicio_intervalo', true); | |
1239 | + setVisibility('tr_hora_fim_intervalo', true); | |
1240 | + } | |
1241 | + else if (document.getElementById('padrao_ano_escolar').value == 0) { | |
1242 | + setVisibility('tr_ref_cod_modulo', true); | |
1243 | + setVisibility('ref_cod_modulo', true); | |
1244 | + setVisibility('tr_data_inicio', true); | |
1245 | + setVisibility('tr_data_fim', true); | |
1246 | + setVisibility('tr_bt_incluir_modulo', true); | |
1247 | + | |
1248 | + var modulos = document.getElementsByName('tr_ref_cod_modulo'); | |
1249 | + | |
1250 | + for (var i = 0; i < modulos.length; i++) { | |
1251 | + setVisibility(modulos[i].id, true); | |
1252 | + } | |
1253 | + | |
1254 | + setVisibility('tr_dia_semana', true); | |
1255 | + setVisibility('tr_ds_hora_inicial', true); | |
1256 | + setVisibility('tr_ds_hora_final', true); | |
1257 | + setVisibility('tr_bt_incluir_dia_semana', true); | |
1258 | + | |
1259 | + if (document.getElementById('tr_dia_semana_1')) { | |
1260 | + setVisibility('tr_dia_semana_1', true); | |
1261 | + } | |
1262 | + | |
1263 | + if (document.getElementById('tr_dia_semana_2')) { | |
1264 | + setVisibility('tr_dia_semana_2', true); | |
1265 | + } | |
1266 | + | |
1267 | + if (document.getElementById('tr_dia_semana_3')) { | |
1268 | + setVisibility('tr_dia_semana_3', true); | |
1269 | + } | |
1270 | + | |
1271 | + if (document.getElementById('tr_dia_semana_4')) { | |
1272 | + setVisibility('tr_dia_semana_4', true); | |
1273 | + } | |
1274 | + | |
1275 | + if (document.getElementById('tr_dia_semana_5')) { | |
1276 | + setVisibility('tr_dia_semana_5', true); | |
1277 | + } | |
1278 | + | |
1279 | + if (document.getElementById('tr_dia_semana_6')) { | |
1280 | + setVisibility('tr_dia_semana_6', true); | |
1281 | + } | |
1282 | + | |
1283 | + if (document.getElementById('tr_dia_semana_7')) { | |
1284 | + setVisibility('tr_dia_semana_7', true); | |
1285 | + } | |
1286 | + } | |
1368 | 1287 | } |
1369 | 1288 | |
1370 | 1289 | function getHoraEscolaSerie() |
1371 | 1290 | { |
1372 | - var campoEscola = document.getElementById('ref_cod_escola').value; | |
1373 | - var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
1374 | - | |
1375 | - var xml1 = new ajax(atualizaTurmaCad_EscolaSerie); | |
1376 | - strURL = "educar_escola_serie_hora_xml.php?esc="+campoEscola+"&ser="+campoSerie; | |
1377 | - xml1.envia(strURL); | |
1378 | - | |
1379 | -// DOM_execute_when_xmlhttpChange = function() { atualizaTurmaCad_EscolaSerie(); }; | |
1380 | -// strURL = "educar_escola_serie_hora_xml.php?esc="+campoEscola+"&ser="+campoSerie; | |
1381 | -// DOM_loadXMLDoc( strURL ); | |
1382 | - | |
1383 | -// for (var j = 0; j < serie.length; j++) | |
1384 | -// { | |
1385 | -// if ( (serie[j][2] == campoEscola) && (serie[j][0] == campoSerie) ) | |
1386 | -// { | |
1387 | -// campoHoraInicial.value = serie[j][4]; | |
1388 | -// campoHoraFinal.value = serie[j][5]; | |
1389 | -// campoHoraInicioIntervalo.value = serie[j][6]; | |
1390 | -// campoHoraFimIntervalo.value = serie[j][7]; | |
1391 | -// } | |
1392 | -// } | |
1291 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
1292 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
1293 | + | |
1294 | + var xml1 = new ajax(atualizaTurmaCad_EscolaSerie); | |
1295 | + strURL = 'educar_escola_serie_hora_xml.php?esc=' + campoEscola + '&ser=' +campoSerie; | |
1296 | + xml1.envia(strURL); | |
1393 | 1297 | } |
1394 | 1298 | |
1395 | 1299 | function atualizaTurmaCad_EscolaSerie(xml) |
1396 | 1300 | { |
1397 | - var campoHoraInicial = document.getElementById('hora_inicial'); | |
1398 | - var campoHoraFinal = document.getElementById('hora_final'); | |
1399 | - var campoHoraInicioIntervalo = document.getElementById('hora_inicio_intervalo'); | |
1400 | - var campoHoraFimIntervalo = document.getElementById('hora_fim_intervalo'); | |
1401 | - | |
1402 | - var DOM_escola_serie_hora = xml.getElementsByTagName( "item" ); | |
1403 | - | |
1404 | - if(DOM_escola_serie_hora.length) | |
1405 | - { | |
1406 | - campoHoraInicial.value = DOM_escola_serie_hora[0].firstChild.data; | |
1407 | - campoHoraFinal.value = DOM_escola_serie_hora[1].firstChild.data; | |
1408 | - campoHoraInicioIntervalo.value = DOM_escola_serie_hora[2].firstChild.data; | |
1409 | - campoHoraFimIntervalo.value = DOM_escola_serie_hora[3].firstChild.data; | |
1410 | - } | |
1301 | + var campoHoraInicial = document.getElementById('hora_inicial'); | |
1302 | + var campoHoraFinal = document.getElementById('hora_final'); | |
1303 | + var campoHoraInicioIntervalo = document.getElementById('hora_inicio_intervalo'); | |
1304 | + var campoHoraFimIntervalo = document.getElementById('hora_fim_intervalo'); | |
1305 | + | |
1306 | + var DOM_escola_serie_hora = xml.getElementsByTagName('item'); | |
1307 | + | |
1308 | + if (DOM_escola_serie_hora.length) { | |
1309 | + campoHoraInicial.value = DOM_escola_serie_hora[0].firstChild.data; | |
1310 | + campoHoraFinal.value = DOM_escola_serie_hora[1].firstChild.data; | |
1311 | + campoHoraInicioIntervalo.value = DOM_escola_serie_hora[2].firstChild.data; | |
1312 | + campoHoraFimIntervalo.value = DOM_escola_serie_hora[3].firstChild.data; | |
1313 | + } | |
1411 | 1314 | } |
1412 | 1315 | |
1413 | 1316 | function valida() |
1414 | 1317 | { |
1415 | - if( document.getElementById('padrao_ano_escolar').value == 1 ) | |
1416 | - { | |
1417 | - var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
1418 | - var campoEscola = document.getElementById('ref_cod_escola').value; | |
1419 | - var campoTurma = document.getElementById('cod_turma').value; | |
1420 | - var campoComodo = document.getElementById('ref_cod_infra_predio_comodo').value; | |
1421 | - var campoCurso = document.getElementById('ref_cod_curso').value; | |
1422 | - var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
1423 | - | |
1424 | - var url = "educar_turma_sala_xml.php"; | |
1425 | - var pars = '?inst=' + campoInstituicao + '&esc=' + campoEscola + '¬_tur=' + campoTurma + '&com=' + campoComodo + '&cur=' + campoCurso+ '&ser=' + campoSerie; | |
1426 | -// | |
1427 | -// var myAjax = new Ajax.Request( | |
1428 | -// url, | |
1429 | -// { | |
1430 | -// method: 'get', | |
1431 | -// parameters: pars, | |
1432 | -// onComplete: valida_xml | |
1433 | -// }); | |
1434 | - | |
1435 | - var xml1 = new ajax(valida_xml); | |
1436 | - strURL = url+pars; | |
1437 | - xml1.envia(strURL); | |
1438 | - | |
1439 | - }else{ | |
1440 | - valida_xml(null); | |
1441 | - } | |
1442 | - | |
1318 | + if (document.getElementById('padrao_ano_escolar').value == 1) { | |
1319 | + var campoInstituicao = document.getElementById('ref_cod_instituicao').value; | |
1320 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
1321 | + var campoTurma = document.getElementById('cod_turma').value; | |
1322 | + var campoComodo = document.getElementById('ref_cod_infra_predio_comodo').value; | |
1323 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
1324 | + var campoSerie = document.getElementById('ref_ref_cod_serie').value; | |
1325 | + | |
1326 | + var url = 'educar_turma_sala_xml.php'; | |
1327 | + var pars = '?inst=' + campoInstituicao + '&esc=' + campoEscola + '¬_tur=' + | |
1328 | + campoTurma + '&com=' + campoComodo + '&cur=' + campoCurso+ '&ser=' + campoSerie; | |
1329 | + | |
1330 | + var xml1 = new ajax(valida_xml); | |
1331 | + strURL = url + pars; | |
1332 | + | |
1333 | + xml1.envia(strURL); | |
1334 | + } | |
1335 | + else { | |
1336 | + valida_xml(null); | |
1337 | + } | |
1443 | 1338 | } |
1444 | 1339 | |
1445 | 1340 | function valida_xml(xml) |
1446 | 1341 | { |
1447 | - var DOM_turma_sala = new Array(); | |
1448 | - if(xml != null) | |
1449 | - DOM_turma_sala = xml.getElementsByTagName( "item" ); | |
1450 | - | |
1451 | - var campoCurso = document.getElementById('ref_cod_curso').value; | |
1452 | - | |
1453 | - if(document.getElementById('ref_cod_escola').value) | |
1454 | - { | |
1455 | - | |
1456 | - if(!document.getElementById('ref_ref_cod_serie').value) | |
1457 | - { | |
1458 | - alert("Preencha o campo 'Série' corretamente!"); | |
1459 | - document.getElementById('ref_ref_cod_serie').focus(); | |
1460 | - return false; | |
1461 | - } | |
1462 | - if(!document.getElementById('ref_cod_infra_predio_comodo').value) | |
1463 | - { | |
1464 | - alert("Preencha o campo 'Sala' corretamente!"); | |
1465 | - document.getElementById('ref_cod_infra_predio_comodo').focus(); | |
1466 | - return false; | |
1467 | - } | |
1468 | - } | |
1469 | - if(document.getElementById('multiseriada').checked ) | |
1470 | - { | |
1471 | - if(!document.getElementById('ref_ref_cod_serie_mult')){ | |
1472 | - alert("Preencha o campo 'Série Multi-seriada' corretamente!"); | |
1473 | - document.getElementById('ref_ref_cod_serie_mult').focus(); | |
1474 | - return false; | |
1475 | - } | |
1476 | - } | |
1477 | - //for (var j = 0; j < escola_curso.length; j++) | |
1478 | - //{ | |
1479 | - //if (escola_curso[j][0] == campoCurso) | |
1480 | - //{ | |
1481 | - | |
1482 | - if (document.getElementById('padrao_ano_escolar').value == 1 /*escola_curso[j][3] == 1*/) | |
1483 | - { | |
1484 | - var campoHoraInicial = document.getElementById('hora_inicial').value; | |
1485 | - var campoHoraFinal = document.getElementById('hora_final').value; | |
1486 | - var campoHoraInicioIntervalo = document.getElementById('hora_inicio_intervalo').value; | |
1487 | - var campoHoraFimIntervalo = document.getElementById('hora_fim_intervalo').value; | |
1488 | - | |
1489 | - if ( campoHoraInicial == '' ) | |
1490 | - { | |
1491 | - alert("Preencha o campo 'Hora Inicial' corretamente!"); | |
1492 | - document.getElementById('hora_inicial').focus(); | |
1493 | - return false; | |
1494 | - } | |
1495 | - else if ( campoHoraFinal == '' ) | |
1496 | - { | |
1497 | - alert("Preencha o campo 'Hora Final' corretamente!"); | |
1498 | - document.getElementById('hora_final').focus(); | |
1499 | - return false; | |
1500 | - } | |
1501 | - else if ( campoHoraInicioIntervalo == '' ) | |
1502 | - { | |
1503 | - alert("Preencha o campo 'Hora Início Intervalo' corretamente!"); | |
1504 | - document.getElementById('hora_inicio_intervalo').focus(); | |
1505 | - return false; | |
1506 | - } | |
1507 | - else if ( campoHoraFimIntervalo == '' ) | |
1508 | - { | |
1509 | - alert("Preencha o campo 'Hora Fim Intervalo' corretamente!"); | |
1510 | - document.getElementById('hora_fim_intervalo').focus(); | |
1511 | - return false; | |
1512 | - } | |
1513 | - ////document.getElementById('padrao_ano_escolar').value = 1; | |
1514 | - //break; | |
1515 | - } | |
1516 | - else if (document.getElementById('padrao_ano_escolar').value == 0 /*escola_curso[j][3] == 0*/) | |
1517 | - { | |
1518 | - var qtdModulo = document.getElementsByName('ref_cod_modulo').length; | |
1519 | - var qtdDiaSemana = document.getElementsByName('dia_semana').length; | |
1520 | - | |
1521 | - if ( qtdModulo == 1 ) | |
1522 | - { | |
1523 | - alert("ATENÇÂO! \n É necessário incluir um 'Módulo'!"); | |
1524 | - document.getElementById('ref_cod_modulo').focus(); | |
1525 | - return false; | |
1526 | - } | |
1527 | - if ( qtdDiaSemana == 1 ) | |
1528 | - { | |
1529 | - alert("ATENÇÂO! \n É necessário incluir um 'Dia da Semana'!"); | |
1530 | - document.getElementById('dia_semana').focus(); | |
1531 | - return false; | |
1532 | - } | |
1533 | - //document.getElementById('padrao_ano_escolar').value = 0; | |
1534 | - //break; | |
1535 | - } | |
1536 | - //} | |
1537 | - //} | |
1538 | - | |
1539 | - if( document.getElementById('padrao_ano_escolar') == 1 ) | |
1540 | - //alert('Erro ao verificar informações!!\nContate o administrador'); | |
1541 | - {//ref_cod_infra_predio_comodo | |
1542 | - for (var j = 0; j < DOM_turma_sala.length; j+=2) | |
1543 | - { | |
1544 | - | |
1545 | - if( (DOM_turma_sala[j].firstChild.nodeValue <= document.getElementById('hora_inicial').value) && | |
1546 | - (document.getElementById('hora_inicial').value <= DOM_turma_sala[j+1].firstChild.nodeValue) | |
1547 | - || | |
1548 | - (DOM_turma_sala[j].firstChild.nodeValue <= document.getElementById('hora_final').value) && | |
1549 | - (document.getElementById('hora_final').value <= DOM_turma_sala[j+1].firstChild.nodeValue) ) | |
1550 | - { | |
1551 | - alert("ATENÇÂO! \n A 'sala' já está alocada nesse horário! \n Por favor, escolha outro horário ou sala."); | |
1552 | - return false; | |
1553 | - } | |
1554 | - | |
1555 | - } | |
1556 | - } | |
1557 | -/* for (var j = 0; j < DOM_turma_sala.length; j++) | |
1558 | - { | |
1559 | - if( (document.getElementById('ref_cod_escola').value == turma_sala[j][2]) | |
1560 | - && | |
1561 | - (document.getElementById('ref_cod_infra_predio_comodo').value == turma_sala[j][1]) | |
1562 | - && document.getElementById('cod_turma').value != turma_sala[j][0] | |
1563 | - ) | |
1564 | - { | |
1565 | - if( (turma_sala[j][3] <= document.getElementById('hora_inicial').value) && | |
1566 | - (document.getElementById('hora_inicial').value <= turma_sala[j][4]) | |
1567 | - || | |
1568 | - (turma_sala[j][3] <= document.getElementById('hora_final').value) && | |
1569 | - (document.getElementById('hora_final').value <= turma_sala[j][4]) ) | |
1570 | - { | |
1571 | - alert("ATENÇÂO! \n A 'sala' já está alocada nesse horário! \n Por favor, escolha outro horário ou sala."); | |
1572 | - return false; | |
1573 | - } | |
1574 | - } | |
1575 | - }*/ | |
1576 | -// } | |
1577 | - | |
1578 | - if( !acao() ) | |
1579 | - return false; | |
1580 | - | |
1581 | - document.forms[0].submit(); | |
1342 | + var DOM_turma_sala = new Array(); | |
1343 | + | |
1344 | + if (xml != null) { | |
1345 | + DOM_turma_sala = xml.getElementsByTagName('item'); | |
1346 | + } | |
1347 | + | |
1348 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
1349 | + | |
1350 | + if (document.getElementById('ref_cod_escola').value) { | |
1351 | + if (!document.getElementById('ref_ref_cod_serie').value) { | |
1352 | + alert("Preencha o campo 'Série' corretamente!"); | |
1353 | + document.getElementById('ref_ref_cod_serie').focus(); | |
1354 | + return false; | |
1355 | + } | |
1356 | + | |
1357 | + if (!document.getElementById('ref_cod_infra_predio_comodo').value) { | |
1358 | + alert("Preencha o campo 'Sala' corretamente!"); | |
1359 | + document.getElementById('ref_cod_infra_predio_comodo').focus(); | |
1360 | + return false; | |
1361 | + } | |
1362 | + } | |
1363 | + | |
1364 | + if (document.getElementById('multiseriada').checked) { | |
1365 | + if (!document.getElementById('ref_ref_cod_serie_mult')){ | |
1366 | + alert("Preencha o campo 'Série Multi-seriada' corretamente!"); | |
1367 | + document.getElementById('ref_ref_cod_serie_mult').focus(); | |
1368 | + return false; | |
1369 | + } | |
1370 | + } | |
1371 | + | |
1372 | + if (document.getElementById('padrao_ano_escolar').value == 1) { | |
1373 | + var campoHoraInicial = document.getElementById('hora_inicial').value; | |
1374 | + var campoHoraFinal = document.getElementById('hora_final').value; | |
1375 | + var campoHoraInicioIntervalo = document.getElementById('hora_inicio_intervalo').value; | |
1376 | + var campoHoraFimIntervalo = document.getElementById('hora_fim_intervalo').value; | |
1377 | + | |
1378 | + if (campoHoraInicial == '') { | |
1379 | + alert("Preencha o campo 'Hora Inicial' corretamente!"); | |
1380 | + document.getElementById('hora_inicial').focus(); | |
1381 | + return false; | |
1382 | + } | |
1383 | + else if (campoHoraFinal == '') { | |
1384 | + alert("Preencha o campo 'Hora Final' corretamente!"); | |
1385 | + document.getElementById('hora_final').focus(); | |
1386 | + return false; | |
1387 | + } | |
1388 | + else if (campoHoraInicioIntervalo == '') { | |
1389 | + alert("Preencha o campo 'Hora Início Intervalo' corretamente!"); | |
1390 | + document.getElementById('hora_inicio_intervalo').focus(); | |
1391 | + return false; | |
1392 | + } | |
1393 | + else if (campoHoraFimIntervalo == '') { | |
1394 | + alert("Preencha o campo 'Hora Fim Intervalo' corretamente!"); | |
1395 | + document.getElementById('hora_fim_intervalo').focus(); | |
1396 | + return false; | |
1397 | + } | |
1398 | + } | |
1399 | + else if (document.getElementById('padrao_ano_escolar').value == 0) { | |
1400 | + var qtdModulo = document.getElementsByName('ref_cod_modulo').length; | |
1401 | + var qtdDiaSemana = document.getElementsByName('dia_semana').length; | |
1402 | + | |
1403 | + if (qtdModulo == 1) { | |
1404 | + alert("ATENÇÃO!\nÉ necessário incluir um 'Módulo'!"); | |
1405 | + document.getElementById('ref_cod_modulo').focus(); | |
1406 | + return false; | |
1407 | + } | |
1408 | + | |
1409 | + if (qtdDiaSemana == 1) { | |
1410 | + alert("ATENÇÂO! \n É necessário incluir um 'Dia da Semana'!"); | |
1411 | + document.getElementById('dia_semana').focus(); | |
1412 | + return false; | |
1413 | + } | |
1414 | + } | |
1415 | + | |
1416 | + if (document.getElementById('padrao_ano_escolar') == 1) { | |
1417 | + for (var j = 0; j < DOM_turma_sala.length; j += 2) { | |
1418 | + if ( | |
1419 | + (DOM_turma_sala[j].firstChild.nodeValue <= document.getElementById('hora_inicial').value) && | |
1420 | + (document.getElementById('hora_inicial').value <= DOM_turma_sala[j+1].firstChild.nodeValue) | |
1421 | + || | |
1422 | + (DOM_turma_sala[j].firstChild.nodeValue <= document.getElementById('hora_final').value) && | |
1423 | + (document.getElementById('hora_final').value <= DOM_turma_sala[j+1].firstChild.nodeValue) | |
1424 | + ) { | |
1425 | + alert("ATENÇÃO!\nA 'sala' já está alocada nesse horário!\nPor favor, escolha outro horário ou sala."); | |
1426 | + return false; | |
1427 | + } | |
1428 | + } | |
1429 | + } | |
1430 | + | |
1431 | + if (!acao()) { | |
1432 | + return false; | |
1433 | + } | |
1434 | + | |
1435 | + document.forms[0].submit(); | |
1582 | 1436 | } |
1583 | 1437 | |
1584 | - | |
1585 | - | |
1586 | 1438 | function validaCampoServidor() |
1587 | 1439 | { |
1588 | - if ( document.getElementById( "ref_cod_instituicao" ).value ) | |
1589 | - ref_cod_instituicao = document.getElementById( "ref_cod_instituicao" ).value; | |
1590 | - else | |
1591 | - { | |
1592 | - alert('Selecione uma instituição'); | |
1593 | - return false; | |
1594 | - } | |
1595 | - if ( document.getElementById( "ref_cod_escola" ).value ) | |
1596 | - ref_cod_escola = document.getElementById( "ref_cod_escola" ).value; | |
1597 | - else | |
1598 | - { | |
1599 | - alert('Selecione uma escola'); | |
1600 | - return false; | |
1601 | - } | |
1602 | - | |
1603 | - pesquisa_valores_popless( 'educar_pesquisa_servidor_lst.php?campo1=ref_cod_regente&professor=1&ref_cod_servidor=0&ref_cod_instituicao=' + ref_cod_instituicao + '&ref_cod_escola=' + ref_cod_escola , 'ref_cod_servidor' ); | |
1440 | + if (document.getElementById('ref_cod_instituicao').value) | |
1441 | + ref_cod_instituicao = document.getElementById('ref_cod_instituicao').value; | |
1442 | + else { | |
1443 | + alert('Selecione uma instituição'); | |
1444 | + return false; | |
1445 | + } | |
1446 | + | |
1447 | + if (document.getElementById('ref_cod_escola').value) { | |
1448 | + ref_cod_escola = document.getElementById('ref_cod_escola').value; | |
1449 | + } | |
1450 | + else { | |
1451 | + alert('Selecione uma escola'); | |
1452 | + return false; | |
1453 | + } | |
1454 | + | |
1455 | + pesquisa_valores_popless('educar_pesquisa_servidor_lst.php?campo1=ref_cod_regente&professor=1&ref_cod_servidor=0&ref_cod_instituicao=' + ref_cod_instituicao + '&ref_cod_escola=' + ref_cod_escola, 'ref_cod_servidor'); | |
1604 | 1456 | } |
1605 | 1457 | |
1606 | -document.getElementById( 'ref_cod_regente_lupa' ).onclick = function() | |
1458 | +document.getElementById('ref_cod_regente_lupa').onclick = function() | |
1607 | 1459 | { |
1608 | - validaCampoServidor(); | |
1460 | + validaCampoServidor(); | |
1609 | 1461 | } |
1610 | 1462 | |
1611 | - | |
1612 | -/**************************************COLOCADO*****************************************/ | |
1613 | 1463 | function getEscolaCursoSerie() |
1614 | - { | |
1615 | - var campoCurso = document.getElementById('ref_cod_curso').value; | |
1616 | - if ( document.getElementById('ref_cod_escola') ) | |
1617 | - { | |
1618 | - var campoEscola = document.getElementById('ref_cod_escola').value; | |
1619 | - } | |
1620 | - else if ( document.getElementById('ref_ref_cod_escola') ) | |
1621 | - { | |
1622 | - var campoEscola = document.getElementById('ref_ref_cod_escola').value; | |
1623 | - } | |
1624 | - var campoSerie = document.getElementById('ref_ref_cod_serie'); | |
1625 | - campoSerie.length = 1; | |
1626 | - | |
1627 | - limpaCampos(4); | |
1628 | - if( campoEscola && campoCurso ) | |
1629 | - { | |
1630 | - campoSerie.disabled = true; | |
1631 | - campoSerie.options[0].text = 'Carregando séries'; | |
1632 | - var xml = new ajax(atualizaLstEscolaCursoSerie); | |
1633 | - xml.envia("educar_escola_curso_serie_xml.php?esc="+campoEscola+"&cur="+campoCurso); | |
1634 | - } | |
1635 | - else | |
1636 | - { | |
1637 | - campoSerie.options[0].text = 'Selecione'; | |
1638 | - } | |
1639 | - } | |
1640 | - | |
1641 | - function atualizaLstEscolaCursoSerie(xml) | |
1642 | - { | |
1643 | - var campoSerie = document.getElementById('ref_ref_cod_serie'); | |
1644 | - campoSerie.length = 1; | |
1645 | - campoSerie.options[0].text = 'Selecione uma série'; | |
1646 | - campoSerie.disabled = false; | |
1647 | - | |
1648 | - series = xml.getElementsByTagName('serie'); | |
1649 | - if(series.length) | |
1650 | - { | |
1651 | - for( var i = 0; i < series.length; i++ ) | |
1652 | - { | |
1653 | - campoSerie.options[campoSerie.options.length] = new Option( series[i].firstChild.data, series[i].getAttribute('cod_serie'),false,false); | |
1654 | - } | |
1655 | - } | |
1656 | - else | |
1657 | - { | |
1658 | - campoSerie.options[0].text = 'A escola/curso não possui nenhuma série'; | |
1659 | - } | |
1660 | - } | |
1661 | - | |
1662 | -/**************************************************************************************/ | |
1464 | +{ | |
1465 | + var campoCurso = document.getElementById('ref_cod_curso').value; | |
1466 | + | |
1467 | + if (document.getElementById('ref_cod_escola')) { | |
1468 | + var campoEscola = document.getElementById('ref_cod_escola').value; | |
1469 | + } | |
1470 | + else if (document.getElementById('ref_ref_cod_escola')) { | |
1471 | + var campoEscola = document.getElementById('ref_ref_cod_escola').value; | |
1472 | + } | |
1473 | + | |
1474 | + var campoSerie = document.getElementById('ref_ref_cod_serie'); | |
1475 | + campoSerie.length = 1; | |
1476 | + | |
1477 | + limpaCampos(4); | |
1478 | + | |
1479 | + if (campoEscola && campoCurso) { | |
1480 | + campoSerie.disabled = true; | |
1481 | + campoSerie.options[0].text = 'Carregando séries'; | |
1482 | + | |
1483 | + var xml = new ajax(atualizaLstEscolaCursoSerie); | |
1484 | + xml.envia('educar_escola_curso_serie_xml.php?esc=' + campoEscola + '&cur=' + campoCurso); | |
1485 | + } | |
1486 | + else { | |
1487 | + campoSerie.options[0].text = 'Selecione'; | |
1488 | + } | |
1489 | +} | |
1663 | 1490 | |
1491 | +function atualizaLstEscolaCursoSerie(xml) | |
1492 | +{ | |
1493 | + var campoSerie = document.getElementById('ref_ref_cod_serie'); | |
1494 | + campoSerie.length = 1; | |
1495 | + campoSerie.options[0].text = 'Selecione uma série'; | |
1496 | + campoSerie.disabled = false; | |
1497 | + | |
1498 | + series = xml.getElementsByTagName('serie'); | |
1499 | + | |
1500 | + if (series.length) { | |
1501 | + for (var i = 0; i < series.length; i++) { | |
1502 | + campoSerie.options[campoSerie.options.length] = new Option( | |
1503 | + series[i].firstChild.data, series[i].getAttribute('cod_serie'), false, false | |
1504 | + ); | |
1505 | + } | |
1506 | + } | |
1507 | + else { | |
1508 | + campoSerie.options[0].text = 'A escola/curso não possui nenhuma série'; | |
1509 | + } | |
1510 | +} | |
1664 | 1511 | </script> |
1665 | 1512 | \ No newline at end of file | ... | ... |