Commit 82e257a32c9fd1ae7c9dc2f6c090bb3d23297652
1 parent
938d85bc
Exists in
master
#26 by Eriksen: Corrigido bug na substituição de horário de servidor. O bug envo…
…lveu diversas tarefas: * Novos métodos para diminuir duplicação de código, com documentação * Método clsPmieducarServidor::lista(): * Documentação dos argumentos * Correção da lógica de montagem da SQL e documentação de alguns trechos * Correção de SQL (uso da função COALESCE e typecasts que faltavam) * Documentação dos argumentos do método clsPmieducarServidor::lista() * Correção dos headers de arquivos * Refactoring de código relacionado a correção * Novos unit tests * Refactoring de código de unit e functional tests
Showing
11 changed files
with
1685 additions
and
1985 deletions
Show diff stats
ieducar/intranet/educar_pesquisa_servidor_lst.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/clsListagem.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | - | |
32 | -class clsIndexBase extends clsBase | |
33 | -{ | |
34 | - function Formular() | |
35 | - { | |
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor" ); | |
37 | - $this->processoAp = "0"; | |
38 | - $this->renderMenu = false; | |
39 | - $this->renderMenuSuspenso = false; | |
40 | - } | |
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 | + | |
24 | +/** | |
25 | + * Pesquisa de servidores | |
26 | + * | |
27 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
28 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
29 | + * @package Core | |
30 | + * @subpackage Servidor | |
31 | + * @since Disponível desde a versão 1.0.0 | |
32 | + * @version $Id$ | |
33 | + */ | |
34 | + | |
35 | +require_once 'include/clsBase.inc.php'; | |
36 | +require_once 'include/clsListagem.inc.php'; | |
37 | +require_once 'include/clsBanco.inc.php'; | |
38 | +require_once 'include/pmieducar/geral.inc.php'; | |
39 | + | |
40 | + | |
41 | +class clsIndexBase extends clsBase { | |
42 | + | |
43 | + public function Formular() { | |
44 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Servidor'); | |
45 | + $this->processoAp = '0'; | |
46 | + $this->renderMenu = FALSE; | |
47 | + $this->renderMenuSuspenso = FALSE; | |
48 | + } | |
49 | + | |
41 | 50 | } |
42 | 51 | |
43 | -class indice extends clsListagem | |
44 | -{ | |
52 | + | |
53 | +class indice extends clsListagem { | |
54 | + | |
45 | 55 | /** |
46 | 56 | * Referencia pega da session para o idpes do usuario atual |
47 | 57 | * |
... | ... | @@ -109,7 +119,7 @@ class indice extends clsListagem |
109 | 119 | $_SESSION["dia_semana"] = isset($_GET["dia_semana"]) ? $_GET["dia_semana"] : $_SESSION["dia_semana"]; |
110 | 120 | $_SESSION["hora_inicial"] = $_GET["hora_inicial"] ? $_GET["hora_inicial"] : $_SESSION["hora_inicial"]; |
111 | 121 | $_SESSION["hora_final"] = $_GET["hora_final"] ? $_GET["hora_final"] : $_SESSION["hora_final"]; |
112 | - $_SESSION["professor"] = $_GET["professor"] ? $_GET["professor"] : $_SESSION["professor"]; | |
122 | + $_SESSION["professor"] = ($_GET["professor"] ? $_GET["professor"] : $_SESSION["professor"]); | |
113 | 123 | $_SESSION["horario"] = $_GET["horario"] ? $_GET["horario"] : $_SESSION["horario"]; |
114 | 124 | $_SESSION["ref_cod_escola"] = $_GET["ref_cod_escola"] ? $_GET["ref_cod_escola"] : $_SESSION["ref_cod_escola"]; |
115 | 125 | $_SESSION["min_mat"] = $_GET["min_mat"] ? $_GET["min_mat"] : $_SESSION["min_mat"]; |
... | ... | @@ -148,7 +158,6 @@ class indice extends clsListagem |
148 | 158 | $this->min_not = $_SESSION["min_not"] = $_GET["min_not"] ? $_GET["min_not"] : $_SESSION["min_not"]; |
149 | 159 | $this->ref_cod_disciplina = $_SESSION["ref_cod_disciplina"] = $_GET["ref_cod_disciplina"] ? $_GET["ref_cod_disciplina"] : $_SESSION["ref_cod_disciplina"]; |
150 | 160 | $this->ref_cod_curso = $_SESSION["ref_cod_curso"] = $_GET["ref_cod_curso"] ? $_GET["ref_cod_curso"] : $_SESSION["ref_cod_curso"]; |
151 | - | |
152 | 161 | $this->identificador = $_SESSION["identificador"] = $_GET["identificador"] ? $_GET["identificador"] : $_SESSION["identificador"]; |
153 | 162 | |
154 | 163 | if ( isset( $_GET["lst_matriculas"] ) && isset( $_SESSION["lst_matriculas"] ) ) |
... | ... | @@ -330,45 +339,56 @@ class indice extends clsListagem |
330 | 339 | $array_hora = array( $_SESSION["dia_semana"], $_SESSION["hora_inicial"], $_SESSION["hora_final"] ); |
331 | 340 | } |
332 | 341 | |
333 | - /** | |
334 | - * marca a disciplina como NULL se nao estiver selecionada | |
335 | - * para poder restringir na busca dos professores | |
336 | - * e nao trazer um professor caso o curso nao seja globalizado e esteja sem materia | |
337 | - */ | |
338 | - $this->ref_cod_disciplina = $this->ref_cod_disciplina ? $this->ref_cod_disciplina : "NULL"; | |
339 | - | |
340 | - $lista = $obj_servidor->lista( | |
341 | - null, | |
342 | - $this->ref_cod_deficiencia, | |
343 | - $this->ref_idesco, | |
344 | - $this->carga_horaria, | |
345 | - null, | |
346 | - null, | |
347 | - null, | |
348 | - null, | |
349 | - 1, | |
350 | - $this->ref_cod_instituicao, | |
351 | - $_SESSION["tipo"], | |
352 | - $array_hora, | |
353 | - $this->ref_cod_servidor, | |
354 | - $this->nome_servidor, | |
355 | - $this->professor, | |
356 | - $this->horario, | |
357 | - false, | |
358 | - $this->lst_matriculas, | |
359 | - $this->matutino, | |
360 | - $this->vespertino, | |
361 | - $this->noturno, | |
362 | - $this->ref_cod_escola, | |
363 | - $hr_mat, | |
364 | - $hr_ves, | |
365 | - $hr_not, | |
366 | - $_SESSION["dia_semana"], | |
367 | - $this->ref_cod_instituicao | |
368 | - ,$this->identificador | |
369 | - ,$this->ref_cod_curso | |
370 | - ,$this->ref_cod_disciplina | |
371 | - ); | |
342 | + // Marca a disciplina como NULL se não for informada, restringindo a busca | |
343 | + // aos professores e não selecionar aqueles em que o curso não seja | |
344 | + // globalizado e sem disciplinas cadastradas | |
345 | + $this->ref_cod_disciplina = $this->ref_cod_disciplina ? | |
346 | + $this->ref_cod_disciplina : "NULL"; | |
347 | + | |
348 | + // Passa NULL para $alocacao_escola_instituicao senão o seu filtro anula | |
349 | + // um anterior (referente a selecionar somente servidores não alocados), | |
350 | + // selecionando apenas servidores alocados na instituição | |
351 | + $lista = $obj_servidor->lista( | |
352 | + NULL, | |
353 | + $this->ref_cod_deficiencia, | |
354 | + $this->ref_idesco, | |
355 | + $this->carga_horaria, | |
356 | + NULL, | |
357 | + NULL, | |
358 | + NULL, | |
359 | + NULL, | |
360 | + 1, | |
361 | + $this->ref_cod_instituicao, | |
362 | + $_SESSION['tipo'], | |
363 | + $array_hora, | |
364 | + $this->ref_cod_servidor, | |
365 | + $this->nome_servidor, | |
366 | + $this->professor, | |
367 | + $this->horario, | |
368 | + FALSE, | |
369 | + $this->lst_matriculas, | |
370 | + $this->matutino, | |
371 | + $this->vespertino, | |
372 | + $this->noturno, | |
373 | + $this->ref_cod_escola, | |
374 | + $hr_mat, | |
375 | + $hr_ves, | |
376 | + $hr_not, | |
377 | + $_SESSION['dia_semana'], | |
378 | + NULL, | |
379 | + $this->identificador, | |
380 | + $this->ref_cod_curso, | |
381 | + $this->ref_cod_disciplina | |
382 | + ); | |
383 | + | |
384 | + // Se for uma listagem de professores, recupera as disciplinas dadas para | |
385 | + // comparação com a de outros professores (somente quando a busca é para | |
386 | + // substituição de servidores) | |
387 | + $disciplinas = array(); | |
388 | + if ('true' == $this->professor) { | |
389 | + $disciplinas = $obj_servidor->getServidorDisciplinasQuadroHorarioHorarios( | |
390 | + $this->ref_cod_servidor, $this->ref_cod_instituicao); | |
391 | + } | |
372 | 392 | |
373 | 393 | $total = $obj_servidor->_total; |
374 | 394 | |
... | ... | @@ -401,6 +421,19 @@ class indice extends clsListagem |
401 | 421 | //$det_cod_servidor = $det_cod_servidor["idpes"]->detalhe(); |
402 | 422 | //$registro["nome"] = $det_cod_servidor["nome"]; |
403 | 423 | |
424 | + // Se servidor for professor, verifica se possui as mesmas | |
425 | + // disciplinas do servidor a ser substituido (este passo somente é | |
426 | + // executado ao buscar um servidor substituto) | |
427 | + if ($this->professor == 'true') { | |
428 | + $disciplinasSubstituto = clsPmieducarServidor::getServidorDisciplinas( | |
429 | + $registro['cod_servidor'], $this->ref_cod_instituicao); | |
430 | + | |
431 | + // Se os arrays diferirem, passa para o próximo resultado | |
432 | + if ($disciplinasSubstituto != $disciplinas) { | |
433 | + continue; | |
434 | + } | |
435 | + } | |
436 | + | |
404 | 437 | } |
405 | 438 | else |
406 | 439 | { | ... | ... |
ieducar/intranet/educar_pesquisa_servidor_lst_bkp.php
... | ... | @@ -1,567 +0,0 @@ |
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/clsListagem.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | - | |
32 | -class clsIndexBase extends clsBase | |
33 | -{ | |
34 | - function Formular() | |
35 | - { | |
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor" ); | |
37 | - $this->processoAp = "0"; | |
38 | - $this->renderMenu = false; | |
39 | - $this->renderMenuSuspenso = false; | |
40 | - } | |
41 | -} | |
42 | - | |
43 | -class indice extends clsListagem | |
44 | -{ | |
45 | - /** | |
46 | - * Referencia pega da session para o idpes do usuario atual | |
47 | - * | |
48 | - * @var int | |
49 | - */ | |
50 | - var $pessoa_logada; | |
51 | - | |
52 | - /** | |
53 | - * Titulo no topo da pagina | |
54 | - * | |
55 | - * @var int | |
56 | - */ | |
57 | - var $titulo; | |
58 | - | |
59 | - /** | |
60 | - * Quantidade de registros a ser apresentada em cada pagina | |
61 | - * | |
62 | - * @var int | |
63 | - */ | |
64 | - var $limite; | |
65 | - | |
66 | - /** | |
67 | - * Inicio dos registros a serem exibidos (limit) | |
68 | - * | |
69 | - * @var int | |
70 | - */ | |
71 | - var $offset; | |
72 | - | |
73 | - var $cod_servidor; | |
74 | - var $ref_cod_deficiencia; | |
75 | - var $ref_idesco; | |
76 | - var $ref_cod_funcao; | |
77 | - var $carga_horaria; | |
78 | - var $data_cadastro; | |
79 | - var $data_exclusao; | |
80 | - var $ativo; | |
81 | - var $horario; | |
82 | - var $lst_matriculas; | |
83 | - var $ref_cod_instituicao; | |
84 | - var $professor; | |
85 | - var $ref_cod_escola; | |
86 | - var $nome_servidor; | |
87 | - var $ref_cod_servidor; | |
88 | - var $periodo; | |
89 | - var $carga_horaria_usada; | |
90 | - var $min_mat; | |
91 | - var $min_ves; | |
92 | - var $min_not; | |
93 | - var $dia_semana; | |
94 | - | |
95 | - var $matutino = false; | |
96 | - var $vespertino = false; | |
97 | - var $noturno = false; | |
98 | - | |
99 | - function Gerar() | |
100 | - { | |
101 | - @session_start(); | |
102 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
103 | - | |
104 | - $_SESSION["campo1"] = $_GET["campo1"] ? $_GET["campo1"] : $_SESSION["campo1"]; | |
105 | - $_SESSION["campo2"] = $_GET["campo2"] ? $_GET["campo2"] : $_SESSION["campo2"]; | |
106 | - $_SESSION["dia_semana"] = isset($_GET["dia_semana"]) ? $_GET["dia_semana"] : $_SESSION["dia_semana"]; | |
107 | - $_SESSION["hora_inicial"] = $_GET["hora_inicial"] ? $_GET["hora_inicial"] : $_SESSION["hora_inicial"]; | |
108 | - $_SESSION["hora_final"] = $_GET["hora_final"] ? $_GET["hora_final"] : $_SESSION["hora_final"]; | |
109 | - $_SESSION["professor"] = $_GET["professor"] ? $_GET["professor"] : $_SESSION["professor"]; | |
110 | - $_SESSION["horario"] = $_GET["horario"] ? $_GET["horario"] : $_SESSION["horario"]; | |
111 | - $_SESSION["ref_cod_escola"] = $_GET["ref_cod_escola"] ? $_GET["ref_cod_escola"] : $_SESSION["ref_cod_escola"]; | |
112 | - $_SESSION["min_mat"] = $_GET["min_mat"] ? $_GET["min_mat"] : $_SESSION["min_mat"]; | |
113 | - $_SESSION["min_ves"] = $_GET["min_ves"] ? $_GET["min_ves"] : $_SESSION["min_ves"]; | |
114 | - $_SESSION["min_not"] = $_GET["min_not"] ? $_GET["min_not"] : $_SESSION["min_not"]; | |
115 | - | |
116 | - | |
117 | - if ( isset( $_GET["lst_matriculas"] ) ) | |
118 | - { | |
119 | - $_SESSION["lst_matriculas"] = $_GET["lst_matriculas"] ? $_GET["lst_matriculas"] : $_SESSION["lst_matriculas"]; | |
120 | - } | |
121 | - | |
122 | - if ( !isset( $_GET["tipo"] ) ) | |
123 | - { | |
124 | - $_SESSION["setAllField1"] = $_SESSION["setAllField2"] = $_SESSION["tipo"] = ""; | |
125 | - } | |
126 | - /*else | |
127 | - { | |
128 | - $_SESSION["hora_final"] = $_SESSION["hora_inicial"] = $_SESSION["dia_semana"] = ""; | |
129 | - }*/ | |
130 | - | |
131 | - $this->ref_cod_instituicao = $_SESSION["ref_cod_instituicao"] = $_GET["ref_cod_instituicao"] ? $_GET["ref_cod_instituicao"] : $_SESSION["ref_cod_instituicao"]; | |
132 | - $this->ref_cod_servidor = $_SESSION["ref_cod_servidor"] = $_GET["ref_cod_servidor"] ? $_GET["ref_cod_servidor"] : $_SESSION["ref_cod_servidor"]; | |
133 | - $this->professor = $_SESSION["professor"] = $_GET["professor"] ? $_GET["professor"] : $_SESSION["professor"]; | |
134 | - $this->horario = $_SESSION["horario"] = $_GET["horario"] ? $_GET["horario"] : $_SESSION["horario"]; | |
135 | - $this->ref_cod_escola = $_GET["ref_cod_escola"] ? $_GET["ref_cod_escola"] : $_SESSION["ref_cod_escola"]; | |
136 | - $this->min_mat = $_SESSION["min_mat"] = $_GET["min_mat"] ? $_GET["min_mat"] : $_SESSION["min_mat"]; | |
137 | - $this->min_ves = $_SESSION["min_ves"] = $_GET["min_ves"] ? $_GET["min_ves"] : $_SESSION["min_ves"]; | |
138 | - $this->min_not = $_SESSION["min_not"] = $_GET["min_not"] ? $_GET["min_not"] : $_SESSION["min_not"]; | |
139 | - | |
140 | - | |
141 | - if ( isset( $_GET["lst_matriculas"] ) && isset( $_SESSION["lst_matriculas"] ) ) | |
142 | - { | |
143 | - $this->lst_matriculas = $_GET["lst_matriculas"] ? $_GET["lst_matriculas"] : $_SESSION["lst_matriculas"]; | |
144 | - } | |
145 | - | |
146 | - $_SESSION["tipo"] = $_GET["tipo"] ? $_GET["tipo"] : $_SESSION["tipo"]; | |
147 | - session_write_close(); | |
148 | - | |
149 | - $this->titulo = "Servidores Públicos - Listagem"; | |
150 | - | |
151 | - foreach ( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | |
152 | - { | |
153 | - $this->$var = ( $val === "" ) ? null: $val; | |
154 | - } | |
155 | - | |
156 | - if ( isset( $this->lst_matriculas ) ) | |
157 | - { | |
158 | - $this->lst_matriculas = urldecode( $this->lst_matriculas ); | |
159 | - } | |
160 | - | |
161 | -// $obj_horarios = new clsPmieducarQuadroHorarioHorarios(); | |
162 | -// $lst_horarios = $obj_horarios->listaHoras( $this->ref_cod_instituicao, $this->ref_cod_servidor, 1, $_SESSION["dia_semana"] ); | |
163 | -// | |
164 | -// echo "<pre>"; | |
165 | -// print_r( $lst_horarios ); | |
166 | -// | |
167 | -// if ( is_array( $lst_horarios ) ) | |
168 | -// { | |
169 | -// foreach ( $lst_horarios as $horario ) | |
170 | -// { | |
171 | -// $hr_ini = explode( ":", $horario["hora_inicial"] ); | |
172 | -// $hr_fim = explode( ":", $horario["hora_final"] ); | |
173 | -// | |
174 | -// $min_ini = ( $hr_ini[0] * 60 ) + $hr_ini[1]; | |
175 | -// $min_fim = ( $hr_fim[0] * 60 ) + $hr_fim[1]; | |
176 | -// | |
177 | -// if ( $min_ini >= 480 && $min_ini <= 720 ) | |
178 | -// { | |
179 | -// if ( $min_fim <= 720 ) | |
180 | -// { | |
181 | -// $this->min_mat += $min_fim - $min_ini; | |
182 | -// } | |
183 | -// else if ( $min_fim >= 721 && $min_fim <= 1080 ) | |
184 | -// { | |
185 | -// $this->min_mat += 720 - $min_ini; | |
186 | -// $this->min_ves += $min_fim - 720; | |
187 | -// } | |
188 | -// else if ( ( $min_fim >= 1081 && $min_fim <= 1439 ) || $min_fim == 0 ) | |
189 | -// { | |
190 | -// $this->min_mat += 720 - $min_ini; | |
191 | -// $this->min_ves += 360; | |
192 | -// | |
193 | -// if ( $min_fim >= 1081 && $min_fim <= 1439 ) | |
194 | -// { | |
195 | -// $this->min_not += $min_fim - 1080; | |
196 | -// } | |
197 | -// else if ( $min_fim = 0 ) | |
198 | -// { | |
199 | -// $this->min_not += 360; | |
200 | -// } | |
201 | -// } | |
202 | -// } | |
203 | -// else if ( $min_ini >= 721 && $min_ini <= 1080 ) | |
204 | -// { | |
205 | -// if ( $min_fim <= 1080 ) | |
206 | -// { | |
207 | -// $this->min_ves += $min_fim - $min_ini; | |
208 | -// } | |
209 | -// else if ( ( $min_fim >= 1081 && $min_fim <= 1439 ) || $min_fim == 0 ) | |
210 | -// { | |
211 | -// $this->min_ves += 1080 - $min_ini; | |
212 | -// | |
213 | -// if ( $min_fim >= 1081 && $min_fim <= 1439 ) | |
214 | -// { | |
215 | -// $this->min_not += $min_fim - 1080; | |
216 | -// } | |
217 | -// else if ( $min_fim = 0 ) | |
218 | -// { | |
219 | -// $this->min_not += 360; | |
220 | -// } | |
221 | -// } | |
222 | -// } | |
223 | -// else if ( ( $min_ini >= 1081 && $min_ini <= 1439 ) || $min_ini == 0 ) | |
224 | -// { | |
225 | -// if ( $min_fim <= 1439 ) | |
226 | -// { | |
227 | -// $this->min_not += $min_fim - $min_ini; | |
228 | -// } | |
229 | -// else if ( $min_fim == 0 ) | |
230 | -// { | |
231 | -// $this->min_not += 1440 - $min_ini; | |
232 | -// } | |
233 | -// } | |
234 | -// } | |
235 | -// } | |
236 | - | |
237 | - $string1 = ( $this->min_mat - floor( $this->min_mat / 60 ) * 60 ); | |
238 | - $string1 = str_repeat( 0, 2 - strlen( $string1 ) ).$string1; | |
239 | - | |
240 | - $string2 = floor( $this->min_mat / 60 ); | |
241 | - $string2 = str_repeat( 0, 2 - strlen( $string2 ) ).$string2; | |
242 | - | |
243 | - $hr_mat = $string2.":".$string1; | |
244 | - | |
245 | - $string1 = ( $this->min_ves - floor( $this->min_ves / 60 ) * 60 ); | |
246 | - $string1 = str_repeat( 0, 2 - strlen( $string1 ) ).$string1; | |
247 | - | |
248 | - $string2 = floor( $this->min_ves / 60 ); | |
249 | - $string2 = str_repeat( 0, 2 - strlen( $string2 ) ).$string2; | |
250 | - | |
251 | - $hr_ves = $string2.":".$string1; | |
252 | - | |
253 | - | |
254 | - $string1 = ( $this->min_not - floor( $this->min_not / 60 ) * 60 ); | |
255 | - $string1 = str_repeat( 0, 2 - strlen( $string1 ) ).$string1; | |
256 | - | |
257 | - $string2 = floor( $this->min_not / 60 ); | |
258 | - $string2 = str_repeat( 0, 2 - strlen( $string2 ) ).$string2; | |
259 | - | |
260 | - $hr_not = $string2.":".$string1; | |
261 | - | |
262 | - $hora_inicial_ = explode( ":", $_SESSION["hora_inicial"] ); | |
263 | - $hora_final_ = explode( ":", $_SESSION["hora_final"] ); | |
264 | - $horas_ini = sprintf( "%02d", ( int ) abs( $hora_final_[0] ) - abs( $hora_inicial_[0] ) ); | |
265 | - $minutos_ini = sprintf( "%02d", ( int ) abs( $hora_final_[1] ) - abs( $hora_inicial_[1] ) ); | |
266 | - | |
267 | - $h_m_ini = ( $hora_inicial_[0] * 60 ) + $hora_inicial_[1]; | |
268 | - $h_m_fim = ( $hora_final_[0] * 60 ) + $hora_final_[1]; | |
269 | - | |
270 | - if ( $h_m_ini >= 480 && $h_m_ini <= 720 ) | |
271 | - { | |
272 | - $this->matutino = true; | |
273 | - | |
274 | - if ( $h_m_fim >= 721 && $h_m_fim <= 1080 ) | |
275 | - { | |
276 | - $this->vespertino = true; | |
277 | - } | |
278 | - else if ( ( $h_m_fim >= 1801 && $h_m_fim <= 1439 ) || ( $h_m_fim == 0 ) ) | |
279 | - { | |
280 | - //$this->vespertino = true; | |
281 | - $this->noturno = true; | |
282 | - } | |
283 | - } | |
284 | - else if ( $h_m_ini >= 721 && $h_m_ini <= 1080 ) | |
285 | - { | |
286 | - $this->vespertino = true; | |
287 | - | |
288 | - if ( ( $h_m_fim >= 1081 && $h_m_fim <= 1439 ) /*|| ( $h_m_fim == 0 )*/ ) | |
289 | - { | |
290 | - $this->noturno = true; | |
291 | - } | |
292 | - } | |
293 | - else if ( ( $h_m_ini >= 1081 && $h_m_ini <= 1439 ) || ( $h_m_ini == 0 ) ) | |
294 | - { | |
295 | - $this->noturno = true; | |
296 | - } | |
297 | - | |
298 | - $this->addCabecalhos( array( | |
299 | - "Nome do Servidor", | |
300 | - "Matrícula", | |
301 | - "Instituição" | |
302 | - ) ); | |
303 | - | |
304 | - $this->campoTexto( "nome_servidor", "Nome Servidor", $this->nome_servidor, 30, 255, false ); | |
305 | - $this->campoOculto( "tipo", $_GET["tipo"] ); | |
306 | - | |
307 | - | |
308 | - // Paginador | |
309 | - $this->limite = 20; | |
310 | - $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"] * $this->limite-$this->limite: 0; | |
311 | - | |
312 | - $obj_servidor = new clspmieducarservidor(); | |
313 | - $obj_servidor->setOrderby( "carga_horaria ASC" ); | |
314 | - $obj_servidor->setLimite( $this->limite, $this->offset ); | |
315 | - if ( $_SESSION["dia_semana"] && $_SESSION["hora_inicial"] && $_SESSION["hora_final"] ) | |
316 | - { | |
317 | - $array_hora = array( $_SESSION["dia_semana"], $_SESSION["hora_inicial"], $_SESSION["hora_final"] ); | |
318 | - } | |
319 | - | |
320 | - $lista = $obj_servidor->lista( | |
321 | - null, | |
322 | - $this->ref_cod_deficiencia, | |
323 | - $this->ref_idesco, | |
324 | - $this->carga_horaria, | |
325 | - null, | |
326 | - null, | |
327 | - null, | |
328 | - null, | |
329 | - 1, | |
330 | - $this->ref_cod_instituicao, | |
331 | - $_SESSION["tipo"], | |
332 | - $array_hora, | |
333 | - $this->ref_cod_servidor, | |
334 | - $this->nome_servidor, | |
335 | - $this->professor, | |
336 | - $this->horario, | |
337 | - false, | |
338 | - $this->lst_matriculas, | |
339 | - $this->matutino, | |
340 | - $this->vespertino, | |
341 | - $this->noturno, | |
342 | - $this->ref_cod_escola, | |
343 | - $hr_mat, | |
344 | - $hr_ves, | |
345 | - $hr_not, | |
346 | - $_SESSION["dia_semana"], | |
347 | - $this->ref_cod_instituicao | |
348 | - | |
349 | - ); | |
350 | - | |
351 | - $total = $obj_servidor->_total; | |
352 | - | |
353 | - // pega detalhes de foreign_keys | |
354 | - if ( class_exists( "clsPmieducarInstituicao" ) ) | |
355 | - { | |
356 | - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $lista[0]["ref_cod_instituicao"] ); | |
357 | - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); | |
358 | - $nm_instituicao = $det_ref_cod_instituicao["nm_instituicao"]; | |
359 | - | |
360 | - } | |
361 | - else | |
362 | - { | |
363 | - //$registro["ref_cod_instituicao"] = "Erro na geração"; | |
364 | - echo "<!--\nErro\nClasse não existente: clsPmieducarInstituicao\n-->"; | |
365 | - } | |
366 | - | |
367 | - // monta a lista | |
368 | - if ( is_array( $lista ) && count( $lista ) ) | |
369 | - { | |
370 | - | |
371 | - foreach ( $lista AS $registro ) | |
372 | - { | |
373 | - | |
374 | - if ( class_exists( "clsFuncionario" ) ) | |
375 | - { | |
376 | - $obj_cod_servidor = new clsFuncionario( $registro["cod_servidor"] ); | |
377 | - $det_cod_servidor = $obj_cod_servidor->detalhe(); | |
378 | - $registro["matricula"] = $det_cod_servidor['matricula']; | |
379 | - //$det_cod_servidor = $det_cod_servidor["idpes"]->detalhe(); | |
380 | - //$registro["nome"] = $det_cod_servidor["nome"]; | |
381 | - | |
382 | - } | |
383 | - else | |
384 | - { | |
385 | - $registro["cod_servidor"] = "Erro na geracao"; | |
386 | - echo "<!--\nErro\nClasse nao existente: clsFuncionario\n-->"; | |
387 | - } | |
388 | - | |
389 | - | |
390 | - /*if ( $this->ref_cod_escola ) | |
391 | - { | |
392 | - $obj_servidor_alocacao = new clsPmieducarServidorAlocacao(); | |
393 | - $det_servidor_alocacao = $obj_servidor_alocacao->lista( null, $this->ref_cod_instituicao, null, null, $this->ref_cod_escola, $registro['cod_servidor'], null, null, null, null, 1 ); | |
394 | - | |
395 | - if ( !$det_servidor_alocacao ) | |
396 | - { | |
397 | - continue; | |
398 | - } | |
399 | - }*/ | |
400 | - | |
401 | - if ( $_SESSION["tipo"] ) | |
402 | - { | |
403 | - if ( is_string( $_SESSION['campo1'] ) && is_string( $_SESSION['campo2'] ) ) | |
404 | - { | |
405 | - if ( is_string( $_SESSION['horario'] ) ) | |
406 | - { | |
407 | - $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); addVal1('{$_SESSION['campo2']}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\""; | |
408 | - } | |
409 | - else | |
410 | - { | |
411 | - $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}',null); addVal1('{$_SESSION['campo2']}','{$registro['nome']}',null); $setAll fecha();\""; | |
412 | - } | |
413 | - } | |
414 | - elseif ( is_string( $_SESSION['campo1'] ) ) | |
415 | - { | |
416 | - $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\""; | |
417 | - } | |
418 | - } | |
419 | - else | |
420 | - { | |
421 | - if ( is_string( $_SESSION['campo1'] ) && is_string( $_SESSION['campo2'] ) ) | |
422 | - { | |
423 | - $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); addVal1('{$_SESSION['campo2']}','{$registro['nome']}','{$registro['cod_servidor']}'); $setAll fecha();\""; | |
424 | - } | |
425 | - else if ( is_string( $_SESSION['campo2'] ) ) | |
426 | - { | |
427 | - $script = " onclick=\"addVal1('{$_SESSION['campo2']}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\""; | |
428 | - } | |
429 | - else if ( is_string( $_SESSION['campo1'] ) ) | |
430 | - { | |
431 | - $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_servidor']}','{$registro['nome']}'); $setAll fecha();\""; | |
432 | - } | |
433 | - } | |
434 | - | |
435 | - $this->addLinhas( array( | |
436 | - "<a href=\"javascript:void(0);\" $script>{$registro["nome"]}</a>", | |
437 | - "<a href=\"javascript:void(0);\" $script>{$registro["matricula"]}</a>", | |
438 | - "<a href=\"javascript:void(0);\" $script>{$nm_instituicao}</a>" | |
439 | - ) ); | |
440 | - } | |
441 | - } | |
442 | - | |
443 | - $this->addPaginador2( "educar_pesquisa_servidor_lst.php", $total, $_GET, $this->nome, $this->limite ); | |
444 | - $obj_permissoes = new clsPermissoes(); | |
445 | - $this->largura = "100%"; | |
446 | - } | |
447 | -} | |
448 | -// cria uma extensao da classe base | |
449 | -$pagina = new clsIndexBase(); | |
450 | -// cria o conteudo | |
451 | -$miolo = new indice(); | |
452 | -// adiciona o conteudo na clsBase | |
453 | -$pagina->addForm( $miolo ); | |
454 | -// gera o html | |
455 | -$pagina->MakeAll(); | |
456 | -?> | |
457 | -<script> | |
458 | -function addVal1( campo, valor, opcao ) | |
459 | -{ | |
460 | - if ( window.parent.document.getElementById( campo ) ) | |
461 | - { | |
462 | - if ( window.parent.document.getElementById( campo ).type == "select-one") | |
463 | - { | |
464 | - obj = window.parent.document.getElementById( campo ); | |
465 | - novoIndice = obj.options.length; | |
466 | - obj.options[novoIndice] = new Option( opcao ); | |
467 | - opcao = obj.options[novoIndice]; | |
468 | - opcao.value = valor; | |
469 | - opcao.selected = true; | |
470 | - obj.onchange(); | |
471 | - } | |
472 | - else if ( window.parent.document.getElementById( campo ) ) | |
473 | - { | |
474 | - obj = window.parent.document.getElementById( campo ); | |
475 | - obj.value = valor; | |
476 | - } | |
477 | - } | |
478 | -} | |
479 | - | |
480 | -function fecha() | |
481 | -{ | |
482 | - window.parent.fechaExpansivel('div_dinamico_'+(parent.DOM_divs.length*1-1)); | |
483 | -} | |
484 | - | |
485 | -function setAll(field,value){ | |
486 | - var elements = window.parent.document.getElementsByName(field); | |
487 | - | |
488 | - for(var ct =0;ct < elements.length;ct++) | |
489 | - { | |
490 | - elements[ct].value = value; | |
491 | - } | |
492 | -} | |
493 | - | |
494 | -function clearAll(){ | |
495 | - | |
496 | - var elements = window.parent.document.getElementsByName('ref_cod_servidor_substituto'); | |
497 | - | |
498 | - for(var ct =0;ct < elements.length;ct++) | |
499 | - { | |
500 | - elements[ct].value = ''; | |
501 | - } | |
502 | - | |
503 | - | |
504 | - | |
505 | - for(var ct =0;ct < num_alocacao;ct++) | |
506 | - { | |
507 | - var elements = window.parent.document.getElementById('ref_cod_servidor_substituto_' + ct).value=''; | |
508 | - } | |
509 | - | |
510 | -} | |
511 | -/* | |
512 | -function ok(servidor,campo) | |
513 | -{ | |
514 | - var chave = /[0-9]+/.exec(campo)[0]; | |
515 | - | |
516 | - var horas_trabalhadas = new Array(0,0); | |
517 | - var horas_ = new Array(0,0); | |
518 | - var total_horas = new Array(0,0); | |
519 | - | |
520 | - try{ | |
521 | - horas_trabalhadas = getArrayHora(window.parent.array_horas_utilizadas_servidor['' + servidor + '_'][0] ); | |
522 | - }catch(e){ | |
523 | - //servidor nao tem nenhuma hora trabalhada return true; | |
524 | - horas_trabalhadas = Array(0,0); | |
525 | - } | |
526 | - | |
527 | - horas_ = getArrayHora(window.parent.array_servidores[chave][0] ); | |
528 | - | |
529 | - for(var ct = 0 ;ct < window.parent.array_servidores.length;ct++) | |
530 | - { | |
531 | - if(window.parent.array_servidores[ct][1] == servidor && ct != chave) | |
532 | - { | |
533 | - var horas = getArrayHora(window.parent.array_servidores[ct][0]); | |
534 | - horas_[0] = parseInt(horas_[0],10) + parseInt(horas[0],10); | |
535 | - horas_[1] = parseInt(horas_[1],10) + parseInt(horas[1],10); | |
536 | - } | |
537 | - } | |
538 | - | |
539 | - | |
540 | - | |
541 | - total_horas = getArrayHora(window.parent.array_horas_servidor['' + servidor + '_'][0] ); | |
542 | -//alert(parseInt(horas_trabalhadas[0])+ parseInt(horas_[0])); | |
543 | -//alert(total_horas); | |
544 | - horas_trabalhadas = Date.UTC(1970,01,01,parseInt(horas_trabalhadas[0],10) + parseInt(horas_[0],10) ,horas_trabalhadas[1] + horas_[1],0); | |
545 | - | |
546 | - total_horas = Date.UTC(1970,01,01,total_horas[0] ,total_horas[1],0); | |
547 | - if(total_horas >= horas_trabalhadas){ | |
548 | - window.parent.array_servidores[chave][1] = servidor; | |
549 | - return true; | |
550 | - } | |
551 | - else | |
552 | - alert('Excedeu o numero de horas trabalhadas'); | |
553 | - return false; | |
554 | -// window.parent.array_servidores['' + valor + ''] | |
555 | -}*/ | |
556 | - | |
557 | -function getArrayHora(hora){ | |
558 | - var array_h; | |
559 | - if(hora) | |
560 | - array_h = hora.split(":"); | |
561 | - else | |
562 | - array_h = new Array(0,0); | |
563 | - | |
564 | - return array_h; | |
565 | - | |
566 | -} | |
567 | -</script> | |
568 | 0 | \ No newline at end of file |
ieducar/intranet/educar_servidor_det.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/clsDetalhe.inc.php"); | |
29 | -require_once ("include/clsBanco.inc.php"); | |
30 | -require_once( "include/pmieducar/geral.inc.php" ); | |
31 | - | |
32 | -class clsIndexBase extends clsBase | |
33 | -{ | |
34 | - function Formular() | |
35 | - { | |
36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Servidor" ); | |
37 | - $this->processoAp = "635"; | |
38 | - } | |
39 | -} | |
40 | 2 | |
41 | -class indice extends clsDetalhe | |
42 | -{ | |
43 | - /** | |
44 | - * Titulo no topo da pagina | |
45 | - * | |
46 | - * @var int | |
47 | - */ | |
48 | - var $titulo; | |
49 | - | |
50 | - var $cod_servidor; | |
51 | - var $ref_cod_deficiencia; | |
52 | - var $ref_idesco; | |
53 | - var $ref_cod_funcao; | |
54 | - var $carga_horaria; | |
55 | - var $data_cadastro; | |
56 | - var $data_exclusao; | |
57 | - var $ativo; | |
58 | - | |
59 | - var $ref_cod_instituicao; | |
60 | - | |
61 | - var $alocacao_array = array(); | |
62 | - | |
63 | - function Gerar() | |
64 | - { | |
65 | - @session_start(); | |
66 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
67 | - session_write_close(); | |
68 | - | |
69 | - $this->titulo = "Servidor - Detalhe"; | |
70 | - $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
71 | - | |
72 | - $this->cod_servidor=$_GET["cod_servidor"]; | |
73 | - $this->ref_cod_instituicao=$_GET["ref_cod_instituicao"]; | |
74 | - | |
75 | - $tmp_obj = new clsPmieducarServidor( $this->cod_servidor,null,null,null,null,null,null,$this->ref_cod_instituicao ); | |
76 | - $registro = $tmp_obj->detalhe(); | |
77 | - | |
78 | - if( !$registro ) | |
79 | - { | |
80 | - header( "location: educar_servidor_lst.php" ); | |
81 | - die(); | |
82 | - } | |
83 | - | |
84 | - if( class_exists( "clsCadastroDeficiencia" ) ) | |
85 | - { | |
86 | - $obj_ref_cod_deficiencia = new clsCadastroDeficiencia( $registro["ref_cod_deficiencia"] ); | |
87 | - $det_ref_cod_deficiencia = $obj_ref_cod_deficiencia->detalhe(); | |
88 | - $registro["ref_cod_deficiencia"] = $det_ref_cod_deficiencia["nm_deficiencia"]; | |
89 | - } | |
90 | - else | |
91 | - { | |
92 | - $registro["ref_cod_deficiencia"] = "Erro na geracao"; | |
93 | - echo "<!--\nErro\nClasse nao existente: clsCadastroDeficiencia\n-->"; | |
94 | - } | |
95 | - | |
96 | - if( class_exists( "clsCadastroEscolaridade" ) ) | |
97 | - { | |
98 | - $obj_ref_idesco = new clsCadastroEscolaridade( $registro["ref_idesco"] ); | |
99 | - $det_ref_idesco = $obj_ref_idesco->detalhe(); | |
100 | - $registro["ref_idesco"] = $det_ref_idesco["descricao"]; | |
101 | - } | |
102 | - else | |
103 | - { | |
104 | - $registro["ref_idesco"] = "Erro na geracao"; | |
105 | - echo "<!--\nErro\nClasse nao existente: clsCadastroEscolaridade\n-->"; | |
106 | - } | |
107 | - | |
108 | - if( class_exists( "clsPmieducarFuncao" ) ) | |
109 | - { | |
110 | - $obj_ref_cod_funcao = new clsPmieducarFuncao( $registro["ref_cod_funcao"],null,null,null,null,null,null,null,null,$this->ref_cod_instituicao ); | |
111 | - $det_ref_cod_funcao = $obj_ref_cod_funcao->detalhe(); | |
112 | - $registro["ref_cod_funcao"] = $det_ref_cod_funcao["nm_funcao"]; | |
113 | - } | |
114 | - else | |
115 | - { | |
116 | - $registro["ref_cod_funcao"] = "Erro na geracao"; | |
117 | - echo "<!--\nErro\nClasse nao existente: clsPmieducarFuncao\n-->"; | |
118 | - } | |
119 | - | |
120 | - if( class_exists( "clsFuncionario" ) ) | |
121 | - { | |
122 | - $obj_cod_servidor = new clsFuncionario( $registro["cod_servidor"] ); | |
123 | - $det_cod_servidor = $obj_cod_servidor->detalhe(); | |
124 | - $registro["matricula"] = $det_cod_servidor["matricula"]; | |
125 | - $det_cod_servidor = $det_cod_servidor["idpes"]->detalhe(); | |
126 | - $registro["nome"] = $det_cod_servidor["nome"]; | |
127 | - | |
128 | - } | |
129 | - else | |
130 | - { | |
131 | - $registro["cod_servidor"] = "Erro na geracao"; | |
132 | - echo "<!--\nErro\nClasse nao existente: clsFuncionario\n-->"; | |
133 | - } | |
134 | - | |
135 | - if( class_exists( "clsPmieducarInstituicao" ) ) | |
136 | - { | |
137 | - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); | |
138 | - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); | |
139 | - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"]; | |
140 | - } | |
141 | - else | |
142 | - { | |
143 | - $registro["ref_cod_instituicao"] = "Erro na geração"; | |
144 | - echo "<!--\nErro\nClasse não existente: clsPmieducarInstituicao\n-->"; | |
145 | - } | |
146 | - | |
147 | - $obj = new clsPmieducarServidorAlocacao( ); | |
148 | - $obj->setOrderby("periodo,carga_horaria"); | |
149 | - $lista = $obj->lista(null,$this->ref_cod_instituicao,null,null,null,$this->cod_servidor,null,null,null,null,null,null,null,null,null,1); | |
150 | - if( $lista ) | |
151 | - { | |
152 | - foreach( $lista AS $campo => $val ){ // passa todos os valores obtidos no registro para atributos do objeto | |
153 | - $temp = array(); | |
154 | - $temp['carga_horaria'] = $val['carga_horaria']; | |
155 | - $temp['periodo'] = $val['periodo']; | |
156 | - | |
157 | - $obj_escola = new clsPmieducarEscola($val['ref_cod_escola']); | |
158 | - $det_escola = $obj_escola->detalhe(); | |
159 | - $det_escola = $det_escola["nome"]; | |
160 | - $temp['ref_cod_escola'] = $det_escola; | |
161 | - | |
162 | - $this->alocacao_array[] = $temp; | |
163 | - | |
164 | - } | |
165 | - | |
166 | - | |
167 | - } | |
168 | - | |
169 | - if( $registro["cod_servidor"] ) | |
170 | - { | |
171 | - $this->addDetalhe( array( "Servidor", "{$registro["cod_servidor"]}") ); | |
172 | - } | |
173 | - if( $registro["matricula"] ) | |
174 | - { | |
175 | - $this->addDetalhe( array( "Matrícula", "{$registro["matricula"]}") ); | |
176 | - } | |
177 | - if( $registro["nome"] ) | |
178 | - { | |
179 | - $this->addDetalhe( array( "Nome", "{$registro["nome"]}") ); | |
180 | - } | |
181 | - if( $registro["ref_cod_instituicao"] ) | |
182 | - { | |
183 | - $this->addDetalhe( array( "Instituição", "{$registro["ref_cod_instituicao"]}") ); | |
184 | - } | |
185 | - if( $registro["ref_cod_deficiencia"] ) | |
186 | - { | |
187 | - $this->addDetalhe( array( "Deficiéncia", "{$registro["ref_cod_deficiencia"]}") ); | |
188 | - } | |
189 | - if( $registro["ref_idesco"] ) | |
190 | - { | |
191 | - $this->addDetalhe( array( "Escolaridade", "{$registro["ref_idesco"]}") ); | |
192 | - } | |
193 | - if( $registro["ref_cod_subnivel"] ) | |
194 | - { | |
195 | - $obj_nivel = new clsPmieducarSubnivel($registro["ref_cod_subnivel"]); | |
196 | - $det_nivel = $obj_nivel->detalhe(); | |
197 | - | |
198 | - $this->addDetalhe( array( "Nível", "{$det_nivel["nm_subnivel"]}") ); | |
199 | - } | |
200 | - | |
201 | - if( $registro["ref_cod_funcao"] ) | |
202 | - { | |
203 | - $this->addDetalhe( array( "Função", "{$registro["ref_cod_funcao"]}") ); | |
204 | - } | |
205 | - | |
206 | - $obj_funcao = new clsPmieducarServidorFuncao(); | |
207 | - $lst_funcao = $obj_funcao->lista($this->ref_cod_instituicao,$this->cod_servidor); | |
208 | - | |
209 | - | |
210 | - if( $lst_funcao ) | |
211 | - { | |
212 | - $tabela .= "<table cellspacing='0' cellpadding='0' border='0'> | |
213 | - <tr bgcolor='#A1B3BD' align='center'> | |
214 | - <td width='150'>Função</td> | |
215 | - </tr>"; | |
216 | - | |
217 | - $class = "formlttd"; | |
218 | - | |
219 | - $tab_disc = null; | |
220 | - | |
221 | - $obj_disciplina_servidor = new clsPmieducarServidorDisciplina(); | |
222 | - $lst_disciplina_servidor = $obj_disciplina_servidor->lista(null,$this->ref_cod_instituicao,$this->cod_servidor); | |
223 | - | |
224 | - if($lst_disciplina_servidor) | |
225 | - { | |
226 | - $tab_disc .= "<table cellspacing='0' cellpadding='0' width='200' border='0' style='border:1px dotted #000000'>"; | |
227 | - | |
228 | - $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
229 | - $tab_disc .= " <tr> | |
230 | - <td bgcolor='#A1B3BD' align='center'>Disciplinas</td> | |
231 | - </tr>"; | |
232 | - foreach ($lst_disciplina_servidor as $disciplina) | |
233 | - { | |
234 | - $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']); | |
235 | - $det_disciplina = $obj_disciplina->detalhe(); | |
236 | - | |
237 | - $tab_disc .= " <tr class='$class2' align='center'> | |
238 | - <td align='left'>{$det_disciplina['nm_disciplina']}</td> | |
239 | - </tr>"; | |
240 | - | |
241 | - $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
242 | - | |
243 | - } | |
244 | - $tab_disc .= "</table>"; | |
245 | - } | |
246 | - | |
247 | - $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(); | |
248 | - $lst_servidor_curso = $obj_servidor_curso->lista(null,$this->ref_cod_instituicao,$this->cod_servidor); | |
249 | - | |
250 | - if($lst_servidor_curso) | |
251 | - { | |
252 | - $tab_curso .= "<table cellspacing='0' cellpadding='0' width='200' border='0' style='border:1px dotted #000000'>"; | |
253 | - | |
254 | - $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
255 | - $tab_curso .= " <tr> | |
256 | - <td bgcolor='#A1B3BD' align='center'>Cursos Ministrados</td> | |
257 | - </tr>"; | |
258 | - foreach ($lst_servidor_curso as $curso) | |
259 | - { | |
260 | - $obj_curso = new clsPmieducarCurso($curso['ref_cod_curso']); | |
261 | - $det_curso = $obj_curso->detalhe(); | |
262 | - | |
263 | - $tab_curso .= " <tr class='$class2' align='center'> | |
264 | - <td align='left'>{$det_curso['nm_curso']}</td> | |
265 | - </tr>"; | |
266 | - | |
267 | - $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
268 | - | |
269 | - } | |
270 | - $tab_curso .= "</table>"; | |
271 | - } | |
272 | - | |
273 | - foreach ($lst_funcao as $funcao) | |
274 | - { | |
275 | - | |
276 | - $obj_funcao = new clsPmieducarFuncao($funcao['ref_cod_funcao']); | |
277 | - $det_funcao = $obj_funcao->detalhe(); | |
278 | - | |
279 | - $tabela .= " <tr class='$class' align='left'> | |
280 | - <td><b>{$det_funcao['nm_funcao']}</b></td> | |
281 | - </tr>"; | |
282 | - | |
283 | - $class = $class == "formlttd" ? "formmdtd" : "formlttd" ; | |
284 | - } | |
285 | - | |
286 | - if($tab_curso) | |
287 | - { | |
288 | - | |
289 | - $tabela .= " <tr class='$class' align='center'> | |
290 | - <td style='padding:5px'>$tab_curso</td> | |
291 | - </tr>"; | |
292 | - } | |
293 | - | |
294 | - if($tab_disc) | |
295 | - { | |
296 | - | |
297 | - $tabela .= " <tr class='$class' align='center'> | |
298 | - <td style='padding:5px'>$tab_disc</td> | |
299 | - </tr>"; | |
300 | - } | |
301 | - | |
302 | - $tabela .= "</table>"; | |
303 | - | |
304 | - $this->addDetalhe(array("Função", "<a href='javascript:trocaDisplay(\"det_f\");' >Mostrar detalhe</a><div id='det_f' name='det_f' style='display:none;'>".$tabela."</div>")); | |
305 | - } | |
306 | - | |
307 | - $tabela = null; | |
308 | - | |
309 | - if( $registro["carga_horaria"] ) | |
310 | - { | |
311 | - | |
312 | - $this->addDetalhe( array( "Carga Horária", "{$registro["carga_horaria"]}")); | |
313 | - } | |
314 | - | |
315 | - $dias_da_semana = array( '' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado' ); | |
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 | + | |
24 | +/** | |
25 | + * Mostra detalhes do cadastro de um servidor junto com ações de cadastro | |
26 | + * | |
27 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
28 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
29 | + * @package Core | |
30 | + * @subpackage Servidor | |
31 | + * @since Disponível desde a versão 1.0.0 | |
32 | + * @version $Id$ | |
33 | + */ | |
34 | + | |
35 | +require_once 'include/clsBase.inc.php'; | |
36 | +require_once 'include/clsDetalhe.inc.php'; | |
37 | +require_once 'include/clsBanco.inc.php'; | |
38 | +require_once 'include/pmieducar/geral.inc.php'; | |
39 | + | |
40 | + | |
41 | +class clsIndexBase extends clsBase { | |
42 | + public function Formular() { | |
43 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Servidor'); | |
44 | + $this->processoAp = '635'; | |
45 | + } | |
46 | +} | |
316 | 47 | |
317 | - if( $this->alocacao_array ) | |
318 | - { | |
319 | - $tabela .= "<table cellspacing='0' cellpadding='0' border='0'> | |
320 | - <tr bgcolor='#A1B3BD' align='center'> | |
321 | - <td width='150'>Carga Horaria</td> | |
322 | - <td width='80'>Periodo</td> | |
323 | - <td width='150'>Escola</td> | |
324 | - </tr>"; | |
325 | - | |
326 | - $class = "formlttd"; | |
327 | - foreach ($this->alocacao_array as $alocacao) | |
328 | - { | |
329 | - switch ( $alocacao['periodo'] ) | |
330 | - { | |
331 | - case 1: | |
332 | - $nm_periodo = "Matutino"; | |
333 | - break; | |
334 | - case 2: | |
335 | - $nm_periodo = "Vespertino"; | |
336 | - break; | |
337 | - case 3: | |
338 | - $nm_periodo = "Noturno"; | |
339 | - break; | |
340 | - } | |
341 | - $tabela .= " <tr class='$class' align='center'> | |
342 | - <td>{$alocacao['carga_horaria']}</td> | |
343 | - <td>{$nm_periodo}</td> | |
344 | - <td>{$alocacao['ref_cod_escola']}</td> | |
345 | - </tr>"; | |
346 | - $class = $class == "formlttd" ? "formmdtd" : "formlttd" ; | |
347 | - } | |
348 | - $tabela .= "</table>"; | |
349 | - | |
350 | - $this->addDetalhe(array("Horários de trabalho", "<a href='javascript:trocaDisplay(\"det_pree\");' >Mostrar detalhe</a><div id='det_pree' name='det_pree' style='display:none;'>".$tabela."</div>")); | |
351 | - } | |
352 | - | |
353 | - $obj_permissoes = new clsPermissoes(); | |
354 | - | |
355 | - if( $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 3 ) ) | |
356 | - { | |
357 | - $this->url_novo = "educar_servidor_cad.php"; | |
358 | - $this->url_editar = "educar_servidor_cad.php?cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$this->ref_cod_instituicao}"; | |
359 | 48 | |
360 | - // VERIFICAR SE ESTA AFASTADO FICA RETORNAR | |
361 | - // VERIFICAR SE ESTA Alocar Servidor FICA SUBSTITUIR | |
49 | +class indice extends clsDetalhe { | |
50 | + | |
51 | + /** | |
52 | + * Título da página | |
53 | + * @var string | |
54 | + */ | |
55 | + public $titulo; | |
56 | + | |
57 | + /** | |
58 | + * Atributos de dados | |
59 | + */ | |
60 | + public | |
61 | + $cod_servidor = NULL, | |
62 | + $ref_cod_deficiencia = NULL, | |
63 | + $ref_idesco = NULL, | |
64 | + $ref_cod_funcao = NULL, | |
65 | + $carga_horaria = NULL, | |
66 | + $data_cadastro = NULL, | |
67 | + $data_exclusao = NULL, | |
68 | + $ativo = NULL, | |
69 | + $ref_cod_instituicao = NULL, | |
70 | + $alocacao_array = array(); | |
71 | + | |
72 | + | |
73 | + | |
74 | + /** | |
75 | + * Implementação do método Gerar() | |
76 | + */ | |
77 | + public function Gerar() { | |
78 | + session_start(); | |
79 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
80 | + session_write_close(); | |
81 | + | |
82 | + $this->titulo = 'Servidor - Detalhe'; | |
83 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
84 | + | |
85 | + $this->cod_servidor = $_GET["cod_servidor"]; | |
86 | + $this->ref_cod_instituicao = $_GET["ref_cod_instituicao"]; | |
87 | + | |
88 | + $tmp_obj = new clsPmieducarServidor( $this->cod_servidor,null,null,null,null,null,null,$this->ref_cod_instituicao ); | |
89 | + $registro = $tmp_obj->detalhe(); | |
90 | + | |
91 | + if (!$registro) { | |
92 | + header('Location: educar_servidor_lst.php'); | |
93 | + die(); | |
94 | + } | |
95 | + | |
96 | + // Deficiência | |
97 | + $obj_ref_cod_deficiencia = new clsCadastroDeficiencia($registro['ref_cod_deficiencia']); | |
98 | + $det_ref_cod_deficiencia = $obj_ref_cod_deficiencia->detalhe(); | |
99 | + $registro['ref_cod_deficiencia'] = $det_ref_cod_deficiencia['nm_deficiencia']; | |
100 | + | |
101 | + // Escolaridade | |
102 | + $obj_ref_idesco = new clsCadastroEscolaridade($registro['ref_idesco']); | |
103 | + $det_ref_idesco = $obj_ref_idesco->detalhe(); | |
104 | + $registro['ref_idesco'] = $det_ref_idesco['descricao']; | |
105 | + | |
106 | + // Função | |
107 | + $obj_ref_cod_funcao = new clsPmieducarFuncao($registro['ref_cod_funcao'], | |
108 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao); | |
109 | + $det_ref_cod_funcao = $obj_ref_cod_funcao->detalhe(); | |
110 | + $registro['ref_cod_funcao'] = $det_ref_cod_funcao['nm_funcao']; | |
111 | + | |
112 | + // Nome | |
113 | + $obj_cod_servidor = new clsFuncionario($registro['cod_servidor']); | |
114 | + $det_cod_servidor = $obj_cod_servidor->detalhe(); | |
115 | + | |
116 | + $registro['matricula'] = $det_cod_servidor['matricula']; | |
117 | + $det_cod_servidor = $det_cod_servidor['idpes']->detalhe(); | |
118 | + $registro['nome'] = $det_cod_servidor['nome']; | |
119 | + | |
120 | + // Instituição | |
121 | + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']); | |
122 | + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe(); | |
123 | + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao']; | |
124 | + | |
125 | + // Alocação do servidor | |
126 | + $obj = new clsPmieducarServidorAlocacao(); | |
127 | + $obj->setOrderby('periodo, carga_horaria'); | |
128 | + $lista = $obj->lista(NULL, $this->ref_cod_instituicao, NULL, NULL, NULL, | |
129 | + $this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ,1); | |
130 | + | |
131 | + if ($lista) { | |
132 | + // Passa todos os valores do registro para atributos do objeto | |
133 | + foreach ($lista as $campo => $val) { | |
134 | + $temp = array(); | |
135 | + $temp['carga_horaria'] = $val['carga_horaria']; | |
136 | + $temp['periodo'] = $val['periodo']; | |
137 | + | |
138 | + $obj_escola = new clsPmieducarEscola($val['ref_cod_escola']); | |
139 | + $det_escola = $obj_escola->detalhe(); | |
140 | + $det_escola = $det_escola['nome']; | |
141 | + $temp['ref_cod_escola'] = $det_escola; | |
142 | + | |
143 | + $this->alocacao_array[] = $temp; | |
144 | + } | |
145 | + } | |
146 | + | |
147 | + if ($registro['cod_servidor']) { | |
148 | + $this->addDetalhe(array('Servidor', $registro['cod_servidor'])); | |
149 | + } | |
150 | + | |
151 | + if ($registro['matricula']) { | |
152 | + $this->addDetalhe(array('Matrícula', $registro['matricula'])); | |
153 | + } | |
154 | + | |
155 | + if ($registro['nome']) { | |
156 | + $this->addDetalhe(array('Nome', $registro['nome'])); | |
157 | + } | |
158 | + | |
159 | + if ($registro['ref_cod_instituicao']) { | |
160 | + $this->addDetalhe( array( "Instituição", $registro['ref_cod_instituicao'])); | |
161 | + } | |
162 | + | |
163 | + if ($registro['ref_cod_deficiencia']) { | |
164 | + $this->addDetalhe(array('Deficiéncia', $registro['ref_cod_deficiencia'])); | |
165 | + } | |
362 | 166 | |
363 | - /** | |
364 | - * @todo O botão [Alocar Servidor] só deverá aparecer para usuários | |
365 | - * poli-institucionais e institucionais apenas quando o servidor | |
366 | - * nâo estiver com todas as horas semanais alocadas. | |
367 | - */ | |
368 | - $get_padrao ="ref_cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$this->ref_cod_instituicao}"; | |
369 | - | |
370 | - $this->array_botao = array(); | |
371 | - $this->array_botao_url_script = array(); | |
167 | + if( $registro['ref_idesco']) { | |
168 | + $this->addDetalhe(array('Escolaridade', $registro['ref_idesco'])); | |
169 | + } | |
372 | 170 | |
373 | - $this->array_botao[] = 'Avaliação de Desempenho'; | |
374 | - $this->array_botao_url_script[] = "go(\"educar_avaliacao_desempenho_lst.php?{$get_padrao}\");"; | |
171 | + if ($registro['ref_cod_subnivel']) { | |
172 | + $obj_nivel = new clsPmieducarSubnivel($registro['ref_cod_subnivel']); | |
173 | + $det_nivel = $obj_nivel->detalhe(); | |
174 | + | |
175 | + $this->addDetalhe(array('Nível', $det_nivel['nm_subnivel'])); | |
176 | + } | |
177 | + | |
178 | + if ($registro['ref_cod_funcao']) { | |
179 | + $this->addDetalhe(array('Função', $registro['ref_cod_funcao'])); | |
180 | + } | |
375 | 181 | |
376 | - $this->array_botao[] = 'Formação'; | |
377 | - $this->array_botao_url_script[] = "go(\"educar_servidor_formacao_lst.php?{$get_padrao}\");"; | |
378 | - | |
379 | - $this->array_botao[] = 'Faltas/Atrasos'; | |
380 | - $this->array_botao_url_script[] = "go(\"educar_falta_atraso_lst.php?{$get_padrao}\");"; | |
381 | - | |
382 | - $this->array_botao[] = 'Alocar Servidor'; | |
383 | - $this->array_botao_url_script[] = "go(\"educar_servidor_alocacao_cad.php?{$get_padrao}\");"; | |
384 | - | |
385 | - $this->array_botao[] = 'Alterar Nível'; | |
386 | - $this->array_botao_url_script[] = "popless();"; | |
387 | - | |
388 | - $obj_servidor_alocacao = new clsPmieducarServidorAlocacao(); | |
389 | - $lista_alocacao = $obj_servidor_alocacao->lista(null,$this->ref_cod_instituicao,null,null,null,$this->cod_servidor,null,null,null,null,null,null,null,null,null,1); | |
390 | - | |
391 | - if($lista) | |
392 | - { | |
393 | - $this->array_botao[] = 'Substituir Horário Servidor'; | |
394 | - $this->array_botao_url_script[] = "go(\"educar_servidor_substituicao_cad.php?{$get_padrao}\");"; | |
395 | - } | |
396 | - | |
397 | - if ( class_exists( "clsPmieducarServidorAfastamento" ) ) { | |
398 | - $obj_afastamento = new clsPmieducarServidorAfastamento(); | |
399 | - $afastamento = $obj_afastamento->afastado( $this->cod_servidor, $this->ref_cod_instituicao ); | |
400 | - | |
401 | - if ( is_numeric( $afastamento ) && $afastamento == 0 ) { | |
402 | - $this->array_botao[] = 'Afastar Servidor'; | |
403 | - $this->array_botao_url_script[] = "go(\"educar_servidor_afastamento_cad.php?{$get_padrao}\");"; | |
404 | - } | |
405 | - elseif ( is_numeric( $afastamento ) ) { | |
406 | - $this->array_botao[] = 'Retornar Servidor'; | |
407 | - $this->array_botao_url_script[] = "go(\"educar_servidor_afastamento_cad.php?{$get_padrao}&sequencial={$afastamento}\");"; | |
408 | - } | |
409 | - } | |
410 | - | |
411 | - // $this->array_botao = array('Avaliação de Desempenho', 'Formação', 'Faltas/Atrasos', 'Alocar Servidor' , 'Substituir', 'Afastar', 'Retornar','substituto'); | |
412 | - | |
413 | - | |
414 | - | |
415 | - //$this->array_botao_url = array("educar_avaliacao_desempenho_lst.php?{$get_padrao}", "educar_servidor_formacao_lst.php?{$get_padrao}", "educar_falta_atraso_lst.php?{$get_padrao}", "educar_servidor_alocacao_cad.php?{$get_padrao}","educar_servidor_substituicao_cad.php?{$get_padrao}", 'Afastar', 'Retornar'); | |
416 | - | |
417 | - } | |
418 | - | |
419 | - $this->url_cancelar = "educar_servidor_lst.php"; | |
420 | - $this->largura = "100%"; | |
421 | - } | |
182 | + $obj_funcao = new clsPmieducarServidorFuncao(); | |
183 | + $lst_funcao = $obj_funcao->lista($this->ref_cod_instituicao, $this->cod_servidor); | |
184 | + | |
185 | + if ($lst_funcao) { | |
186 | + $tabela .= " | |
187 | + <table cellspacing='0' cellpadding='0' border='0'> | |
188 | + <tr bgcolor='#A1B3BD' align='center'> | |
189 | + <td width='150'>Função</td> | |
190 | + </tr>"; | |
191 | + | |
192 | + $class = "formlttd"; | |
193 | + | |
194 | + $tab_disc = NULL; | |
195 | + | |
196 | + $obj_disciplina_servidor = new clsPmieducarServidorDisciplina(); | |
197 | + $lst_disciplina_servidor = $obj_disciplina_servidor->lista(NULL, | |
198 | + $this->ref_cod_instituicao, $this->cod_servidor); | |
199 | + | |
200 | + if ($lst_disciplina_servidor) { | |
201 | + $tab_disc .= "<table cellspacing='0' cellpadding='0' width='200' border='0' style='border:1px dotted #000000'>"; | |
202 | + | |
203 | + $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
204 | + $tab_disc .= " | |
205 | + <tr> | |
206 | + <td bgcolor='#A1B3BD' align='center'>Disciplinas</td> | |
207 | + </tr>"; | |
208 | + | |
209 | + foreach ($lst_disciplina_servidor as $disciplina) { | |
210 | + $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']); | |
211 | + $det_disciplina = $obj_disciplina->detalhe(); | |
212 | + | |
213 | + $tab_disc .= " | |
214 | + <tr class='$class2' align='center'> | |
215 | + <td align='left'>{$det_disciplina['nm_disciplina']}</td> | |
216 | + </tr>"; | |
217 | + | |
218 | + $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
219 | + } | |
220 | + | |
221 | + $tab_disc .= "</table>"; | |
222 | + } | |
223 | + | |
224 | + $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(); | |
225 | + $lst_servidor_curso = $obj_servidor_curso->lista(NULL, | |
226 | + $this->ref_cod_instituicao, $this->cod_servidor); | |
227 | + | |
228 | + if($lst_servidor_curso) { | |
229 | + $tab_curso .= "<table cellspacing='0' cellpadding='0' width='200' border='0' style='border:1px dotted #000000'>"; | |
230 | + | |
231 | + $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
232 | + $tab_curso .= " | |
233 | + <tr> | |
234 | + <td bgcolor='#A1B3BD' align='center'>Cursos Ministrados</td> | |
235 | + </tr>"; | |
236 | + | |
237 | + foreach ($lst_servidor_curso as $curso) { | |
238 | + $obj_curso = new clsPmieducarCurso($curso['ref_cod_curso']); | |
239 | + $det_curso = $obj_curso->detalhe(); | |
240 | + | |
241 | + $tab_curso .= " | |
242 | + <tr class='$class2' align='center'> | |
243 | + <td align='left'>{$det_curso['nm_curso']}</td> | |
244 | + </tr>"; | |
245 | + | |
246 | + $class2 = $class2 == "formlttd" ? "formmdtd" : "formlttd" ; | |
247 | + } | |
248 | + | |
249 | + $tab_curso .= "</table>"; | |
250 | + } | |
251 | + | |
252 | + foreach ($lst_funcao as $funcao) { | |
253 | + | |
254 | + $obj_funcao = new clsPmieducarFuncao($funcao['ref_cod_funcao']); | |
255 | + $det_funcao = $obj_funcao->detalhe(); | |
256 | + | |
257 | + $tabela .= " | |
258 | + <tr class='$class' align='left'> | |
259 | + <td><b>{$det_funcao['nm_funcao']}</b></td> | |
260 | + </tr>"; | |
261 | + | |
262 | + $class = $class == "formlttd" ? "formmdtd" : "formlttd" ; | |
263 | + } | |
264 | + | |
265 | + if ($tab_curso) { | |
266 | + | |
267 | + $tabela .= " | |
268 | + <tr class='$class' align='center'> | |
269 | + <td style='padding:5px'>$tab_curso</td> | |
270 | + </tr>"; | |
271 | + } | |
272 | + | |
273 | + if ($tab_disc) { | |
274 | + | |
275 | + $tabela .= " | |
276 | + <tr class='$class' align='center'> | |
277 | + <td style='padding:5px'>$tab_disc</td> | |
278 | + </tr>"; | |
279 | + } | |
280 | + | |
281 | + $tabela .= "</table>"; | |
282 | + $this->addDetalhe(array('Função', | |
283 | + "<a href='javascript:trocaDisplay(\"det_f\");' >Mostrar detalhe</a><div id='det_f' name='det_f' style='display:none;'>".$tabela."</div>")); | |
284 | + } | |
285 | + | |
286 | + $tabela = NULL; | |
287 | + | |
288 | + /** | |
289 | + * @todo Criar função de transformação de hora decimal. Ver educar_servidor_cad.php em 276 | |
290 | + */ | |
291 | + if ($registro['carga_horaria']) { | |
292 | + $cargaHoraria = $registro['carga_horaria']; | |
293 | + $horas = (int)$cargaHoraria; | |
294 | + $minutos = round(($cargaHoraria - $horas) * 60); | |
295 | + $cargaHoraria = sprintf('%02d:%02d', $horas, $minutos); | |
296 | + $this->addDetalhe(array('Carga Horária', $cargaHoraria)); | |
297 | + } | |
298 | + | |
299 | + $dias_da_semana = array( | |
300 | + '' => 'Selecione', | |
301 | + 1 => 'Domingo', | |
302 | + 2 => 'Segunda', | |
303 | + 3 => 'Terça', | |
304 | + 4 => 'Quarta', | |
305 | + 5 => 'Quinta', | |
306 | + 6 => 'Sexta', | |
307 | + 7 => 'Sábado'); | |
308 | + | |
309 | + if ($this->alocacao_array) { | |
310 | + $tabela .= " | |
311 | + <table cellspacing='0' cellpadding='0' border='0'> | |
312 | + <tr bgcolor='#A1B3BD' align='center'> | |
313 | + <td width='150'>Carga Horaria</td> | |
314 | + <td width='80'>Periodo</td> | |
315 | + <td width='150'>Escola</td> | |
316 | + </tr>"; | |
317 | + | |
318 | + $class = "formlttd"; | |
319 | + foreach ($this->alocacao_array as $alocacao) { | |
320 | + switch ($alocacao['periodo']) { | |
321 | + case 1: | |
322 | + $nm_periodo = "Matutino"; | |
323 | + break; | |
324 | + case 2: | |
325 | + $nm_periodo = "Vespertino"; | |
326 | + break; | |
327 | + case 3: | |
328 | + $nm_periodo = "Noturno"; | |
329 | + break; | |
330 | + } | |
331 | + | |
332 | + $tabela .= " | |
333 | + <tr class='$class' align='center'> | |
334 | + <td>{$alocacao['carga_horaria']}</td> | |
335 | + <td>{$nm_periodo}</td> | |
336 | + <td>{$alocacao['ref_cod_escola']}</td> | |
337 | + </tr>"; | |
338 | + | |
339 | + $class = $class == 'formlttd' ? 'formmdtd' : 'formlttd'; | |
340 | + } | |
341 | + | |
342 | + $tabela .= "</table>"; | |
343 | + | |
344 | + $this->addDetalhe(array('Horários de trabalho', | |
345 | + "<a href='javascript:trocaDisplay(\"det_pree\");' >Mostrar detalhe</a><div id='det_pree' name='det_pree' style='display:none;'>".$tabela."</div>")); | |
346 | + } | |
347 | + | |
348 | + $obj_permissoes = new clsPermissoes(); | |
349 | + | |
350 | + if ($obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 3)) { | |
351 | + $this->url_novo = 'educar_servidor_cad.php'; | |
352 | + $this->url_editar = "educar_servidor_cad.php?cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$this->ref_cod_instituicao}"; | |
353 | + | |
354 | + | |
355 | + $get_padrao ="ref_cod_servidor={$registro["cod_servidor"]}&ref_cod_instituicao={$this->ref_cod_instituicao}"; | |
356 | + | |
357 | + $this->array_botao = array(); | |
358 | + $this->array_botao_url_script = array(); | |
359 | + | |
360 | + $this->array_botao[] = 'Avaliação de Desempenho'; | |
361 | + $this->array_botao_url_script[] = "go(\"educar_avaliacao_desempenho_lst.php?{$get_padrao}\");"; | |
362 | + | |
363 | + $this->array_botao[] = 'Formação'; | |
364 | + $this->array_botao_url_script[] = "go(\"educar_servidor_formacao_lst.php?{$get_padrao}\");"; | |
365 | + | |
366 | + $this->array_botao[] = 'Faltas/Atrasos'; | |
367 | + $this->array_botao_url_script[] = "go(\"educar_falta_atraso_lst.php?{$get_padrao}\");"; | |
368 | + | |
369 | + $this->array_botao[] = 'Alocar Servidor'; | |
370 | + $this->array_botao_url_script[] = "go(\"educar_servidor_alocacao_cad.php?{$get_padrao}\");"; | |
371 | + | |
372 | + $this->array_botao[] = 'Alterar Nível'; | |
373 | + $this->array_botao_url_script[] = "popless();"; | |
374 | + | |
375 | + $obj_servidor_alocacao = new clsPmieducarServidorAlocacao(); | |
376 | + $lista_alocacao = $obj_servidor_alocacao->lista(NULL, | |
377 | + $this->ref_cod_instituicao, NULL, NULL, NULL, $this->cod_servidor, NULL, | |
378 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); | |
379 | + | |
380 | + if ($lista) { | |
381 | + $this->array_botao[] = 'Substituir Horário Servidor'; | |
382 | + $this->array_botao_url_script[] = "go(\"educar_servidor_substituicao_cad.php?{$get_padrao}\");"; | |
383 | + } | |
384 | + | |
385 | + $obj_afastamento = new clsPmieducarServidorAfastamento(); | |
386 | + $afastamento = $obj_afastamento->afastado( $this->cod_servidor, $this->ref_cod_instituicao ); | |
387 | + | |
388 | + if (is_numeric($afastamento) && $afastamento == 0) { | |
389 | + $this->array_botao[] = 'Afastar Servidor'; | |
390 | + $this->array_botao_url_script[] = "go(\"educar_servidor_afastamento_cad.php?{$get_padrao}\");"; | |
391 | + } | |
392 | + elseif (is_numeric($afastamento)) { | |
393 | + $this->array_botao[] = 'Retornar Servidor'; | |
394 | + $this->array_botao_url_script[] = "go(\"educar_servidor_afastamento_cad.php?{$get_padrao}&sequencial={$afastamento}\");"; | |
395 | + } | |
396 | + } | |
397 | + | |
398 | + $this->url_cancelar = 'educar_servidor_lst.php'; | |
399 | + $this->largura = '100%'; | |
400 | + } | |
422 | 401 | } |
423 | 402 | |
424 | -// cria uma extensao da classe base | |
403 | +// Instancia o objeto da página | |
425 | 404 | $pagina = new clsIndexBase(); |
426 | -// cria o conteudo | |
405 | + | |
406 | +// Instancia o objeto de conteúdo | |
427 | 407 | $miolo = new indice(); |
428 | -// adiciona o conteudo na clsBase | |
429 | -$pagina->addForm( $miolo ); | |
430 | -// gera o html | |
408 | + | |
409 | +// Passa o conteúdo para a página | |
410 | +$pagina->addForm($miolo); | |
411 | + | |
412 | +// Gera o HTML | |
431 | 413 | $pagina->MakeAll(); |
432 | 414 | ?> |
433 | -<script> | |
434 | 415 | |
435 | -function trocaDisplay(id) | |
436 | -{ | |
437 | - var element = document.getElementById(id); | |
438 | - element.style.display = (element.style.display == "none") ? "inline" : "none"; | |
416 | +<script type="text/javascript"> | |
417 | +function trocaDisplay(id) { | |
418 | + var element = document.getElementById(id); | |
419 | + element.style.display = (element.style.display == "none") ? "inline" : "none"; | |
439 | 420 | } |
440 | 421 | |
441 | -function popless() | |
442 | -{ | |
443 | - var campoServidor = <?=$_GET["cod_servidor"];?>; | |
444 | - var campoInstituicao = <?=$_GET["ref_cod_instituicao"];?>; | |
445 | - pesquisa_valores_popless('educar_servidor_nivel_cad.php?ref_cod_servidor='+campoServidor+'&ref_cod_instituicao='+campoInstituicao, ''); | |
422 | +function popless() { | |
423 | + var campoServidor = <?=$_GET["cod_servidor"];?>; | |
424 | + var campoInstituicao = <?=$_GET["ref_cod_instituicao"];?>; | |
425 | + pesquisa_valores_popless('educar_servidor_nivel_cad.php?ref_cod_servidor='+campoServidor+'&ref_cod_instituicao='+campoInstituicao, ''); | |
446 | 426 | } |
447 | - | |
448 | - | |
449 | 427 | </script> |
450 | 428 | \ No newline at end of file | ... | ... |
ieducar/intranet/educar_servidor_substituicao_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" ); | |
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 | + | |
24 | +/** | |
25 | + * Formulário de substituição de servidor | |
26 | + * | |
27 | + * Interface administrativa para a substituição de horário de um servidor por | |
28 | + * outro. As classes deste arquivo extendem as classes básicas de interface | |
29 | + * com o usuário. | |
30 | + * | |
31 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
32 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
33 | + * @package Core | |
34 | + * @subpackage Servidor | |
35 | + * @since Disponível desde a versão 1.0.0 | |
36 | + * @version $Id$ | |
37 | + */ | |
38 | + | |
39 | +require_once 'include/clsBase.inc.php'; | |
40 | +require_once 'include/clsCadastro.inc.php'; | |
41 | +require_once 'include/clsBanco.inc.php'; | |
42 | +require_once 'include/pmieducar/geral.inc.php'; | |
31 | 43 | |
32 | 44 | class clsIndexBase extends clsBase |
33 | 45 | { |
... | ... | @@ -66,283 +78,163 @@ class indice extends clsCadastro |
66 | 78 | var $professor; |
67 | 79 | //var $dias_da_semana = array( '' => 'Selecione', 1 => 'Domingo', 2 => 'Segunda', 3 => 'Terça', 4 => 'Quarta', 5 => 'Quinta', 6 => 'Sexta', 7 => 'Sábado' ); |
68 | 80 | |
69 | - function Inicializar() | |
70 | - { | |
71 | - $retorno = "Novo"; | |
72 | - @session_start(); | |
73 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
74 | - @session_write_close(); | |
75 | - | |
76 | - $this->ref_cod_servidor = $_GET["ref_cod_servidor"]; | |
77 | - $this->ref_ref_cod_instituicao = $_GET["ref_cod_instituicao"]; | |
78 | - | |
79 | - $obj_permissoes = new clsPermissoes(); | |
80 | - $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 3, "educar_servidor_lst.php" ); | |
81 | + public function Inicializar() { | |
82 | + $retorno = 'Novo'; | |
83 | + session_start(); | |
84 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
85 | + session_write_close(); | |
81 | 86 | |
82 | - if( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->ref_ref_cod_instituicao ) ) | |
83 | - { | |
87 | + $this->ref_cod_servidor = $_GET['ref_cod_servidor']; | |
88 | + $this->ref_ref_cod_instituicao = $_GET['ref_cod_instituicao']; | |
84 | 89 | |
90 | + $obj_permissoes = new clsPermissoes(); | |
91 | + $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 3, 'educar_servidor_lst.php'); | |
85 | 92 | |
86 | - $retorno = "Novo"; | |
93 | + if (is_numeric($this->ref_cod_servidor) && is_numeric($this->ref_ref_cod_instituicao)) { | |
94 | + $retorno = 'Novo'; | |
87 | 95 | |
88 | - $obj_servidor = new clsPmieducarServidor($this->ref_cod_servidor,null,null,null,null,null,null,$this->ref_ref_cod_instituicao); | |
89 | - $det_servidor = $obj_servidor->detalhe(); | |
90 | - if(!$det_servidor) | |
91 | - { | |
92 | - header("location: educar_servidor_lst.php"); | |
93 | - die; | |
94 | - } | |
95 | - $obj_funcao = new clsPmieducarFuncao($det_servidor['ref_cod_funcao'],null,null,null,null,null,null,null,1,$this->ref_ref_cod_instituicao); | |
96 | - $det_funcao = $obj_funcao->detalhe(); | |
97 | - $this->professor = $det_funcao['professor'] == 1 ? "true" : "false"; | |
96 | + $obj_servidor = new clsPmieducarServidor($this->ref_cod_servidor, | |
97 | + NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_ref_cod_instituicao); | |
98 | + $det_servidor = $obj_servidor->detalhe(); | |
98 | 99 | |
99 | - $obj = new clsPmieducarServidorAlocacao( ); | |
100 | - $lista = $obj->lista(null,$this->ref_ref_cod_instituicao,null,null,null,$this->ref_cod_servidor,null,null,null,null,null,null,null,null,null,1); | |
101 | - if( $lista ) | |
102 | - { | |
103 | - foreach( $lista AS $campo => $val ){ // passa todos os valores obtidos no registro para atributos do objeto | |
104 | - $temp = array(); | |
105 | - $temp['carga_horaria'] = $val['carga_horaria']; | |
106 | - $temp['periodo'] = $val['periodo']; | |
107 | - //$temp['hora_final'] = $val['hora_final']; | |
108 | - //$temp['dia_semana'] = $val['dia_semana']; | |
109 | - $temp['ref_cod_escola'] = $val['ref_cod_escola']; | |
100 | + // Nenhum servidor com o código de servidor e instituição | |
101 | + if (!$det_servidor) { | |
102 | + header('Location: educar_servidor_lst.php'); | |
103 | + die; | |
104 | + } | |
110 | 105 | |
111 | - $this->alocacao_array[] = $temp; | |
106 | + $this->professor = $obj_servidor->isProfessor() == TRUE ? 'true' : 'false'; | |
112 | 107 | |
113 | - } | |
108 | + $obj = new clsPmieducarServidorAlocacao(); | |
109 | + $lista = $obj->lista(NULL, $this->ref_ref_cod_instituicao, NULL, | |
110 | + NULL, NULL, $this->ref_cod_servidor, NULL, NULL, NULL, NULL, NULL, | |
111 | + NULL, NULL, NULL, NULL, 1); | |
114 | 112 | |
115 | - /*$obj_permissoes = new clsPermissoes(); | |
116 | - if( $obj_permissoes->permissao_excluir( 635, $this->pessoa_logada, 3 ) ) | |
117 | - { | |
118 | - $this->fexcluir = true; | |
119 | - }*/ | |
113 | + if ($lista) { | |
114 | + // passa todos os valores obtidos no registro para atributos do objeto | |
115 | + foreach ($lista as $campo => $val){ | |
116 | + $temp = array(); | |
117 | + $temp['carga_horaria'] = $val['carga_horaria']; | |
118 | + $temp['periodo'] = $val['periodo']; | |
119 | + $temp['ref_cod_escola'] = $val['ref_cod_escola']; | |
120 | 120 | |
121 | - $retorno = "Novo"; | |
122 | - } | |
121 | + $this->alocacao_array[] = $temp; | |
122 | + } | |
123 | + | |
124 | + $retorno = "Novo"; | |
125 | + } | |
126 | + | |
127 | + $this->carga_horaria = $det_servidor['carga_horaria']; | |
128 | + } | |
129 | + else { | |
130 | + header('Location: educar_servidor_lst.php'); | |
131 | + die; | |
132 | + } | |
133 | + | |
134 | + $this->url_cancelar = "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_ref_cod_instituicao}"; | |
135 | + $this->nome_url_cancelar = "Cancelar"; | |
136 | + | |
137 | + return $retorno; | |
138 | + } | |
123 | 139 | |
124 | 140 | |
125 | - $this->carga_horaria = $det_servidor['carga_horaria']; | |
126 | - } | |
127 | - else{ | |
128 | - header("location: educar_servidor_lst.php"); | |
129 | - die; | |
130 | - } | |
131 | - $this->url_cancelar = "educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_ref_cod_instituicao}"; | |
132 | - $this->nome_url_cancelar = "Cancelar"; | |
133 | - return $retorno; | |
134 | - } | |
135 | 141 | |
136 | - function Gerar() | |
137 | - { | |
142 | + public function Gerar() { | |
143 | + $obj_inst = new clsPmieducarInstituicao($this->ref_ref_cod_instituicao); | |
144 | + $inst_det = $obj_inst->detalhe(); | |
138 | 145 | |
139 | - $obj_inst = new clsPmieducarInstituicao($this->ref_ref_cod_instituicao); | |
140 | - $inst_det = $obj_inst->detalhe(); | |
146 | + $this->campoRotulo("nm_instituicao", "Instituição", $inst_det['nm_instituicao']); | |
147 | + $this->campoOculto("ref_ref_cod_instituicao", $this->ref_ref_cod_instituicao); | |
141 | 148 | |
142 | - $this->campoRotulo("nm_instituicao","Instituição",$inst_det['nm_instituicao']); | |
143 | - $this->campoOculto("ref_ref_cod_instituicao",$this->ref_ref_cod_instituicao); | |
149 | + $opcoes = array("" => "Selecione"); | |
150 | + if (class_exists("clsPmieducarServidor")) { | |
151 | + $objTemp = new clsPmieducarServidor($this->ref_cod_servidor); | |
152 | + $det = $objTemp->detalhe(); | |
153 | + if ($det) { | |
154 | + foreach ($det as $key => $registro) { | |
155 | + $this->$key = $registro; | |
156 | + } | |
157 | + } | |
144 | 158 | |
159 | + if ($this->ref_cod_servidor) { | |
160 | + $objTemp = new clsFuncionario($this->ref_cod_servidor); | |
161 | + $detalhe = $objTemp->detalhe(); | |
162 | + $detalhe = $detalhe['idpes']->detalhe(); | |
163 | + $nm_servidor = $detalhe['nome']; | |
164 | + } | |
165 | + } | |
145 | 166 | |
146 | - //$this->campoRotulo("nm_escola","Escola",$nm_escola); | |
167 | + $this->campoRotulo("nm_servidor", "Servidor", $nm_servidor); | |
147 | 168 | |
148 | - $opcoes = array( "" => "Selecione" ); | |
149 | - if( class_exists( "clsPmieducarServidor" ) ) | |
150 | - { | |
151 | - $objTemp = new clsPmieducarServidor($this->ref_cod_servidor); | |
152 | - $det = $objTemp->detalhe(); | |
153 | - if ($det ) | |
154 | - { | |
155 | - foreach ( $det as $key => $registro ) | |
156 | - { | |
157 | - $this->$key = $registro; | |
158 | - } | |
159 | - } | |
160 | - | |
161 | - if( $this->ref_cod_servidor ) | |
162 | - { | |
163 | - $objTemp = new clsFuncionario( $this->ref_cod_servidor ); | |
164 | - $detalhe = $objTemp->detalhe(); | |
165 | - $detalhe = $detalhe["idpes"]->detalhe(); | |
166 | - $nm_servidor = $detalhe["nome"]; | |
167 | - } | |
168 | - } | |
169 | - else | |
170 | - { | |
171 | - echo "<!--\nErro\nClasse clsPmieducarServidor nao encontrada\n-->"; | |
172 | - $opcoes = array( "" => "Erro na geracao" ); | |
173 | - } | |
169 | + $this->campoOculto("ref_cod_servidor", $this->ref_cod_servidor); | |
170 | + $this->campoOculto("professor",$this->professor); | |
174 | 171 | |
175 | - $this->campoRotulo( "nm_servidor", "Servidor", $nm_servidor); | |
172 | + $this->campoTextoInv("ref_cod_servidor_todos_", "Substituir por:", "", | |
173 | + 30, 255, TRUE, FALSE, FALSE, "", "<img border='0' onclick=\"pesquisa_valores_popless('educar_pesquisa_servidor_lst.php?campo1=ref_cod_servidor_todos&campo2=ref_cod_servidor_todos_&ref_cod_instituicao={$this->ref_ref_cod_instituicao}&ref_cod_servidor={$this->ref_cod_servidor}&tipo=livre&professor={$this->professor}', 'nome')\" src=\"imagens/lupa.png\">","","","" ); | |
174 | + $this->campoOculto("ref_cod_servidor_todos", ""); | |
176 | 175 | |
177 | - $this->campoOculto( "ref_cod_servidor", $this->ref_cod_servidor); | |
178 | - $this->campoOculto("professor",$this->professor); | |
179 | - // $this->campoRotulo("substituir_todos","substituir todos","<a href=\"javascript:trocaDisplay('tr_ref_cod_servidor_todos_');\"><img src='imagens/i-educar/bot_subt_todos.gif' id='trocar' border='0'></a>"); | |
180 | - $this->campoTextoInv( "ref_cod_servidor_todos_", "Substituir por:", "", 30, 255, true, false, false, "", "<img border='0' onclick=\"pesquisa_valores_popless('educar_pesquisa_servidor_lst.php?campo1=ref_cod_servidor_todos&campo2=ref_cod_servidor_todos_&ref_cod_instituicao={$this->ref_ref_cod_instituicao}&ref_cod_servidor={$this->ref_cod_servidor}&tipo=livre&professor={$this->professor}', 'nome')\" src=\"imagens/lupa.png\">","","","" ); | |
181 | - $this->campoOculto("ref_cod_servidor_todos", ""); | |
176 | + $this->campoOculto("alocacao_array", serialize($this->alocacao_array)); | |
177 | + $this->acao_enviar = 'acao2()'; | |
178 | + } | |
182 | 179 | |
183 | - //$this->campoOculto( "todos","false"); | |
184 | 180 | |
185 | 181 | |
186 | - $this->campoOculto( "alocacao_array", serialize( $this->alocacao_array ) ); | |
187 | - //array_multisort($this->alocacao_array); | |
182 | + public function Novo() { | |
183 | + session_start(); | |
184 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
185 | + session_write_close(); | |
186 | + | |
187 | + $professor = isset($_POST['professor']) ? strtolower($_POST['professor']) : 'FALSE'; | |
188 | + $substituto = isset($_POST['ref_cod_servidor_todos']) ? $_POST['ref_cod_servidor_todos'] : NULL; | |
188 | 189 | |
190 | + $permissoes = new clsPermissoes(); | |
191 | + $permissoes->permissao_cadastra(635, $this->pessoa_logada, 3, 'educar_servidor_alocacao_lst.php'); | |
189 | 192 | |
193 | + $this->alocacao_array = array(); | |
194 | + if ($_POST['alocacao_array']) { | |
195 | + $this->alocacao_array = unserialize(urldecode($_POST['alocacao_array'])); | |
196 | + } | |
197 | + | |
198 | + if ($this->alocacao_array) { | |
199 | + // Substitui todas as alocações | |
200 | + foreach ($this->alocacao_array as $key => $alocacao) { | |
201 | + $obj = new clsPmieducarServidorAlocacao(NULL, $this->ref_ref_cod_instituicao, | |
202 | + $this->pessoa_logada, $this->pessoa_logada, $alocacao['ref_cod_escola'], | |
203 | + $this->ref_cod_servidor, NULL, NULL, NULL, $alocacao['carga_horaria'], | |
204 | + $alocacao['periodo']); | |
190 | 205 | |
191 | - /* if ( $this->alocacao_array ) | |
192 | - { | |
193 | - $excluir_ok = false; | |
194 | - if($_POST['excluir_dia_semana'] || $_POST['excluir_dia_semana'] == "0") | |
195 | - $excluir_ok = true; | |
196 | - $tamanho = sizeof($alocacao); | |
197 | - $script = "<script>\nvar num_alocacao = {$tamanho};\n"; | |
198 | - $script .= "var array_servidores = Array();\n"; | |
199 | - foreach ( $this->alocacao_array as $key => $alocacao) | |
200 | - { | |
201 | - | |
202 | - $script .= "array_servidores[{$key}] = new Array();\n"; | |
203 | - | |
204 | - $hora_ini = explode(":",$alocacao['hora_inicial']); | |
205 | - $hora_fim = explode(":",$alocacao['hora_final']); | |
206 | - | |
207 | - $horas_utilizadas = ( $hora_fim[0] - $hora_ini[0] ); | |
208 | - $minutos_utilizados = ( $hora_fim[1] - $hora_ini[1] ); | |
209 | - $horas = sprintf("%02d",(int)$horas_utilizadas); | |
210 | - $minutos = sprintf("%02d",(int)$minutos_utilizados); | |
211 | - $str_horas_utilizadas = "{$horas}:{$minutos}"; | |
212 | - $script .= "array_servidores[{$key}][0] = '{$str_horas_utilizadas}'; \n"; | |
213 | - $script .= "array_servidores[{$key}][1] = ''; \n\n"; | |
214 | - | |
215 | - | |
216 | - $obj_escola = new clsPmieducarEscola($alocacao['ref_cod_escola']); | |
217 | - $det_escola = $obj_escola->detalhe(); | |
218 | - $det_escola = $det_escola["nome"]; | |
219 | - $nm_dia_semana = $this->dias_da_semana[$alocacao["dia_semana"]]; | |
220 | - | |
221 | - $this->campoTextoInv( "dia_semana_{$key}", "", $nm_dia_semana, 8, 8, false, false, true,"","","","","dia_semana" ); | |
222 | - $this->campoTextoInv( "hora_inicial_{$key}", "", $alocacao['hora_inicial'], 5, 5, false, false, true, "","","","","ds_hora_inicial_" ); | |
223 | - $this->campoTextoInv( "hora_final_{$key}", "", $alocacao['hora_final'], 5, 5, false, false, true, "", "","","","ds_hora_final_" ); | |
224 | - $this->campoTextoInv( "ref_cod_escola_{$key}", "", $det_escola, 30, 255, false, false, true, "", "","","","ref_cod_escola_" ); | |
225 | - $this->campoOculto( "ref_cod_servidor_substituto_{$key}",""); | |
226 | - $this->campoTextoInv( "ref_cod_servidor_substituto_{$key}_", "", $ref_cod_servidor_substituto, 30, 255, false, false, false, "", "<span name=\"ref_cod_servidor_substituto\" id=\"ref_cod_servidor_substituicao_{$key}\"><img border='0' onclick=\"pesquisa_valores_popless('educar_pesquisa_servidor_lst.php?campo1=ref_cod_servidor_substituto_{$key}&campo2=ref_cod_servidor_substituto_{$key}_&ref_cod_instituicao={$this->ref_ref_cod_instituicao}&dia_semana={$alocacao["dia_semana"]}&hora_inicial={$alocacao["hora_inicial"]}&hora_final={$alocacao["hora_final"]}&ref_cod_servidor={$this->ref_cod_servidor}', 'nome')\" src=\"imagens/lupa.png\" ></span>","","","ref_cod_servidor_substituto" ); | |
227 | - | |
228 | - } | |
229 | - | |
230 | -*/ | |
231 | -/* $db = new clsBanco(); | |
232 | - $consulta = "SELECT ref_cod_servidor | |
233 | - ,ref_ref_cod_instituicao | |
234 | - ,sum(hora_final - hora_inicial ) as horas | |
235 | - FROM pmieducar.servidor_alocacao | |
236 | - WHERE ativo = 1 | |
237 | - GROUP BY ref_cod_servidor,ref_ref_cod_instituicao"; | |
238 | - $registros = $db->Consulta($consulta); | |
239 | - if($registros) | |
240 | - { | |
241 | - $ct = 0; | |
242 | - $script .="array_horas_utilizadas_servidor = new Array();\n"; | |
243 | - | |
244 | - while($db->ProximoRegistro()){ | |
245 | - $registro = $db->Tupla(); | |
246 | - $script .= "array_horas_utilizadas_servidor['{$registro['ref_cod_servidor']}_'] = new Array('{$registro['horas']}'); \n"; | |
247 | - $ct++; | |
248 | - } | |
249 | - } | |
250 | - | |
251 | - $consulta = "SELECT DISTINCT cod_servidor | |
252 | - ,ref_cod_instituicao | |
253 | - ,coalesce(carga_horaria , '0') as carga_horaria | |
254 | - FROM pmieducar.servidor s | |
255 | - ,pmieducar.servidor_alocacao a | |
256 | - WHERE s.ativo = 1 | |
257 | - AND a.ativo = 1 | |
258 | - AND s.ref_cod_instituicao = a.ref_ref_cod_instituicao"; | |
259 | - $registros = $db->Consulta($consulta); | |
260 | - if($registros) | |
261 | - { | |
262 | - $ct = 0; | |
263 | - $script .="array_horas_servidor = new Array();\n"; | |
264 | - | |
265 | - while($db->ProximoRegistro()){ | |
266 | - $registro = $db->Tupla(); | |
267 | - $carga_horaria = $registro['carga_horaria']; | |
268 | - $total_horas = sprintf("%02d",(int)floor($carga_horaria)); | |
269 | - $total_minutos = sprintf("%02d",(int)(floatval($carga_horaria) - floatval($total_horas)) * 60); | |
270 | - $carga_horaria = "{$total_horas}:{$total_minutos}";//date("H:i",mktime($total_horas, $total_minutos, 0, 1, 1, 1970)); | |
271 | - $script .= "array_horas_servidor['{$registro['cod_servidor']}_'] = new Array('{$carga_horaria}'); \n"; | |
272 | - $ct++; | |
273 | - } | |
274 | - } | |
275 | - | |
276 | - $script .= "\n</script>"; | |
277 | - echo $script; | |
278 | - }*/ | |
279 | - $this->acao_enviar = 'acao2()'; | |
206 | + $return = $obj->lista(NULL, $this->ref_ref_cod_instituicao, NULL, NULL, | |
207 | + $alocacao['ref_cod_escola'], $this->ref_cod_servidor, NULL, NULL, NULL, | |
208 | + NULL, 1, $alocacao['carga_horaria']); | |
209 | + | |
210 | + if (FALSE !== $return) { | |
211 | + $substituiu = $obj->substituir_servidor($substituto); | |
212 | + if (!$substituiu) { | |
213 | + $this->mensagem = "Substituicao não realizado.<br>"; | |
214 | + | |
215 | + return FALSE; | |
216 | + } | |
217 | + } | |
218 | + } | |
280 | 219 | |
281 | - } | |
220 | + // Substituição do servidor no quadro de horários (caso seja professor) | |
221 | + if('true' == $professor) { | |
222 | + $quadroHorarios = new clsPmieducarQuadroHorarioHorarios(NULL, NULL, NULL, | |
223 | + NULL, NULL, NULL, $this->ref_ref_cod_instituicao, NULL, $this->ref_cod_servidor, | |
224 | + NULL, NULL, NULL, NULL, 1, NULL, NULL); | |
225 | + $quadroHorarios->substituir_servidor($substituto); | |
226 | + } | |
227 | + } | |
282 | 228 | |
283 | - function Novo() | |
284 | - { | |
285 | - @session_start(); | |
286 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
287 | - @session_write_close(); | |
229 | + $this->mensagem .= 'Cadastro efetuado com sucesso.<br>'; | |
230 | + $destination = 'educar_servidor_det.php?cod_servidor=%s&ref_cod_instituicao=%s'; | |
231 | + $destination = sprintf($destination, $this->ref_cod_servidor, $this->ref_ref_cod_instituicao); | |
288 | 232 | |
289 | - $obj_permissoes = new clsPermissoes(); | |
290 | - $obj_permissoes->permissao_cadastra( 635, $this->pessoa_logada, 3, "educar_servidor_alocacao_lst.php" ); | |
233 | + header('Location: ' . $destination); | |
234 | + die(); | |
235 | + } | |
291 | 236 | |
292 | - if ( $_POST["alocacao_array"] ) | |
293 | - $this->alocacao_array = unserialize( urldecode( $_POST["alocacao_array"] ) ); | |
294 | - | |
295 | - if($this->alocacao_array){ | |
296 | - | |
297 | - $substituto = $_POST['ref_cod_servidor_todos']; | |
298 | - | |
299 | - foreach ($this->alocacao_array as $key => $alocacao) | |
300 | - { | |
301 | - //echo $_POST['todos'] == false ; | |
302 | - | |
303 | - //if($substituto){ | |
304 | - | |
305 | - | |
306 | - $obj = new clsPmieducarServidorAlocacao(null,$this->ref_ref_cod_instituicao,$this->pessoa_logada,$this->pessoa_logada,$alocacao['ref_cod_escola'],$this->ref_cod_servidor,null,null,null,$alocacao['carga_horaria'],$alocacao['periodo'] ); | |
307 | - | |
308 | -// if($obj->lista(null, $this->ref_ref_cod_instituicao, $this->pessoa_logada, $this->pessoa_logada, $alocacao['ref_cod_escola'], $this->ref_cod_servidor, $alocacao['dia_semana'], $alocacao['hora_inicial'], $alocacao['hora_final'], $this->data_cadastro, $this->data_exclusao, $this->ativo)){ | |
309 | - if($obj->lista(null, $this->ref_ref_cod_instituicao, null,null, $alocacao['ref_cod_escola'], $this->ref_cod_servidor, null,null,null,null,1,$alocacao['carga_horaria'])){ | |
310 | - //$obj->edita(); | |
311 | - | |
312 | - //return true; | |
313 | - $substituiu = $obj->substituir_servidor($substituto); | |
314 | - if( !$substituiu ) | |
315 | - { | |
316 | - $this->mensagem = "Substituicao não realizado.<br>"; | |
317 | - echo "<!--\nErro ao substituir servidor ref_cod_servidor($this->ref_cod_servidor) ref_cod_servidor_substituto_({$_POST["ref_cod_servidor_substituto_$key"]})\n-->"; | |
318 | - return false; | |
319 | - | |
320 | - } | |
321 | - } | |
322 | - /*$obj_serv = new clsPmieducarServidor($this->ref_cod_servidor,null,null,null,null,null,null,1,$this->ref_ref_cod_instituicao); | |
323 | - $det_serv = $obj_serv->detalhe(); | |
324 | - if($det_serv['ref_cod_funcao']) | |
325 | - { | |
326 | - $obj_funcao = new clsPmieducarFuncao($det_serv['ref_cod_funcao'],null,null,null,null,null,null,null,1,$this->ref_ref_cod_instituicao); | |
327 | - $det_funcao = $obj_funcao->detalhe(); | |
328 | - //if($det_funca) | |
329 | - }*/ | |
330 | - //} | |
331 | - } | |
332 | - /** | |
333 | - * SUBSTITUICAO NO QUADRO DE HORARIO PARA SERVIDORES QUE SAO PROFESSORES | |
334 | - */ | |
335 | - if($this->professor == "true"){ | |
336 | - $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(null,null,null,null,null,null,$this->ref_ref_cod_instituicao,null,$this->ref_cod_servidor,null,null,null,null,1,null,null); | |
337 | - $obj_quadro_horario->substituir_servidor($substituto); | |
338 | - } | |
339 | - } | |
340 | 237 | |
341 | - $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | |
342 | - header( "Location: educar_servidor_det.php?cod_servidor={$this->ref_cod_servidor}&ref_cod_instituicao={$this->ref_ref_cod_instituicao} "); | |
343 | - die(); | |
344 | - return true; | |
345 | - } | |
346 | 238 | |
347 | 239 | function Editar() |
348 | 240 | { | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarQuadroHorarioHorarios.inc.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 | -/** | |
28 | -* @author Prefeitura Municipal de Itajaí | |
29 | -* | |
30 | -* Criado em 10/08/2006 11:25 pelo gerador automatico de classes | |
31 | -*/ | |
32 | 2 | |
33 | -require_once( "include/pmieducar/geral.inc.php" ); | |
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 | + | |
24 | +/** | |
25 | + * clsPmieducarQuadroHorarioHorarios class | |
26 | + * | |
27 | + * Implementa o mapeamento com a tabela pmieducar.quadro_horario_horarios | |
28 | + * | |
29 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
30 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
31 | + * @package Core | |
32 | + * @subpackage Servidor | |
33 | + * @since Classe disponível desde a versão 1.0.0 | |
34 | + * @version $Id$ | |
35 | + */ | |
36 | + | |
37 | +require_once 'include/pmieducar/geral.inc.php'; | |
34 | 38 | |
35 | 39 | class clsPmieducarQuadroHorarioHorarios |
36 | 40 | { |
... | ... | @@ -640,7 +644,7 @@ class clsPmieducarQuadroHorarioHorarios |
640 | 644 | $sql .= $filtros . $this->getOrderby() . $this->getLimite(); |
641 | 645 | |
642 | 646 | $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} qhh {$filtros}" ); |
643 | - | |
647 | + | |
644 | 648 | $db->Consulta( $sql ); |
645 | 649 | |
646 | 650 | if( $countCampos > 1 ) |
... | ... | @@ -813,58 +817,50 @@ class clsPmieducarQuadroHorarioHorarios |
813 | 817 | return ""; |
814 | 818 | } |
815 | 819 | |
816 | - /** | |
817 | - * Realiza a substituicao de um servidor | |
818 | - * | |
819 | - * @return bool | |
820 | - */ | |
821 | - function substituir_servidor($int_ref_cod_servidor_substituto) | |
822 | - { | |
823 | - if( is_numeric( $int_ref_cod_servidor_substituto ) && is_numeric( $this->ref_cod_instituicao_servidor ) ) | |
824 | - { | |
825 | - if( class_exists( "clsPmieducarServidor" ) ) | |
826 | - { | |
827 | - $tmp_obj = new clsPmieducarServidor( $int_ref_cod_servidor_substituto,null,null,null,null,null,null,null, $this->ref_cod_instituicao_servidor ); | |
828 | - if( method_exists( $tmp_obj, "existe") ) | |
829 | - { | |
830 | - if( !$tmp_obj->existe() ) | |
831 | - { | |
832 | - return false; | |
833 | - } | |
834 | - } | |
835 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
836 | - { | |
837 | - if( !$tmp_obj->detalhe() ) | |
838 | - { | |
839 | - return false; | |
840 | - } | |
841 | - } | |
842 | - } | |
843 | - else | |
844 | - { | |
845 | - if( !$db->CampoUnico( "SELECT 1 FROM pmieducar.servidor WHERE cod_servidor = '{$int_ref_cod_servidor_substituto}' AND ref_cod_instituicao = '{$ref_ref_cod_instituicao}'" ) ) | |
846 | - { | |
847 | - return false; | |
848 | - } | |
849 | - } | |
850 | - } | |
851 | 820 | |
852 | 821 | |
853 | - if( is_numeric( $this->ref_servidor ) && is_numeric( $this->ref_cod_instituicao_servidor ) ) | |
854 | - { | |
822 | + /** | |
823 | + * Substitui a alocação entre servidores no quadro de horários | |
824 | + * | |
825 | + * Substitui a alocação entre servidores, atualizando a tabela | |
826 | + * pmieducar.servidor_quadro_horario_horarios. O servidor nesse caso é | |
827 | + * de alguma função do tipo professor. Esse método não valida esse dado, | |
828 | + * sendo de responsabilidade do código cliente | |
829 | + * | |
830 | + * @param int $int_ref_cod_servidor_substituto Código do servidor que substituirá o atual | |
831 | + * @return bool TRUE em caso de sucesso, FALSE caso contrário | |
832 | + */ | |
833 | + public function substituir_servidor($int_ref_cod_servidor_substituto) { | |
834 | + if (is_numeric($int_ref_cod_servidor_substituto) && | |
835 | + is_numeric( $this->ref_cod_instituicao_servidor)) { | |
855 | 836 | |
837 | + $servidor = new clsPmieducarServidor($int_ref_cod_servidor_substituto, | |
838 | + NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao_servidor); | |
856 | 839 | |
857 | - //delete | |
858 | - $db = new clsBanco(); | |
859 | - $db->Consulta( "UPDATE {$this->_tabela} SET ref_servidor='$int_ref_cod_servidor_substituto' , data_exclusao = NOW() WHERE ref_servidor = '{$this->ref_servidor}' AND ref_cod_instituicao_servidor = '{$this->ref_cod_instituicao_servidor}' " ); | |
860 | - return true; | |
840 | + if (!$servidor->existe()) { | |
841 | + return FALSE; | |
842 | + } | |
843 | + } | |
844 | + | |
845 | + if (is_numeric($this->ref_servidor) && | |
846 | + is_numeric($this->ref_cod_instituicao_servidor)) { | |
847 | + | |
848 | + $sql = "UPDATE %s SET ref_servidor='%d', data_exclusao = NOW() "; | |
849 | + $sql .= "WHERE ref_servidor = '%d' AND ref_cod_instituicao_servidor = '%d'"; | |
850 | + | |
851 | + $sql = sprintf($sql, $this->_tabela, $int_ref_cod_servidor_substituto, | |
852 | + $this->ref_servidor, $this->ref_cod_instituicao_servidor); | |
853 | + | |
854 | + $db = new clsBanco(); | |
855 | + $db->Consulta($sql); | |
856 | + | |
857 | + return TRUE; | |
858 | + } | |
859 | + | |
860 | + return FALSE; | |
861 | + } | |
861 | 862 | |
862 | 863 | |
863 | - //$this->ativo = 0; | |
864 | - // return $this->edita(); | |
865 | - } | |
866 | - return false; | |
867 | - } | |
868 | 864 | |
869 | 865 | /** |
870 | 866 | * Retorna um array com as turmas e horarios | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php
1 | 1 | <?php |
2 | -/** | |
3 | - * | |
4 | - * @author Prefeitura Municipal de Itajaí | |
5 | - * @version $Id$ | |
2 | + | |
3 | +/* | |
4 | + * i-Educar - Sistema de gestão escolar | |
6 | 5 | * |
7 | - * Pacote: i-PLB Software Público Livre e Brasileiro | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | 8 | * |
9 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí | |
10 | - * ctima@itajai.sc.gov.br | |
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. | |
11 | 13 | * |
12 | - * Este programa é software livre, você pode redistribuí-lo e/ou | |
13 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme | |
14 | - * publicada pela Free Software Foundation, tanto a versão 2 da | |
15 | - * Licença como (a seu critério) qualquer versão mais nova. | |
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. | |
16 | 18 | * |
17 | - * Este programa é distribuído na expectativa de ser útil, mas SEM | |
18 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- | |
19 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- | |
20 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. | |
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 | + | |
24 | +/** | |
25 | + * clsPmieducarServidor class | |
21 | 26 | * |
22 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU | |
23 | - * junto com este programa. Se não, escreva para a Free Software | |
24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
25 | - * 02111-1307, USA. | |
27 | + * Implementa o mapeamento com a tabela pmieducar.servidor. Contém métodos para | |
28 | + * busca de servidores utilizando os relacionamentos estrangeiros que a tabela | |
29 | + * possui. | |
26 | 30 | * |
31 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
32 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
33 | + * @package Core | |
34 | + * @subpackage Servidor | |
35 | + * @since Classe disponível desde a versão 1.0.0 | |
36 | + * @version $Id$ | |
27 | 37 | */ |
28 | 38 | |
39 | + | |
29 | 40 | require_once 'include/pmieducar/geral.inc.php'; |
30 | 41 | |
31 | -class clsPmieducarServidor | |
32 | -{ | |
42 | +class clsPmieducarServidor { | |
43 | + | |
33 | 44 | var $cod_servidor; |
34 | 45 | var $ref_cod_deficiencia; |
35 | 46 | var $ref_idesco; |
... | ... | @@ -403,436 +414,466 @@ class clsPmieducarServidor |
403 | 414 | return false; |
404 | 415 | } |
405 | 416 | |
406 | - /** | |
407 | - * Retorna uma lista filtrados de acordo com os parametros | |
408 | - * | |
409 | - * @return array | |
410 | - */ | |
411 | - public function lista($int_cod_servidor = NULL, $int_ref_cod_deficiencia = NULL, | |
412 | - $int_ref_idesco = null, $int_carga_horaria = NULL, $date_data_cadastro_ini = NULL, | |
413 | - $date_data_cadastro_fim = NULL, $date_data_exclusao_ini = NULL, | |
414 | - $date_data_exclusao_fim = NULL, $int_ativo = NULL, | |
415 | - $int_ref_cod_instituicao = NULL, $str_tipo = NULL, $array_horario = NULL, | |
416 | - $str_not_in_servidor = NULL, $str_nome_servidor = NULL, $boo_professor = FALSE, | |
417 | - $str_horario = NULL, $bool_ordena_por_nome = FALSE, $lst_matriculas = NULL, | |
418 | - $matutino = FALSE, $vespertino = FALSE, $noturno = FALSE, | |
419 | - $int_ref_cod_escola = NULL, $str_hr_mat = NULL, $str_hr_ves = NULL, | |
420 | - $str_hr_not = NULL, $int_dia_semana = NULL, | |
421 | - $alocacao_escola_instituicao = NULL, $int_identificador = NULL, | |
422 | - $int_ref_cod_curso = NULL, $int_ref_cod_disciplina = NULL, | |
423 | - $int_ref_cod_subnivel = NULL) { | |
424 | - | |
425 | - $whereAnd = " WHERE "; | |
426 | - $filtros = ""; | |
427 | - $tabela_compl = ""; | |
428 | - | |
429 | - /*if ( $boo_professor ) | |
430 | - { | |
431 | - $tabela_compl .= ", {$this->_schema}funcao f"; | |
432 | - }*/ | |
433 | - | |
434 | - if ( is_bool( $bool_ordena_por_nome ) ) | |
435 | - { | |
436 | - $tabela_compl .= ", cadastro.pessoa p"; | |
437 | - $this->_campos_lista2 .= ",p.nome"; | |
438 | - $filtros .= "{$whereAnd} s.cod_servidor = p.idpes "; | |
439 | - $whereAnd = " AND "; | |
440 | - $this->setOrderby( "nome" ); | |
441 | - } | |
442 | - else | |
443 | - { | |
444 | - $this->_campos_lista2 = $this->_todos_campos2; | |
445 | - $this->setOrderby( " 1 " ); | |
446 | - } | |
447 | 417 | |
448 | - $sql = "SELECT {$this->_campos_lista2} FROM {$this->_schema}servidor s{$tabela_compl}"; | |
449 | 418 | |
450 | - if ( is_numeric( $int_cod_servidor ) ) | |
451 | - { | |
452 | - $filtros .= "{$whereAnd} s.cod_servidor = '{$int_cod_servidor}'"; | |
453 | - $whereAnd = " AND "; | |
454 | - } | |
455 | - | |
456 | - if ( is_numeric( $int_ref_cod_deficiencia ) ) | |
457 | - { | |
458 | - $filtros .= "{$whereAnd} s.ref_cod_deficiencia = '{$int_ref_cod_deficiencia}'"; | |
459 | - $whereAnd = " AND "; | |
460 | - } | |
419 | + /** | |
420 | + * Retorna um array com resultados de uma pesquisa parametrizada | |
421 | + * | |
422 | + * O array retornado contém em cada um de seus items um array associativo onde | |
423 | + * as chaves correspondem aos campos da tabela indicados por | |
424 | + * $this->_campos_lista. | |
425 | + * | |
426 | + * A pesquisa SELECT realizada é afetada por diversos parâmetros disponíveis. | |
427 | + * Alguns dos parâmetros induzem a subqueries para a avaliação de diferentes | |
428 | + * funcionalidades do sistema. | |
429 | + * | |
430 | + * @see intranet/educar_pesquisa_servidor_lst.php Listagem de busca de | |
431 | + * servidores | |
432 | + * @see intranet/educar_quadro_horario_horarios_cad.php Cadastro de horário | |
433 | + * de aula para uma turma | |
434 | + * @see intranet/educar_turma_cad.php Cadastro de turma | |
435 | + * | |
436 | + * @param int $int_cod_servidor Código do servidor | |
437 | + * @param int $int_ref_cod_deficiencia Código da deficiência do servidor | |
438 | + * @param int $int_ref_idesco Código da escolaridade do servidor | |
439 | + * @param int $int_carga_horaria Carga horária do servidor | |
440 | + * @param string $date_data_cadastro_ini Data de cadastro inicial (busca por intervalo >= ao valor) | |
441 | + * @param string $date_data_cadastro_fim Data de cadastro final (busca por intervalo <= ao valor) | |
442 | + * @param string $date_data_exclusao_ini Data da exclusão inicial (busca por intervalo >= ao valor) | |
443 | + * @param string $date_data_exclusao_fim Data da exclusão final (busca por intervalo <= ao valor) | |
444 | + * @param int $int_ativo '1' para buscar apenas por servidores ativos | |
445 | + * @param int $int_ref_cod_instituicao Código da instituição do servidor | |
446 | + * @param string $str_tipo 'livre' para buscar apenas por servidores não alocados (subquery) | |
447 | + * @param array $array_horario Busca por horário de alocação do servidor (subquery) | |
448 | + * @param int $str_not_in_servidor Código de servidor a excluir | |
449 | + * @param string $str_nome_servidor Busca do tipo LIKE pelo padrão de nome do servidor (subquery) | |
450 | + * @param int|string $boo_professor Qualquer valor que avalie para TRUE para buscar por servidores professores (subquery) | |
451 | + * @param string $str_horario 'S' para buscar se o servidor está alocado em um dos horários (indicados $matutino, $vespertino ou $noturno) (subquery) | |
452 | + * @param bool $bool_ordena_por_nome TRUE para ordenar os resultados pelo campo nome por ordem alfabética crescente | |
453 | + * @param string $lst_matriculas Verifica se o servidor não está na lista de matriculas (string com inteiros separados por vírgula: 54, 55, 60). | |
454 | + * Apenas verifica quando a buscar por horário de alocação é realizada | |
455 | + * @param bool $matutino Busca por professores com horário livre no período matutino | |
456 | + * @param bool $vespertino Busca por professores com horário livre no período vespertino | |
457 | + * @param bool $noturno Busca por professores com horário livre no período noturno | |
458 | + * @param int $int_ref_cod_escola Código da escola para verificar se o servidor está alocado nela (usado em várias das subqueries) | |
459 | + * @param string $str_hr_mat Duração da aula (formato HH:MM) para o período matutino | |
460 | + * @param string $str_hr_ves Duração da aula (formato HH:MM) para o período vespertino | |
461 | + * @param string $str_hr_not Duração da aula (formato HH:MM) para o período noturno | |
462 | + * @param int $int_dia_semana Inteiro para o dia da semana (1 = domingo, 7 = sábado) | |
463 | + * @param int $alocacao_escola_instituicao Código da instituição ao qual o servidor deve estar cadastrado (subquery) | |
464 | + * @param int $int_identificador Campo identificado para busca na tabela pmieducar.quadro_horario_horarios_aux (subquery) | |
465 | + * @param int $int_ref_cod_curso Código do curso que o professor deve estar cadastrado (subquery) | |
466 | + * @param int $int_ref_cod_disciplina Código da disciplina que o professor deve ser habilitado (subquery). | |
467 | + * Somente verifica quando o curso passado por $int_ref_cod_curso não | |
468 | + * possui sistema de falta globalizada | |
469 | + * @param int $int_ref_cod_subnivel Código de subnível que o servidor deve possuir | |
470 | + * @return array|bool Array com os resultados da query SELECT ou FALSE caso | |
471 | + * nenhum registro tenha sido encontrado | |
472 | + */ | |
473 | + public function lista( | |
474 | + $int_cod_servidor = NULL, | |
475 | + $int_ref_cod_deficiencia = NULL, | |
476 | + $int_ref_idesco = NULL, | |
477 | + $int_carga_horaria = NULL, | |
478 | + $date_data_cadastro_ini = NULL, | |
479 | + $date_data_cadastro_fim = NULL, | |
480 | + $date_data_exclusao_ini = NULL, | |
481 | + $date_data_exclusao_fim = NULL, | |
482 | + $int_ativo = NULL, | |
483 | + $int_ref_cod_instituicao = NULL, | |
484 | + $str_tipo = NULL, | |
485 | + $array_horario = NULL, | |
486 | + $str_not_in_servidor = NULL, | |
487 | + $str_nome_servidor = NULL, | |
488 | + $boo_professor = FALSE, | |
489 | + $str_horario = NULL, | |
490 | + $bool_ordena_por_nome = FALSE, | |
491 | + $lst_matriculas = NULL, | |
492 | + $matutino = FALSE, | |
493 | + $vespertino = FALSE, | |
494 | + $noturno = FALSE, | |
495 | + $int_ref_cod_escola = NULL, | |
496 | + $str_hr_mat = NULL, | |
497 | + $str_hr_ves = NULL, | |
498 | + $str_hr_not = NULL, | |
499 | + $int_dia_semana = NULL, | |
500 | + $alocacao_escola_instituicao = NULL, | |
501 | + $int_identificador = NULL, | |
502 | + $int_ref_cod_curso = NULL, | |
503 | + $int_ref_cod_disciplina = NULL, | |
504 | + $int_ref_cod_subnivel = NULL | |
505 | + ) { | |
506 | + | |
507 | + $whereAnd = ' WHERE '; | |
508 | + $filtros = ''; | |
509 | + $tabela_compl = ''; | |
510 | + | |
511 | + if (is_bool($bool_ordena_por_nome)) { | |
512 | + $tabela_compl .= ', cadastro.pessoa p'; | |
513 | + $this->_campos_lista2 .= ', p.nome'; | |
514 | + $filtros .= $whereAnd . ' s.cod_servidor = p.idpes '; | |
515 | + $whereAnd = ' AND '; | |
516 | + $this->setOrderby('nome'); | |
517 | + } | |
518 | + else { | |
519 | + $this->_campos_lista2 = $this->_todos_campos2; | |
520 | + $this->setOrderby(' 1 '); | |
521 | + } | |
522 | + | |
523 | + $sql = "SELECT {$this->_campos_lista2} FROM {$this->_schema}servidor s{$tabela_compl}"; | |
524 | + | |
525 | + if (is_numeric($int_cod_servidor)) { | |
526 | + $filtros .= "{$whereAnd} s.cod_servidor = '{$int_cod_servidor}'"; | |
527 | + $whereAnd = " AND "; | |
528 | + } | |
529 | + | |
530 | + if (is_numeric($int_ref_cod_deficiencia)) { | |
531 | + $filtros .= "{$whereAnd} s.ref_cod_deficiencia = '{$int_ref_cod_deficiencia}'"; | |
532 | + $whereAnd = " AND "; | |
533 | + } | |
534 | + | |
535 | + if (is_numeric($int_ref_idesco)) { | |
536 | + $filtros .= "{$whereAnd} s.ref_idesco = '{$int_ref_idesco}'"; | |
537 | + $whereAnd = " AND "; | |
538 | + } | |
539 | + | |
540 | + if (is_numeric($int_carga_horaria)) { | |
541 | + $filtros .= "{$whereAnd} s.carga_horaria = '{$int_carga_horaria}'"; | |
542 | + $whereAnd = " AND "; | |
543 | + } | |
544 | + | |
545 | + if (is_string($date_data_cadastro_ini)) { | |
546 | + $filtros .= "{$whereAnd} s.data_cadastro >= '{$date_data_cadastro_ini}'"; | |
547 | + $whereAnd = " AND "; | |
548 | + } | |
549 | + | |
550 | + if (is_string($date_data_cadastro_fim)) { | |
551 | + $filtros .= "{$whereAnd} s.data_cadastro <= '{$date_data_cadastro_fim}'"; | |
552 | + $whereAnd = " AND "; | |
553 | + } | |
554 | + | |
555 | + if (is_string($date_data_exclusao_ini)) { | |
556 | + $filtros .= "{$whereAnd} s.data_exclusao >= '{$date_data_exclusao_ini}'"; | |
557 | + $whereAnd = " AND "; | |
558 | + } | |
559 | + | |
560 | + if (is_string($date_data_exclusao_fim)) { | |
561 | + $filtros .= "{$whereAnd} s.data_exclusao <= '{$date_data_exclusao_fim}'"; | |
562 | + $whereAnd = " AND "; | |
563 | + } | |
564 | + | |
565 | + if (is_null($int_ativo) || $int_ativo) { | |
566 | + $filtros .= "{$whereAnd} s.ativo = '1'"; | |
567 | + $whereAnd = " AND "; | |
568 | + } | |
569 | + else { | |
570 | + $filtros .= "{$whereAnd} s.ativo = '0'"; | |
571 | + $whereAnd = " AND "; | |
572 | + } | |
573 | + | |
574 | + if (is_numeric($int_ref_cod_instituicao)) { | |
575 | + $filtros .= "{$whereAnd} s.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; | |
576 | + $whereAnd = " AND "; | |
577 | + } | |
578 | + | |
579 | + // Busca tipo LIKE pelo nome do servidor | |
580 | + if (is_string($str_nome_servidor)) { | |
581 | + $filtros .= "{$whereAnd} EXISTS (SELECT 1 | |
582 | + FROM cadastro.pessoa p | |
583 | + WHERE cod_servidor = p.idpes | |
584 | + AND to_ascii(p.nome) LIKE to_ascii('%$str_nome_servidor%')) "; | |
585 | + $whereAnd = " AND "; | |
586 | + } | |
587 | + | |
588 | + // Seleciona apenas servidores que tenham a carga atual maior ou igual ao | |
589 | + // do servidor atual | |
590 | + if (is_string($str_tipo)) { | |
591 | + switch ($str_tipo) { | |
592 | + case "livre": | |
593 | + if (is_numeric($int_ref_cod_instituicao)) { | |
594 | + $where = " AND s.ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
595 | + $where2 = " AND sa.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
596 | + } | |
597 | + | |
598 | + $filtros .= " | |
599 | + {$whereAnd} NOT EXISTS | |
600 | + (SELECT 1 | |
601 | + FROM pmieducar.servidor_alocacao sa | |
602 | + WHERE sa.ref_cod_servidor = s.cod_servidor $where2)"; | |
603 | + | |
604 | + $filtros .= " | |
605 | + {$whereAnd} (s.carga_horaria::text || ':00:00') >= COALESCE( | |
606 | + (SELECT SUM(carga_horaria)::text | |
607 | + FROM pmieducar.servidor_alocacao saa | |
608 | + WHERE saa.ref_cod_servidor = {$str_not_in_servidor}),'00:00') $where"; | |
609 | + | |
610 | + $whereAnd = " AND "; | |
611 | + break; | |
612 | + } | |
613 | + | |
614 | + $whereAnd = " AND "; | |
615 | + } | |
616 | + | |
617 | + if (is_numeric($alocacao_escola_instituicao)) { | |
618 | + $filtros .= " | |
619 | + {$whereAnd} s.cod_servidor IN | |
620 | + (SELECT a.ref_cod_servidor | |
621 | + FROM pmieducar.servidor_alocacao a | |
622 | + WHERE "; | |
623 | + | |
624 | + if (is_numeric($int_ref_cod_instituicao)) { | |
625 | + $filtros .= " a.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; | |
626 | + } | |
627 | + | |
628 | + if (is_numeric($int_ref_cod_escola)) { | |
629 | + $filtros .= " and ref_cod_escola = '{$int_ref_cod_escola}' "; | |
630 | + } | |
461 | 631 | |
462 | - if ( is_numeric( $int_ref_idesco ) ) | |
463 | - { | |
464 | - $filtros .= "{$whereAnd} s.ref_idesco = '{$int_ref_idesco}'"; | |
465 | - $whereAnd = " AND "; | |
466 | - } | |
467 | - | |
468 | - if ( is_numeric( $int_carga_horaria ) ) | |
469 | - { | |
470 | - $filtros .= "{$whereAnd} s.carga_horaria = '{$int_carga_horaria}'"; | |
471 | - $whereAnd = " AND "; | |
472 | - } | |
473 | - | |
474 | - if ( is_string( $date_data_cadastro_ini ) ) | |
475 | - { | |
476 | - $filtros .= "{$whereAnd} s.data_cadastro >= '{$date_data_cadastro_ini}'"; | |
477 | - $whereAnd = " AND "; | |
478 | - } | |
479 | - | |
480 | - if ( is_string( $date_data_cadastro_fim ) ) | |
481 | - { | |
482 | - $filtros .= "{$whereAnd} s.data_cadastro <= '{$date_data_cadastro_fim}'"; | |
483 | - $whereAnd = " AND "; | |
484 | - } | |
485 | - | |
486 | - if ( is_string( $date_data_exclusao_ini ) ) | |
487 | - { | |
488 | - $filtros .= "{$whereAnd} s.data_exclusao >= '{$date_data_exclusao_ini}'"; | |
489 | - $whereAnd = " AND "; | |
490 | - } | |
491 | - | |
492 | - if ( is_string( $date_data_exclusao_fim ) ) | |
493 | - { | |
494 | - $filtros .= "{$whereAnd} s.data_exclusao <= '{$date_data_exclusao_fim}'"; | |
495 | - $whereAnd = " AND "; | |
496 | - } | |
497 | - | |
498 | - if ( is_null( $int_ativo ) || $int_ativo ) | |
499 | - { | |
500 | - $filtros .= "{$whereAnd} s.ativo = '1'"; | |
501 | - $whereAnd = " AND "; | |
502 | - } | |
503 | - else | |
504 | - { | |
505 | - $filtros .= "{$whereAnd} s.ativo = '0'"; | |
506 | - $whereAnd = " AND "; | |
507 | - } | |
508 | - | |
509 | - if ( is_numeric( $int_ref_cod_instituicao ) ) | |
510 | - { | |
511 | - $filtros .= "{$whereAnd} s.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; | |
512 | - $whereAnd = " AND "; | |
513 | - } | |
514 | - | |
515 | - if (is_string( $str_nome_servidor ) ) | |
516 | - { | |
517 | - $filtros .= "{$whereAnd} EXISTS ( SELECT 1 | |
518 | - FROM cadastro.pessoa p | |
519 | - WHERE cod_servidor = p.idpes | |
520 | - AND to_ascii( p.nome ) like to_ascii( '%$str_nome_servidor%' ) ) "; | |
521 | - $whereAnd = " AND "; | |
522 | - } | |
523 | - | |
524 | - if ( is_string( $str_tipo ) ) | |
525 | - { | |
526 | - switch ( $str_tipo ) | |
527 | - { | |
528 | - case "livre": | |
529 | - if ( is_numeric( $int_ref_cod_instituicao ) ) | |
530 | - { | |
531 | - $where = " AND s.ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
532 | - $where2 = " AND sa.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
533 | - | |
534 | - } | |
535 | - $filtros .= "{$whereAnd} NOT EXISTS ( SELECT 1 | |
536 | - FROM pmieducar.servidor_alocacao sa | |
537 | - WHERE sa.ref_cod_servidor = s.cod_servidor $where2 )"; | |
538 | - $filtros .= "{$whereAnd} s.carga_horaria >= coalesce(( SELECT sum( carga_horaria) | |
539 | - FROM pmieducar.servidor_alocacao saa | |
540 | - WHERE saa.ref_cod_servidor = {$str_not_in_servidor} ),'00:00')$where"; | |
541 | - $whereAnd = " AND "; | |
542 | - break; | |
543 | - } | |
544 | - | |
545 | - $whereAnd = " AND "; | |
546 | - } | |
547 | - | |
548 | - | |
549 | - if( is_numeric($alocacao_escola_instituicao)) | |
550 | - { | |
551 | - $filtros .= "{$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor | |
552 | - FROM pmieducar.servidor_alocacao a | |
553 | - WHERE "; | |
554 | - if (is_numeric($int_ref_cod_instituicao)) { | |
555 | - $filtros .= " a.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; | |
556 | - } | |
557 | - if (is_numeric($int_ref_cod_escola)) { | |
558 | - $filtros .= " and ref_cod_escola = '{$int_ref_cod_escola}' "; | |
559 | - } | |
560 | 632 | $filtros .= ') '; |
561 | - } | |
562 | - | |
563 | - if ( is_array( $array_horario ) ) | |
564 | - { | |
565 | - $cond = ""; | |
566 | - if ( is_numeric( $int_ref_cod_instituicao ) ) | |
567 | - { | |
568 | - $where .= " {$cond} a.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
569 | - $cond = "AND"; | |
570 | - } | |
571 | - | |
572 | - if ( is_numeric( $int_ref_cod_escola ) ) | |
573 | - { | |
574 | - $where .= " {$cond} a.ref_cod_escola = '{$int_ref_cod_escola}' "; | |
575 | - $cond = "AND"; | |
576 | - } | |
577 | - | |
578 | - | |
579 | - $where .= " {$cond} a.ativo = '1'"; | |
580 | - $cond = "AND"; | |
581 | - | |
582 | - $hora_ini = explode( ":", $array_horario[1] ); | |
583 | - $hora_fim = explode( ":", $array_horario[2] ); | |
584 | - $horas = sprintf( "%02d", ( int ) abs( $hora_fim[0] ) - abs( $hora_ini[0] ) ); | |
585 | - $minutos = sprintf( "%02d", ( int ) abs( $hora_fim[1] ) - abs( $hora_ini[1] ) ); | |
586 | - | |
587 | - if ( $matutino ) | |
588 | - { | |
589 | - if ( is_string( $str_horario ) && $str_horario == "S" ) | |
590 | - { | |
591 | -// A somatória retorna nulo | |
592 | - $filtros .= "{$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor | |
593 | - FROM pmieducar.servidor_alocacao a | |
594 | - WHERE $where | |
595 | - AND a.periodo = 1 | |
596 | - AND a.carga_horaria >= coalesce( ( SELECT SUM( qhh.hora_final - qhh.hora_inicial ) | |
597 | - FROM pmieducar.quadro_horario_horarios qhh | |
598 | - WHERE qhh.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
599 | - AND qhh.ref_cod_escola = '$int_ref_cod_escola' | |
600 | - AND hora_inicial >= '08:00' | |
601 | - AND hora_inicial <= '12:00' | |
602 | - AND qhh.ativo = '1' | |
603 | - AND qhh.dia_semana <> '$int_dia_semana' | |
604 | - AND qhh.ref_servidor = a.ref_cod_servidor | |
605 | - GROUP BY qhh.ref_servidor ) ,'00:00') + '$str_hr_mat' + COALESCE((SELECT SUM( qhha.hora_final - qhha.hora_inicial ) | |
606 | - FROM pmieducar.quadro_horario_horarios_aux qhha | |
607 | - WHERE qhha.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
608 | - AND qhha.ref_cod_escola = $int_ref_cod_escola | |
609 | - AND hora_inicial >= '08:00' | |
610 | - AND hora_inicial <= '12:00' | |
611 | - AND qhha.ref_servidor = a.ref_cod_servidor | |
612 | - AND identificador = $int_identificador | |
613 | - GROUP BY qhha.ref_servidor),'00:00'))"; | |
614 | - } | |
615 | - else | |
616 | - { | |
617 | - $filtros .= "{$whereAnd} s.cod_servidor NOT IN ( SELECT a.ref_cod_servidor | |
618 | - FROM pmieducar.servidor_alocacao a | |
619 | - WHERE $where | |
620 | - AND a.periodo = 1 )"; | |
621 | - } | |
622 | - } | |
623 | - | |
624 | - if ( $vespertino ) | |
625 | - { | |
626 | - if ( is_string( $str_horario ) && $str_horario == "S" ) | |
627 | - { | |
628 | - $filtros .= "{$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor | |
629 | - FROM pmieducar.servidor_alocacao a | |
630 | - WHERE $where | |
631 | - AND a.periodo = 2 | |
632 | - AND a.carga_horaria >= coalesce(( SELECT SUM( qhh.hora_final - qhh.hora_inicial ) | |
633 | - FROM pmieducar.quadro_horario_horarios qhh | |
634 | - WHERE qhh.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
635 | - AND qhh.ref_cod_escola = '$int_ref_cod_escola' | |
636 | - AND qhh.ativo = '1' | |
637 | - AND hora_inicial >= '12:00' | |
638 | - AND hora_inicial <= '18:00' | |
639 | - AND qhh.dia_semana <> '$int_dia_semana' | |
640 | - AND qhh.ref_servidor = a.ref_cod_servidor | |
641 | - GROUP BY qhh.ref_servidor ),'00:00') + '$str_hr_ves' + COALESCE((SELECT SUM( qhha.hora_final - qhha.hora_inicial ) | |
642 | - FROM pmieducar.quadro_horario_horarios_aux qhha | |
643 | - WHERE qhha.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
644 | - AND qhha.ref_cod_escola = '$int_ref_cod_escola' | |
645 | - AND qhha.ref_servidor = a.ref_cod_servidor | |
646 | - AND hora_inicial >= '12:00' | |
647 | - AND hora_inicial <= '18:00' | |
648 | - AND identificador = $int_identificador | |
649 | - GROUP BY qhha.ref_servidor),'00:00') )"; | |
650 | - } | |
651 | - else | |
652 | - { | |
653 | - $filtros .= "{$whereAnd} s.cod_servidor NOT IN ( SELECT a.ref_cod_servidor | |
654 | - FROM pmieducar.servidor_alocacao a | |
655 | - WHERE $where | |
656 | - AND a.periodo = 2 )"; | |
657 | - } | |
658 | - } | |
659 | - | |
660 | - if ( $noturno ) | |
661 | - { | |
662 | - if ( is_string( $str_horario ) && $str_horario == "S" ) | |
663 | - { | |
664 | - $filtros .= "{$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor | |
665 | - FROM pmieducar.servidor_alocacao a | |
666 | - WHERE $where | |
667 | - AND a.periodo = 3 | |
668 | - AND a.carga_horaria >= coalesce(( SELECT SUM( qhh.hora_final - qhh.hora_inicial ) | |
669 | - FROM pmieducar.quadro_horario_horarios qhh | |
670 | - WHERE qhh.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
671 | - AND qhh.ref_cod_escola = '$int_ref_cod_escola' | |
672 | - AND qhh.ativo = '1' | |
673 | - AND hora_inicial >= '18:00' | |
674 | - AND hora_inicial <= '23:00' | |
675 | - AND qhh.dia_semana <> '$int_dia_semana' | |
676 | - GROUP BY qhh.ref_servidor ),'00:00') + '$str_hr_not' + COALESCE((SELECT SUM( qhha.hora_final - qhha.hora_inicial ) | |
677 | - FROM pmieducar.quadro_horario_horarios_aux qhha | |
678 | - WHERE qhha.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
679 | - AND qhha.ref_cod_escola = '$int_ref_cod_escola' | |
680 | - AND qhha.ref_servidor = a.ref_cod_servidor | |
681 | - AND hora_inicial >= '18:00' | |
682 | - AND hora_inicial <= '23:00' | |
683 | - AND identificador = $int_identificador | |
684 | - GROUP BY qhha.ref_servidor),'00:00') )"; | |
685 | - } | |
686 | - else | |
687 | - { | |
688 | - $filtros .= "{$whereAnd} s.cod_servidor NOT IN ( SELECT a.ref_cod_servidor | |
689 | - FROM pmieducar.servidor_alocacao a | |
690 | - WHERE $where | |
691 | - AND a.periodo = 3 )"; | |
692 | - } | |
693 | - } | |
633 | + } | |
634 | + | |
635 | + if (is_array($array_horario)) { | |
636 | + $cond = ""; | |
637 | + if (is_numeric($int_ref_cod_instituicao)) { | |
638 | + $where .= " {$cond} a.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
639 | + $cond = "AND"; | |
640 | + } | |
641 | + | |
642 | + if (is_numeric($int_ref_cod_escola)) { | |
643 | + $where .= " {$cond} a.ref_cod_escola = '{$int_ref_cod_escola}' "; | |
644 | + $cond = "AND"; | |
645 | + } | |
646 | + | |
647 | + $where .= " {$cond} a.ativo = '1'"; | |
648 | + $cond = "AND"; | |
649 | + | |
650 | + $hora_ini = explode(":", $array_horario[1]); | |
651 | + $hora_fim = explode(":", $array_horario[2]); | |
652 | + $horas = sprintf("%02d", (int) abs($hora_fim[0]) - abs($hora_ini[0])); | |
653 | + $minutos = sprintf("%02d", (int) abs($hora_fim[1]) - abs($hora_ini[1])); | |
654 | + | |
655 | + if ($matutino) { | |
656 | + if (is_string($str_horario) && $str_horario == "S") { | |
657 | + // A somatória retorna nulo | |
658 | + $filtros .= " | |
659 | + {$whereAnd} s.cod_servidor IN (SELECT a.ref_cod_servidor | |
660 | + FROM pmieducar.servidor_alocacao a | |
661 | + WHERE $where | |
662 | + AND a.periodo = 1 | |
663 | + AND a.carga_horaria >= COALESCE( | |
664 | + (SELECT SUM(qhh.hora_final - qhh.hora_inicial) | |
665 | + FROM pmieducar.quadro_horario_horarios qhh | |
666 | + WHERE qhh.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
667 | + AND qhh.ref_cod_escola = '$int_ref_cod_escola' | |
668 | + AND hora_inicial >= '08:00' | |
669 | + AND hora_inicial <= '12:00' | |
670 | + AND qhh.ativo = '1' | |
671 | + AND qhh.dia_semana <> '$int_dia_semana' | |
672 | + AND qhh.ref_servidor = a.ref_cod_servidor | |
673 | + GROUP BY qhh.ref_servidor ) ,'00:00') + '$str_hr_mat' + COALESCE( | |
674 | + (SELECT SUM( qhha.hora_final - qhha.hora_inicial ) | |
675 | + FROM pmieducar.quadro_horario_horarios_aux qhha | |
676 | + WHERE qhha.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
677 | + AND qhha.ref_cod_escola = $int_ref_cod_escola | |
678 | + AND hora_inicial >= '08:00' | |
679 | + AND hora_inicial <= '12:00' | |
680 | + AND qhha.ref_servidor = a.ref_cod_servidor | |
681 | + AND identificador = $int_identificador | |
682 | + GROUP BY qhha.ref_servidor),'00:00'))"; | |
683 | + } | |
684 | + else { | |
685 | + $filtros .= " | |
686 | + {$whereAnd} s.cod_servidor NOT IN (SELECT a.ref_cod_servidor | |
687 | + FROM pmieducar.servidor_alocacao a | |
688 | + WHERE $where | |
689 | + AND a.periodo = 1)"; | |
690 | + } | |
691 | + } | |
692 | + | |
693 | + if ($vespertino) { | |
694 | + if (is_string($str_horario) && $str_horario == "S") { | |
695 | + $filtros .= " | |
696 | + {$whereAnd} s.cod_servidor IN | |
697 | + (SELECT a.ref_cod_servidor | |
698 | + FROM pmieducar.servidor_alocacao a | |
699 | + WHERE $where | |
700 | + AND a.periodo = 2 | |
701 | + AND a.carga_horaria >= COALESCE( | |
702 | + (SELECT SUM( qhh.hora_final - qhh.hora_inicial ) | |
703 | + FROM pmieducar.quadro_horario_horarios qhh | |
704 | + WHERE qhh.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
705 | + AND qhh.ref_cod_escola = '$int_ref_cod_escola' | |
706 | + AND qhh.ativo = '1' | |
707 | + AND hora_inicial >= '12:00' | |
708 | + AND hora_inicial <= '18:00' | |
709 | + AND qhh.dia_semana <> '$int_dia_semana' | |
710 | + AND qhh.ref_servidor = a.ref_cod_servidor | |
711 | + GROUP BY qhh.ref_servidor ),'00:00') + '$str_hr_ves' + COALESCE( | |
712 | + (SELECT SUM( qhha.hora_final - qhha.hora_inicial ) | |
713 | + FROM pmieducar.quadro_horario_horarios_aux qhha | |
714 | + WHERE qhha.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
715 | + AND qhha.ref_cod_escola = '$int_ref_cod_escola' | |
716 | + AND qhha.ref_servidor = a.ref_cod_servidor | |
717 | + AND hora_inicial >= '12:00' | |
718 | + AND hora_inicial <= '18:00' | |
719 | + AND identificador = $int_identificador | |
720 | + GROUP BY qhha.ref_servidor),'00:00') )"; | |
721 | + } | |
722 | + else { | |
723 | + $filtros .= " | |
724 | + {$whereAnd} s.cod_servidor NOT IN ( SELECT a.ref_cod_servidor | |
725 | + FROM pmieducar.servidor_alocacao a | |
726 | + WHERE $where | |
727 | + AND a.periodo = 2 )"; | |
728 | + } | |
729 | + } | |
730 | + | |
731 | + if ($noturno) { | |
732 | + if (is_string($str_horario) && $str_horario == "S") { | |
733 | + $filtros .= " | |
734 | + {$whereAnd} s.cod_servidor IN ( SELECT a.ref_cod_servidor | |
735 | + FROM pmieducar.servidor_alocacao a | |
736 | + WHERE $where | |
737 | + AND a.periodo = 3 | |
738 | + AND a.carga_horaria >= COALESCE( | |
739 | + (SELECT SUM(qhh.hora_final - qhh.hora_inicial) | |
740 | + FROM pmieducar.quadro_horario_horarios qhh | |
741 | + WHERE qhh.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
742 | + AND qhh.ref_cod_escola = '$int_ref_cod_escola' | |
743 | + AND qhh.ativo = '1' | |
744 | + AND hora_inicial >= '18:00' | |
745 | + AND hora_inicial <= '23:00' | |
746 | + AND qhh.dia_semana <> '$int_dia_semana' | |
747 | + GROUP BY qhh.ref_servidor ),'00:00') + '$str_hr_not' + COALESCE( | |
748 | + (SELECT SUM( qhha.hora_final - qhha.hora_inicial ) | |
749 | + FROM pmieducar.quadro_horario_horarios_aux qhha | |
750 | + WHERE qhha.ref_cod_instituicao_servidor = '$int_ref_cod_instituicao' | |
751 | + AND qhha.ref_cod_escola = '$int_ref_cod_escola' | |
752 | + AND qhha.ref_servidor = a.ref_cod_servidor | |
753 | + AND hora_inicial >= '18:00' | |
754 | + AND hora_inicial <= '23:00' | |
755 | + AND identificador = $int_identificador | |
756 | + GROUP BY qhha.ref_servidor),'00:00') )"; | |
757 | + } | |
758 | + else { | |
759 | + $filtros .= " | |
760 | + {$whereAnd} s.cod_servidor NOT IN ( | |
761 | + SELECT a.ref_cod_servidor | |
762 | + FROM pmieducar.servidor_alocacao a | |
763 | + WHERE $where | |
764 | + AND a.periodo = 3 )"; | |
765 | + } | |
766 | + } | |
767 | + | |
768 | + if (is_string($str_horario) && $str_horario == "S") { | |
769 | + } | |
770 | + else { | |
771 | + $filtros .= " | |
772 | + {$whereAnd} s.carga_horaria >= COALESCE( | |
773 | + (SELECT sum(hora_final - hora_inicial) + '" . abs($horas) . ":" . abs($minutos)."' | |
774 | + FROM pmieducar.servidor_alocacao sa | |
775 | + WHERE sa.ref_cod_servidor = s.cod_servidor | |
776 | + AND sa.ref_ref_cod_instituicao ='{$int_ref_cod_instituicao}'),'00:00') "; | |
777 | + } | |
778 | + } | |
779 | + | |
780 | + if ((is_array($array_horario) && $str_not_in_servidor) || (is_string($str_tipo) && $str_not_in_servidor)) { | |
781 | + $filtros .= "{$whereAnd} s.cod_servidor NOT IN ( {$str_not_in_servidor} )"; | |
782 | + $whereAnd = " AND "; | |
783 | + } | |
784 | + | |
785 | + $obj_curso = new clsPmieducarCurso($int_ref_cod_curso); | |
786 | + $det_curso = $obj_curso->detalhe(); | |
787 | + | |
788 | + if ($det_curso['falta_ch_globalizada']) { | |
789 | + // Busca professores independentemente da disciplina, somente verifica | |
790 | + // se é professor e se ministra a disciplina para o curso | |
791 | + $filtros .= "{$whereAnd} EXISTS ( SELECT 1 FROM pmieducar.servidor_curso_ministra scm WHERE scm.ref_cod_curso = $int_ref_cod_curso AND scm.ref_ref_cod_instituicao = s.ref_cod_instituicao AND s.cod_servidor = scm.ref_cod_servidor)"; | |
792 | + $whereAnd = " AND "; | |
793 | + } | |
794 | + else { | |
795 | + // Verifica se o professor está habilitado para ministrar a disciplina | |
796 | + if(is_numeric($int_ref_cod_disciplina)) { | |
797 | + $filtros .= "{$whereAnd} EXISTS ( SELECT 1 FROM pmieducar.servidor_disciplina sd WHERE sd.ref_cod_disciplina = $int_ref_cod_disciplina AND sd.ref_ref_cod_instituicao = s.ref_cod_instituicao AND s.cod_servidor = sd.ref_cod_servidor)"; | |
798 | + $whereAnd = " AND "; | |
799 | + } | |
800 | + } | |
801 | + | |
802 | + // Seleciona apenas servidor cuja uma de suas funções seja a de professor | |
803 | + if ($boo_professor) { | |
804 | + $filtros .= " | |
805 | + {$whereAnd} EXISTS | |
806 | + (SELECT 1 | |
807 | + FROM pmieducar.servidor_funcao sf, pmieducar.funcao f | |
808 | + WHERE f.cod_funcao = sf.ref_cod_funcao AND | |
809 | + f.professor = 1 AND | |
810 | + sf.ref_ref_cod_instituicao = s.ref_cod_instituicao AND | |
811 | + s.cod_servidor = sf.ref_cod_servidor)"; | |
812 | + $whereAnd = " AND "; | |
813 | + } | |
814 | + | |
815 | + if (is_string($str_horario) && $str_horario == "S") { | |
816 | + $filtros .= " | |
817 | + {$whereAnd} s.cod_servidor NOT IN | |
818 | + (SELECT DISTINCT qhh.ref_servidor | |
819 | + FROM pmieducar.quadro_horario_horarios qhh | |
820 | + WHERE qhh.ref_servidor = s.cod_servidor | |
821 | + AND qhh.ref_cod_instituicao_servidor = s.ref_cod_instituicao | |
822 | + AND qhh.dia_semana = '{$array_horario[0]}' | |
823 | + AND qhh.hora_inicial >= '{$array_horario[1]}' | |
824 | + AND qhh.hora_final <= '{$array_horario[2]}' | |
825 | + AND qhh.ativo = '1'"; | |
826 | + | |
827 | + if (is_string($lst_matriculas)) { | |
828 | + $filtros .= "AND qhh.ref_servidor NOT IN ({$lst_matriculas})"; | |
829 | + } | |
830 | + | |
831 | + $filtros .= " )"; | |
832 | + | |
833 | + $whereAnd = " AND "; | |
834 | + } | |
835 | + | |
836 | + if (is_numeric($int_ref_cod_subnivel)) { | |
837 | + $filtros .= "{$whereAnd} s.ref_cod_subnivel = '{$int_ref_cod_subnivel}'"; | |
838 | + $whereAnd = " AND "; | |
839 | + } | |
840 | + | |
841 | + $countCampos = count(explode(',', $this->_campos_lista)); | |
842 | + $resultado = array(); | |
694 | 843 | |
695 | - if ( is_string( $str_horario ) && $str_horario == "S" ) | |
696 | - { | |
697 | - /*$filtros .= "{$whereAnd} s.carga_horaria >= ( SELECT EXTRACT ( HOUR FROM ( SELECT COALESCE( sum( hora_final - hora_inicial ) + '".abs( $horas ).":".abs( $minutos )."' , '00:00' ) | |
698 | - FROM pmieducar.servidor_alocacao sa | |
699 | - WHERE sa.ref_cod_servidor = s.cod_servidor | |
700 | - AND sa.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' ) ) + | |
701 | - ( SELECT EXTRACT ( MINUTE FROM ( SELECT COALESCE( sum( hora_final - hora_inicial ) + '".abs( $horas ).":".abs( $minutos )."' , '00:00' ) | |
702 | - FROM pmieducar.servidor_alocacao sa | |
703 | - WHERE sa.ref_cod_servidor = s.cod_servidor | |
704 | - AND sa.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' ) ) ) )";*/ | |
705 | - } | |
706 | - else | |
707 | - { | |
708 | - $filtros .= "{$whereAnd} s.carga_horaria >= coalesce(( SELECT sum(hora_final - hora_inicial ) + '".abs( $horas ).":".abs( $minutos )."' | |
709 | - FROM pmieducar.servidor_alocacao sa WHERE sa.ref_cod_servidor = s.cod_servidor and sa.ref_ref_cod_instituicao ='{$int_ref_cod_instituicao}' ),'00:00')"; | |
710 | - } | |
711 | - | |
712 | - /*$filtros .= "{$whereAnd} s.carga_horaria >= ( SELECT coalesce(extract(hour from (sum(hora_final - hora_inicial ) + '{$horas}:00'::time)) + (extract(minute from (sum(hora_final - hora_inicial ) + '00:$minutos'::time)) / 60) | |
713 | - , | |
714 | - (extract(hour from ('{$horas}:00'::time)) + (extract(minute from '00:$minutos'::time)) / 60) | |
715 | - ) FROM pmieducar.servidor_alocacao sa WHERE sa.ref_cod_servidor = s.cod_servidor and sa.ref_ref_cod_instituicao ='{$int_ref_cod_instituicao}' )";*/ | |
716 | - $whereAnd = " AND "; | |
717 | - | |
718 | - } | |
719 | - | |
720 | - if(((is_array($array_horario) && $str_not_in_servidor) || is_string( $str_tipo ) && $str_not_in_servidor)) | |
721 | - { | |
722 | - | |
723 | - $filtros .= "{$whereAnd} s.cod_servidor NOT IN ( {$str_not_in_servidor} )"; | |
724 | - $whereAnd = " AND "; | |
725 | - } | |
726 | - /*if ( $boo_professor ) { | |
727 | - $filtros .= "{$whereAnd} s.ref_cod_funcao = f.cod_funcao AND s.ref_cod_instituicao = f.ref_cod_instituicao AND f.professor = 1"; | |
728 | - $whereAnd = " AND "; | |
729 | - }*/ | |
730 | - | |
731 | - $obj_curso = new clsPmieducarCurso($int_ref_cod_curso); | |
732 | - $det_curso = $obj_curso->detalhe(); | |
733 | - | |
734 | - if($det_curso['falta_ch_globalizada']) | |
735 | - { | |
736 | - /** | |
737 | - * busca professores independentes da disciplina | |
738 | - * somente verifica se eh professor e se da a materia para o curso | |
739 | - */ | |
740 | - $filtros .= "{$whereAnd} EXISTS ( SELECT 1 FROM pmieducar.servidor_curso_ministra scm WHERE scm.ref_cod_curso = $int_ref_cod_curso AND scm.ref_ref_cod_instituicao = s.ref_cod_instituicao AND s.cod_servidor = scm.ref_cod_servidor)"; | |
741 | - $whereAnd = " AND "; | |
742 | - } | |
743 | - else | |
744 | - { | |
745 | - /** | |
746 | - * verifica se o professor pode dar aula para a disciplina | |
747 | - * se nao tiver a disciplina nao pode dar aula | |
748 | - */ | |
749 | - | |
750 | - if(is_numeric($int_ref_cod_disciplina)) | |
751 | - { | |
752 | - $filtros .= "{$whereAnd} EXISTS ( SELECT 1 FROM pmieducar.servidor_disciplina sd WHERE sd.ref_cod_disciplina = $int_ref_cod_disciplina AND sd.ref_ref_cod_instituicao = s.ref_cod_instituicao AND s.cod_servidor = sd.ref_cod_servidor)"; | |
753 | - $whereAnd = " AND "; | |
754 | - } | |
755 | - elseif ($int_ref_cod_disciplina == "NULL") | |
756 | - { | |
757 | - $filtros .= "{$whereAnd} FALSE"; | |
758 | - $whereAnd = " AND "; | |
759 | - } | |
760 | - | |
761 | - } | |
762 | - | |
763 | - if ( $boo_professor ) { | |
764 | - $filtros .= "{$whereAnd} EXISTS ( SELECT 1 FROM pmieducar.servidor_funcao sf,pmieducar.funcao f WHERE f.cod_funcao = sf.ref_cod_funcao AND f.professor = 1 AND sf.ref_ref_cod_instituicao = s.ref_cod_instituicao AND s.cod_servidor = sf.ref_cod_servidor )"; | |
765 | - $whereAnd = " AND "; | |
766 | - } | |
767 | - if ( is_string( $str_horario ) && $str_horario == "S" ) | |
768 | - { | |
769 | - $filtros .= "{$whereAnd} s.cod_servidor NOT IN ( SELECT DISTINCT qhh.ref_servidor | |
770 | - FROM pmieducar.quadro_horario_horarios qhh | |
771 | - WHERE qhh.ref_servidor = s.cod_servidor | |
772 | - AND qhh.ref_cod_instituicao_servidor = s.ref_cod_instituicao | |
773 | - AND qhh.dia_semana = '{$array_horario[0]}' | |
774 | - AND qhh.hora_inicial >= '{$array_horario[1]}' | |
775 | - AND qhh.hora_final <= '{$array_horario[2]}' | |
776 | - AND qhh.ativo = '1'"; | |
777 | - if ( is_string( $lst_matriculas ) ) | |
778 | - { | |
779 | - $filtros .= "AND qhh.ref_servidor NOT IN ( {$lst_matriculas} )"; | |
780 | - } | |
844 | + $db = new clsBanco(); | |
781 | 845 | |
782 | - $filtros .= " )"; | |
846 | + $sql = "SELECT {$this->_campos_lista2} FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}" . | |
847 | + $this->getOrderby() . $this->getLimite(); | |
783 | 848 | |
784 | - $whereAnd = " AND "; | |
785 | - } | |
849 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}"); | |
786 | 850 | |
787 | - if(is_numeric($int_identificador)) | |
788 | - { | |
789 | - /** | |
790 | - * | |
791 | - */ | |
792 | - //$filtros .= "AND qhh.ref_servidor NOT IN ( {$lst_matriculas} )"; | |
793 | - } | |
851 | + // Executa a query | |
852 | + $db->Consulta($sql); | |
794 | 853 | |
795 | - if(is_numeric($int_ref_cod_subnivel)) | |
796 | - { | |
797 | - $filtros .= "{$whereAnd} s.ref_cod_subnivel = '{$int_ref_cod_subnivel}'"; | |
798 | - $whereAnd = " AND "; | |
799 | - } | |
854 | + if ($countCampos > 1) { | |
855 | + while ($db->ProximoRegistro()) { | |
856 | + $tupla = $db->Tupla(); | |
800 | 857 | |
801 | - $countCampos = count( explode( ",", $this->_campos_lista ) ); | |
802 | - $resultado = array(); | |
858 | + $tupla['_total'] = $this->_total; | |
859 | + $resultado[] = $tupla; | |
860 | + } | |
861 | + } | |
862 | + else { | |
863 | + while ($db->ProximoRegistro()) { | |
864 | + $tupla = $db->Tupla(); | |
865 | + $resultado[] = $tupla[$this->_campos_lista]; | |
866 | + } | |
867 | + } | |
803 | 868 | |
804 | - $db = new clsBanco(); | |
869 | + if (count($resultado)) { | |
870 | + return $resultado; | |
871 | + } | |
805 | 872 | |
806 | - $sql = "SELECT {$this->_campos_lista2} FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}".$this->getOrderby().$this->getLimite(); | |
873 | + return FALSE; | |
874 | + } | |
807 | 875 | |
808 | - $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_schema}servidor s{$tabela_compl} {$filtros}" ); | |
809 | 876 | |
810 | - $db->Consulta( $sql ); | |
811 | - | |
812 | - if( $countCampos > 1 ) | |
813 | - { | |
814 | - while ( $db->ProximoRegistro() ) | |
815 | - { | |
816 | - $tupla = $db->Tupla(); | |
817 | - | |
818 | - $tupla["_total"] = $this->_total; | |
819 | - $resultado[] = $tupla; | |
820 | - } | |
821 | - } | |
822 | - else | |
823 | - { | |
824 | - while ( $db->ProximoRegistro() ) | |
825 | - { | |
826 | - $tupla = $db->Tupla(); | |
827 | - $resultado[] = $tupla[$this->_campos_lista]; | |
828 | - } | |
829 | - } | |
830 | - if( count( $resultado ) ) | |
831 | - { | |
832 | - return $resultado; | |
833 | - } | |
834 | - return false; | |
835 | - } | |
836 | 877 | |
837 | 878 | /** |
838 | 879 | * Retorna um array com os dados de um registro |
... | ... | @@ -892,6 +933,167 @@ class clsPmieducarServidor |
892 | 933 | return false; |
893 | 934 | } |
894 | 935 | |
936 | + | |
937 | + | |
938 | + /** | |
939 | + * Retorna array com as funções do servidor | |
940 | + * | |
941 | + * Exemplo de array de retorno: | |
942 | + * <code> | |
943 | + * array( | |
944 | + * '2' => array( | |
945 | + * 'cod_funcao' => 2, | |
946 | + * 'nm_funcao' => 'Professor', | |
947 | + * 'professor' => 1 | |
948 | + * ) | |
949 | + * ); | |
950 | + * <code> | |
951 | + * | |
952 | + * @since Método disponível desde a versão 1.0.2 | |
953 | + * @return array Array associativo com a primeira chave sendo o código da | |
954 | + * função. O array interno contém o nome da função e se a função desempenha | |
955 | + * um papel de professor | |
956 | + */ | |
957 | + public function getServidorFuncoes() { | |
958 | + $db = new clsBanco(); | |
959 | + | |
960 | + $sql = 'SELECT t2.cod_funcao, t2.nm_funcao, t2.professor FROM pmieducar.servidor_funcao AS t1, pmieducar.funcao AS t2 '; | |
961 | + $sql .= 'WHERE t1.ref_cod_servidor = \'%d\' AND t1.ref_ref_cod_instituicao = \'%d\' '; | |
962 | + $sql .= 'AND t1.ref_cod_funcao = t2.cod_funcao'; | |
963 | + | |
964 | + $sql = sprintf($sql, $this->cod_servidor, $this->ref_cod_instituicao); | |
965 | + $db->Consulta($sql); | |
966 | + | |
967 | + $funcoes = array(); | |
968 | + | |
969 | + while ($db->ProximoRegistro() != FALSE) { | |
970 | + $row = $db->Tupla(); | |
971 | + $funcoes[$row['cod_funcao']] = array( | |
972 | + 'cod_funcao' => $row['cod_funcao'], | |
973 | + 'nm_funcao' => $row['nm_funcao'], | |
974 | + 'professor' => $row['professor'], | |
975 | + ); | |
976 | + } | |
977 | + | |
978 | + return $funcoes; | |
979 | + } | |
980 | + | |
981 | + | |
982 | + | |
983 | + /** | |
984 | + * Retorna um array com as disciplinas alocadas ao servidor no quadro de | |
985 | + * horários | |
986 | + * | |
987 | + * @since Método disponível desde a versão 1.0.2 | |
988 | + * @param int $codServidor Código do servidor, caso não seja informado, | |
989 | + * usa o código disponível no objeto atual | |
990 | + * @param int $codInstituicao Código da instituição, caso não seja | |
991 | + * informado, usa o código disponível no objeto atual | |
992 | + * @return array|bool Array com códigos das disciplinas ordenados ou FALSE | |
993 | + * caso o servidor não tenha disciplinas | |
994 | + */ | |
995 | + public function getServidorDisciplinasQuadroHorarioHorarios($codServidor = NULL, | |
996 | + $codInstituicao = NULL) { | |
997 | + | |
998 | + $codServidor = $codServidor != NULL ? $codServidor : $this->cod_servidor; | |
999 | + $codInstituicao = $codInstituicao != NULL ? $codInstituicao : $this->ref_cod_instituicao; | |
1000 | + | |
1001 | + $sql = 'SELECT DISTINCT(qhh.ref_cod_disciplina) AS ref_cod_disciplina '; | |
1002 | + $sql .= 'FROM pmieducar.quadro_horario_horarios qhh, pmieducar.servidor s '; | |
1003 | + $sql .= 'WHERE qhh.ref_servidor = s.cod_servidor AND '; | |
1004 | + $sql .= 'qhh.ref_servidor = \'%d\' AND qhh.ref_cod_instituicao_servidor = \'%d\''; | |
1005 | + | |
1006 | + $sql = sprintf($sql, $codServidor, $codInstituicao); | |
1007 | + | |
1008 | + $db = new clsBanco(); | |
1009 | + $db->Consulta($sql); | |
1010 | + | |
1011 | + $disciplinas = array(); | |
1012 | + | |
1013 | + while ($db->ProximoRegistro() != FALSE) { | |
1014 | + $row = $db->Tupla(); | |
1015 | + $disciplinas[] = $row['ref_cod_disciplina']; | |
1016 | + } | |
1017 | + | |
1018 | + if (count($disciplinas)) { | |
1019 | + return asort($disciplinas); | |
1020 | + } | |
1021 | + | |
1022 | + return FALSE; | |
1023 | + } | |
1024 | + | |
1025 | + | |
1026 | + | |
1027 | + /** | |
1028 | + * Retorna um array com os códigos das disciplinas do servidor | |
1029 | + * | |
1030 | + * @since Método disponível desde a versão 1.0.2 | |
1031 | + * @param int $codServidor Código do servidor, caso não seja informado, | |
1032 | + * usa o código disponível no objeto atual | |
1033 | + * @param int $codInstituicao Código da instituição, caso não seja | |
1034 | + * informado, usa o código disponível no objeto atual | |
1035 | + * @return array|bool Array com códigos das disciplinas ordenados ou FALSE | |
1036 | + * caso o servidor não tenha disciplinas | |
1037 | + */ | |
1038 | + public function getServidorDisciplinas($codServidor = NULL, | |
1039 | + $codInstituicao = NULL) { | |
1040 | + | |
1041 | + $codServidor = $codServidor != NULL ? $codServidor : $this->cod_servidor; | |
1042 | + $codInstituicao = $codInstituicao != NULL ? $codInstituicao : $this->ref_cod_instituicao; | |
1043 | + | |
1044 | + // Se códigos não forem fornecidos, nem pela classe nem pelo código cliente, | |
1045 | + // retorna FALSE | |
1046 | + if ($codServidor == NULL || $codInstituicao == NULL) { | |
1047 | + return FALSE; | |
1048 | + } | |
1049 | + | |
1050 | + $sql = 'SELECT DISTINCT(sd.ref_cod_disciplina) AS ref_cod_disciplina '; | |
1051 | + $sql .= 'FROM pmieducar.servidor_disciplina sd, pmieducar.servidor s '; | |
1052 | + $sql .= 'WHERE sd.ref_cod_servidor = s.cod_servidor AND '; | |
1053 | + $sql .= 'sd.ref_cod_servidor = \'%d\' AND sd.ref_ref_cod_instituicao = \'%d\''; | |
1054 | + | |
1055 | + $sql = sprintf($sql, $codServidor, $codInstituicao); | |
1056 | + | |
1057 | + $db = new clsBanco(); | |
1058 | + $db->Consulta($sql); | |
1059 | + | |
1060 | + $disciplinas = array(); | |
1061 | + | |
1062 | + while ($db->ProximoRegistro() != FALSE) { | |
1063 | + $row = $db->Tupla(); | |
1064 | + $disciplinas[] = $row['ref_cod_disciplina']; | |
1065 | + } | |
1066 | + | |
1067 | + if (count($disciplinas)) { | |
1068 | + return asort($disciplinas); | |
1069 | + } | |
1070 | + | |
1071 | + return FALSE; | |
1072 | + } | |
1073 | + | |
1074 | + /** | |
1075 | + * Verifica se um servidor desempenha a função de professor. | |
1076 | + * | |
1077 | + * Primeiro, recuperamos todas as funções do servidor e procuramos | |
1078 | + * por um dos itens que tenha o índice professor igual a 1. | |
1079 | + * | |
1080 | + * @since Método disponível desde a versão 1.0.2 | |
1081 | + * @return bool TRUE caso o servidor desempenhe a função de professor | |
1082 | + */ | |
1083 | + public function isProfessor() { | |
1084 | + $funcoes = $this->getServidorFuncoes(); | |
1085 | + | |
1086 | + foreach ($funcoes as $funcao) { | |
1087 | + if (1 == $funcao['professor']) { | |
1088 | + return TRUE; | |
1089 | + break; | |
1090 | + } | |
1091 | + } | |
1092 | + | |
1093 | + return FALSE; | |
1094 | + } | |
1095 | + | |
1096 | + | |
895 | 1097 | /** |
896 | 1098 | * Define quais campos da tabela serao selecionados na invocacao do metodo lista |
897 | 1099 | * | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarServidorAlocacao.inc.php
1 | 1 | <?php |
2 | 2 | |
3 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
4 | -* * | |
5 | -* @author Prefeitura Municipal de Itajaí * | |
6 | -* @updated 29/03/2007 * | |
7 | -* Pacote: i-PLB Software Público Livre e Brasileiro * | |
8 | -* * | |
9 | -* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
10 | -* ctima@itajai.sc.gov.br * | |
11 | -* * | |
12 | -* Este programa é software livre, você pode redistribuí-lo e/ou * | |
13 | -* modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
14 | -* publicada pela Free Software Foundation, tanto a versão 2 da * | |
15 | -* Licença como (a seu critério) qualquer versão mais nova. * | |
16 | -* * | |
17 | -* Este programa é distribuído na expectativa de ser útil, mas SEM * | |
18 | -* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
19 | -* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
20 | -* sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
21 | -* * | |
22 | -* Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
23 | -* junto com este programa. Se não, escreva para a Free Software * | |
24 | -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
25 | -* 02111-1307, USA. * | |
26 | -* * | |
27 | -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
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 | + */ | |
28 | 23 | |
29 | 24 | /** |
30 | -* @author Prefeitura Municipal de Itajaí | |
31 | -* | |
32 | -* Criado em 04/08/2006 11:12 pelo gerador automatico de classes | |
33 | -*/ | |
25 | + * ClsPmieducarServidorAlocacaoTest class | |
26 | + * | |
27 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
28 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
29 | + * @package Core | |
30 | + * @subpackage Servidor | |
31 | + * @since Classe disponível desde a versão 1.0.0 | |
32 | + * @version $Id$ | |
33 | + */ | |
34 | 34 | |
35 | 35 | require_once( "include/pmieducar/geral.inc.php" ); |
36 | 36 | |
... | ... | @@ -654,58 +654,54 @@ class clsPmieducarServidorAlocacao |
654 | 654 | return false; |
655 | 655 | } |
656 | 656 | |
657 | - /** | |
658 | - * Realiza a substituicao de um servidor | |
659 | - * | |
660 | - * @return bool | |
661 | - */ | |
662 | - function substituir_servidor($int_ref_cod_servidor_substituto) | |
663 | - { | |
664 | - if( is_numeric( $int_ref_cod_servidor_substituto ) && is_numeric( $this->ref_ref_cod_instituicao ) ) | |
665 | - { | |
666 | - if( class_exists( "clsPmieducarServidor" ) ) | |
667 | - { | |
668 | - $tmp_obj = new clsPmieducarServidor( $int_ref_cod_servidor_substituto,null,null,null,null,null,null,null, $this->ref_ref_cod_instituicao ); | |
669 | - if( method_exists( $tmp_obj, "existe") ) | |
670 | - { | |
671 | - if( !$tmp_obj->existe() ) | |
672 | - { | |
673 | - return false; | |
674 | - } | |
675 | - } | |
676 | - else if( method_exists( $tmp_obj, "detalhe") ) | |
677 | - { | |
678 | - if( !$tmp_obj->detalhe() ) | |
679 | - { | |
680 | - return false; | |
681 | - } | |
682 | - } | |
683 | - } | |
684 | - else | |
685 | - { | |
686 | - if( !$db->CampoUnico( "SELECT 1 FROM pmieducar.servidor WHERE cod_servidor = '{$ref_cod_servidor}' AND ref_cod_instituicao = '{$ref_ref_cod_instituicao}'" ) ) | |
687 | - { | |
688 | - return false; | |
689 | - } | |
690 | - } | |
691 | - } | |
692 | -// echo "if( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->periodo ) && is_numeric( $this->carga_horaria ))";die; | |
693 | - if( is_numeric( $this->ref_cod_servidor ) && is_numeric( $this->ref_ref_cod_instituicao ) && is_numeric( $this->ref_cod_escola ) && is_numeric( $this->periodo ) && is_string( $this->carga_horaria ) ) | |
694 | - { | |
695 | 657 | |
696 | 658 | |
697 | - //delete | |
698 | - $db = new clsBanco(); | |
699 | - //echo "UPDATE {$this->_tabela} SET ref_cod_servidor='$int_ref_cod_servidor_substituto' WHERE ref_cod_servidor = '{$this->ref_cod_servidor}' AND ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND carga_horaria = '{$this->carga_horaria}' AND periodo = '{$this->periodo}'" ; | |
700 | - $db->Consulta( "UPDATE {$this->_tabela} SET ref_cod_servidor='$int_ref_cod_servidor_substituto' WHERE ref_cod_servidor = '{$this->ref_cod_servidor}' AND ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_escola = '{$this->ref_cod_escola}' AND carga_horaria = '{$this->carga_horaria}' AND periodo = '{$this->periodo}'" ); | |
701 | - return true; | |
659 | + /** | |
660 | + * Substitui a alocação entre servidores | |
661 | + * | |
662 | + * Substitui a alocação entre servidores, atualizando a tabela | |
663 | + * pmieducar.servidor_alocacao. A única atualização na tabela ocorre no | |
664 | + * identificador do servidor, o campo ref_cod_servidor. Para usar este | |
665 | + * método, um objeto desta classe precisa estar instanciado com os atributos | |
666 | + * do servidor a ser substituido. | |
667 | + * | |
668 | + * @param int $int_ref_cod_servidor_substituto Código do servidor que substituirá o atual | |
669 | + * @return bool TRUE em caso de sucesso, FALSE caso contrário | |
670 | + */ | |
671 | + public function substituir_servidor($int_ref_cod_servidor_substituto) { | |
672 | + if (is_numeric($int_ref_cod_servidor_substituto) && | |
673 | + is_numeric($this->ref_ref_cod_instituicao)) { | |
674 | + | |
675 | + $servidor = new clsPmieducarServidor($int_ref_cod_servidor_substituto, | |
676 | + NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_ref_cod_instituicao); | |
677 | + | |
678 | + if (!$servidor->existe()) { | |
679 | + return FALSE; | |
680 | + } | |
681 | + } | |
682 | + | |
683 | + if (is_numeric($this->ref_cod_servidor) && is_numeric($this->ref_ref_cod_instituicao) && | |
684 | + is_numeric($this->ref_cod_escola) && is_numeric($this->periodo) && | |
685 | + is_string($this->carga_horaria)) { | |
686 | + | |
687 | + $sql = "UPDATE %s SET ref_cod_servidor='%d' WHERE ref_cod_servidor = '%d' "; | |
688 | + $sql .= "AND ref_ref_cod_instituicao = '%d' AND ref_cod_escola = '%d' AND "; | |
689 | + $sql .= "carga_horaria = '%s' AND periodo = '%d'"; | |
690 | + | |
691 | + $sql = sprintf($sql, $this->_tabela, $int_ref_cod_servidor_substituto, | |
692 | + $this->ref_cod_servidor, $this->ref_ref_cod_instituicao, $this->ref_cod_escola, | |
693 | + $this->carga_horaria, $this->periodo); | |
694 | + | |
695 | + $db = new clsBanco(); | |
696 | + $db->Consulta($sql); | |
697 | + | |
698 | + return TRUE; | |
699 | + } | |
700 | + | |
701 | + return FALSE; | |
702 | + } | |
702 | 703 | |
703 | 704 | |
704 | - //$this->ativo = 0; | |
705 | - // return $this->edita(); | |
706 | - } | |
707 | - return false; | |
708 | - } | |
709 | 705 | |
710 | 706 | /** |
711 | 707 | * Define quais campos da tabela serao selecionados na invocacao do metodo lista | ... | ... |
ieducar/tests/functional/ServidorAfastarWebTest.class.php
... | ... | @@ -52,59 +52,56 @@ class ServidorAfastarWebTest extends FunctionalBaseTest { |
52 | 52 | $db = new clsBanco(); |
53 | 53 | |
54 | 54 | // Cria uma nova pessoa e guarda o ID gerado |
55 | - $db->Consulta(sprintf("INSERT INTO cadastro.pessoa (nome, data_cad,tipo,situacao,origem_gravacao, idsis_cad, operacao , idpes_cad) VALUES ('%s', NOW(), 'F', 'P', 'U', 17, 'I' , '1')", $this->slPessoaNome)); | |
55 | + $db->Consulta(sprintf("INSERT INTO cadastro.pessoa (nome, data_cad,tipo,situacao,origem_gravacao, idsis_cad, operacao , idpes_cad) VALUES ('%s', NOW(), 'F', 'P', 'U', 17, 'I' , '1')", $this->slPessoaNome)); | |
56 | 56 | $this->slPessoaID = $id = $db->InsertId('cadastro.seq_pessoa'); |
57 | 57 | |
58 | + // Array de SQL | |
59 | + $sqls = array(); | |
60 | + | |
61 | + // Array com sequences, usados para o INSERTs que necessitem, | |
62 | + // use chamando array_shift($sequences) | |
63 | + $sequences = range(50000, 100000); | |
58 | 64 | |
59 | 65 | // Cria pessoa física |
60 | - $db->Consulta(sprintf("INSERT INTO cadastro.fisica (idpes, origem_gravacao, idsis_cad, data_cad, operacao, idpes_cad , sexo) VALUES ( '%d', 'M', 17, NOW(), 'I', '1' , 'M')", $id)); | |
66 | + $sqls[] = sprintf("INSERT INTO cadastro.fisica (idpes, origem_gravacao, idsis_cad, data_cad, operacao, idpes_cad , sexo) VALUES ( '%d', 'M', 17, NOW(), 'I', '1' , 'M')", $id); | |
61 | 67 | |
62 | 68 | // Cria novo funcionário no sistema |
63 | - $db->Consulta( | |
64 | - sprintf( | |
65 | - "INSERT INTO portal.funcionario | |
66 | - (ref_cod_pessoa_fj, matricula, senha, ativo, ramal, ref_cod_funcionario_vinculo, tempo_expira_senha, tempo_expira_conta, data_troca_senha, data_reativa_conta, ref_ref_cod_pessoa_fj, proibido, ref_cod_setor_new, matricula_permanente) | |
67 | - VALUES | |
68 | - ('%d', '%s', '25d55ad283aa400af464c76d713c07ad', '1', '', '4', '30', '365', NOW(), NOW(), '28', '0', '1', '1')", $id, $this->slPessoaMatricula) | |
69 | - ); | |
70 | - | |
69 | + $sqls[] = sprintf( | |
70 | + "INSERT INTO portal.funcionario | |
71 | + (ref_cod_pessoa_fj, matricula, senha, ativo, ramal, ref_cod_funcionario_vinculo, tempo_expira_senha, tempo_expira_conta, data_troca_senha, data_reativa_conta, ref_ref_cod_pessoa_fj, proibido, ref_cod_setor_new, matricula_permanente) | |
72 | + VALUES | |
73 | + ('%d', '%s', '25d55ad283aa400af464c76d713c07ad', '1', '', '4', '30', '365', NOW(), NOW(), '28', '0', '1', '1')", $id, $this->slPessoaMatricula); | |
71 | 74 | |
72 | 75 | // Cria um novo servidor, com a função de professor |
73 | - $sql = sprintf("INSERT INTO pmieducar.servidor (cod_servidor, ref_idesco, carga_horaria, data_cadastro, ativo, ref_cod_instituicao ) VALUES( '%d', '14', '40', NOW(), '1', '2' )", $id); | |
74 | - $db->Consulta($sql); | |
75 | - | |
76 | - $sql = sprintf("INSERT INTO pmieducar.servidor_funcao (ref_ref_cod_instituicao, ref_cod_servidor, ref_cod_funcao ) VALUES( '2', '%d', '2')", $id); | |
77 | - $db->Consulta($sql); | |
76 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor (cod_servidor, ref_idesco, carga_horaria, data_cadastro, ativo, ref_cod_instituicao ) VALUES( '%d', '14', '40', NOW(), '1', '2' )", $id); | |
77 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_funcao (ref_ref_cod_instituicao, ref_cod_servidor, ref_cod_funcao ) VALUES( '2', '%d', '2')", $id); | |
78 | 78 | |
79 | 79 | |
80 | 80 | // Atribue disciplinas ao servidor e o curso em que ministra |
81 | - $sql = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('6', '2', '%d')", $id); | |
82 | - $db->Consulta($sql); | |
83 | - $sql = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('3', '2', '%d')", $id); | |
84 | - $db->Consulta($sql); | |
85 | - $sql = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('4', '2', '%d')", $id); | |
86 | - $db->Consulta($sql); | |
87 | - | |
88 | - $sql = sprintf("INSERT INTO pmieducar.servidor_curso_ministra (ref_cod_curso, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('1', '2', '%d')", $id); | |
89 | - $db->Consulta($sql); | |
81 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('6', '2', '%d')", $id); | |
82 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('3', '2', '%d')", $id); | |
83 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_disciplina (ref_cod_disciplina, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('4', '2', '%d')", $id); | |
84 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_curso_ministra (ref_cod_curso, ref_ref_cod_instituicao, ref_cod_servidor) VALUES('1', '2', '%d')", $id); | |
90 | 85 | |
91 | 86 | |
92 | 87 | // Aloca tempo de trabalho para o servidor |
93 | - $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '1', '%d', '10:00', '1', NOW(), '1')", $id); | |
94 | - $db->Consulta($sql); | |
95 | - $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '1', '%d', '06:00', '2', NOW(), '1')", $id); | |
96 | - $db->Consulta($sql); | |
97 | - $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '2', '%d', '14:00', '1', NOW(), '1')", $id); | |
98 | - $db->Consulta($sql); | |
99 | - $sql = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '2', '%d', '05:00', '2', NOW(), '1')", $id); | |
100 | - $db->Consulta($sql); | |
88 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '1', '%d', '10:00', '1', NOW(), '1')", $id); | |
89 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '1', '%d', '06:00', '2', NOW(), '1')", $id); | |
90 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '2', '%d', '14:00', '1', NOW(), '1')", $id); | |
91 | + $sqls[] = sprintf("INSERT INTO pmieducar.servidor_alocacao (ref_ref_cod_instituicao, ref_usuario_cad, ref_cod_escola, ref_cod_servidor, carga_horaria, periodo, data_cadastro, ativo ) VALUES( '2', '28', '2', '%d', '05:00', '2', NOW(), '1')", $id); | |
101 | 92 | |
102 | 93 | // Aloca horas aula ao servidor |
103 | - $sql = sprintf("INSERT INTO pmieducar.quadro_horario_horarios ( ref_cod_quadro_horario, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, sequencial, ref_cod_instituicao_servidor, ref_servidor, hora_inicial, hora_final, data_cadastro, ativo, dia_semana ) VALUES( '2', '2', '1', '6', '3', '2', '%d', '09:00', '10:00', NOW(), '1', '3')", $id); | |
104 | - $db->Consulta($sql); | |
94 | + $sqls[] = sprintf("INSERT INTO pmieducar.quadro_horario_horarios (ref_cod_quadro_horario, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, sequencial, ref_cod_instituicao_servidor, ref_servidor, hora_inicial, hora_final, data_cadastro, ativo, dia_semana ) VALUES('2', '2', '1', '6', '%d', '2', '%d', '09:00', '10:00', NOW(), '1', '3')", array_shift($sequences), $id); | |
95 | + $sqls[] = sprintf("INSERT INTO pmieducar.quadro_horario_horarios (ref_cod_quadro_horario, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, sequencial, ref_cod_instituicao_servidor, ref_servidor, hora_inicial, hora_final, data_cadastro, ativo, dia_semana ) VALUES('2', '2', '1', '3', '%d', '2', '%d', '08:00', '09:00', NOW(), '1', '5')", array_shift($sequences), $id); | |
105 | 96 | |
106 | - $sql = sprintf("INSERT INTO pmieducar.quadro_horario_horarios ( ref_cod_quadro_horario, ref_cod_serie, ref_cod_escola, ref_cod_disciplina, sequencial, ref_cod_instituicao_servidor, ref_servidor, hora_inicial, hora_final, data_cadastro, ativo, dia_semana ) VALUES( '2', '2', '1', '3', '4', '2', '%d', '08:00', '09:00', NOW(), '1', '5' )", $id); | |
107 | - $db->Consulta($sql); | |
97 | + // Executa as SQLs, se houver erro, chama tearDown imediatamente | |
98 | + foreach ($sqls as $sql) { | |
99 | + $success = $db->Consulta($sql); | |
100 | + if (FALSE === $success) { | |
101 | + $this->tearDown(); | |
102 | + $this->fail('Alguma restrição de SQL aconteceu e o método tearDown foi executado para limpar as tabelas. SQL com problema: %s', PHP_EOL, $sql); | |
103 | + } | |
104 | + } | |
108 | 105 | } |
109 | 106 | |
110 | 107 | ... | ... |
ieducar/tests/unit/ClsPmieducarQuadroHorarioHorariosTest.class.php
0 → 100644
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php | |
2 | + | |
3 | +/* | |
4 | + * i-Educar - Sistema de gestão escolar | |
5 | + * | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | + * | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
13 | + * | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
18 | + * | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
22 | + */ | |
23 | + | |
24 | +/** | |
25 | + * ClsPmieducarQuadroHorarioHorariosTest class | |
26 | + * | |
27 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
28 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
29 | + * @package Test | |
30 | + * @since Classe disponível desde a versão 1.0.2 | |
31 | + * @version $Id$ | |
32 | + */ | |
33 | + | |
34 | +require_once realpath(dirname(__FILE__) . '/../') . '/UnitBaseTest.class.php'; | |
35 | +require_once 'include/pmieducar/clsPmieducarQuadroHorarioHorarios.inc.php'; | |
36 | + | |
37 | +class ClsPmieducarQuadroHorarioHorariosTest extends UnitBaseTest { | |
38 | + | |
39 | + /** | |
40 | + * Testa o método substituir_servidor() | |
41 | + */ | |
42 | + public function testSubstituirServidor() { | |
43 | + $stub = $this->getMock('clsPmieducarQuadroHorarioHorarios'); | |
44 | + | |
45 | + $stub->expects($this->any()) | |
46 | + ->method('substituir_servidor') | |
47 | + ->will($this->returnValue(TRUE)); | |
48 | + | |
49 | + $this->assertTrue($stub->substituir_servidor(1)); | |
50 | + } | |
51 | + | |
52 | +} | |
0 | 53 | \ No newline at end of file | ... | ... |
ieducar/tests/unit/ClsPmieducarServidorAlocacaoTest.class.php
0 → 100644
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php | |
2 | + | |
3 | +/* | |
4 | + * i-Educar - Sistema de gestão escolar | |
5 | + * | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | + * | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
13 | + * | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
18 | + * | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
22 | + */ | |
23 | + | |
24 | +/** | |
25 | + * ClsPmieducarServidorAlocacaoTest class | |
26 | + * | |
27 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
28 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
29 | + * @package Test | |
30 | + * @since Classe disponível desde a versão 1.0.2 | |
31 | + * @version $Id$ | |
32 | + */ | |
33 | + | |
34 | +require_once realpath(dirname(__FILE__) . '/../') . '/UnitBaseTest.class.php'; | |
35 | +require_once 'include/pmieducar/clsPmieducarServidorAlocacao.inc.php'; | |
36 | + | |
37 | +class ClsPmieducarServidorAlocacaoTest extends UnitBaseTest { | |
38 | + | |
39 | + /** | |
40 | + * Testa o método substituir_servidor() | |
41 | + */ | |
42 | + public function testSubstituirServidor() { | |
43 | + $stub = $this->getMock('clsPmieducarServidorAlocacao'); | |
44 | + | |
45 | + $stub->expects($this->any()) | |
46 | + ->method('substituir_servidor') | |
47 | + ->will($this->returnValue(TRUE)); | |
48 | + | |
49 | + $this->assertTrue($stub->substituir_servidor(1)); | |
50 | + } | |
51 | + | |
52 | +} | |
0 | 53 | \ No newline at end of file | ... | ... |
ieducar/tests/unit/ClsPmieducarServidorTest.class.php
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | */ |
23 | 23 | |
24 | 24 | /** |
25 | - * ClsPmieducarServidorTest class. | |
25 | + * ClsPmieducarServidorTest class | |
26 | 26 | * |
27 | 27 | * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> |
28 | 28 | * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL |
... | ... | @@ -40,6 +40,10 @@ class ClsPmieducarServidorTest extends UnitBaseTest { |
40 | 40 | $codServidor = NULL, |
41 | 41 | $codInstituicao = NULL; |
42 | 42 | |
43 | + /** | |
44 | + * @todo Testes dependentes de dados existentes. Refatorar o teste para usar | |
45 | + * mock objects ou dbunit | |
46 | + */ | |
43 | 47 | protected function setUp() { |
44 | 48 | $db = new clsBanco(); |
45 | 49 | $sql = 'SELECT cod_servidor, ref_cod_instituicao FROM pmieducar.servidor WHERE ativo = 1 LIMIT 1'; |
... | ... | @@ -49,6 +53,10 @@ class ClsPmieducarServidorTest extends UnitBaseTest { |
49 | 53 | list($this->codServidor, $this->codInstituicao) = $db->Tupla(); |
50 | 54 | } |
51 | 55 | |
56 | + | |
57 | + /** | |
58 | + * Testa se o servidor criado no método setUp() existe | |
59 | + */ | |
52 | 60 | public function testPmieducarServidorExists() { |
53 | 61 | $codServidor = $this->codServidor; |
54 | 62 | $codInstituicao = $this->codInstituicao; |
... | ... | @@ -59,4 +67,65 @@ class ClsPmieducarServidorTest extends UnitBaseTest { |
59 | 67 | $this->assertTrue((boolean) $servidor->existe()); |
60 | 68 | } |
61 | 69 | |
70 | + | |
71 | + /** | |
72 | + * Testa o método getServidorFuncoes() da classe | |
73 | + */ | |
74 | + public function testGetServidorFuncoes() { | |
75 | + $codServidor = $this->codServidor; | |
76 | + $codInstituicao = $this->codInstituicao; | |
77 | + | |
78 | + $servidor = new clsPmieducarServidor( | |
79 | + $codServidor, NULL, NULL, NULL, NULL, NULL, 1, $codInstituicao); | |
80 | + | |
81 | + $funcoes = $servidor->getServidorFuncoes(); | |
82 | + $this->assertTrue(is_array($funcoes)); | |
83 | + } | |
84 | + | |
85 | + | |
86 | + /** | |
87 | + * Testa o método isProfessor() | |
88 | + */ | |
89 | + public function testIsProfessor() { | |
90 | + $codServidor = $this->codServidor; | |
91 | + $codInstituicao = $this->codInstituicao; | |
92 | + | |
93 | + $servidor = new clsPmieducarServidor( | |
94 | + $codServidor, NULL, NULL, NULL, NULL, NULL, 1, $codInstituicao); | |
95 | + | |
96 | + $professor = $servidor->isProfessor(); | |
97 | + | |
98 | + $this->assertTrue($professor); | |
99 | + } | |
100 | + | |
101 | + | |
102 | + /** | |
103 | + * Stub test para o método getServidorDisciplinasQuadroHorarioHorarios() | |
104 | + */ | |
105 | + public function testGetServidorDisciplinasQuadroHorarioHorarios() { | |
106 | + $stub = $this->getMock('clsPmieducarServidor'); | |
107 | + | |
108 | + $stub->expects($this->any()) | |
109 | + ->method('getServidorDisciplinasQuadroHorarioHorarios') | |
110 | + ->will($this->returnValue(array(2, 6))); | |
111 | + | |
112 | + $this->assertEquals(array(2, 6), | |
113 | + $stub->getServidorDisciplinasQuadroHorarioHorarios(62, 2)); | |
114 | + } | |
115 | + | |
116 | + | |
117 | + /** | |
118 | + * Stub test para o método getServidorDisciplinas() | |
119 | + */ | |
120 | + public function testGetServidorDisciplinas() { | |
121 | + $stub = $this->getMock('clsPmieducarServidor'); | |
122 | + | |
123 | + $stub->expects($this->any()) | |
124 | + ->method('getServidorDisciplinas') | |
125 | + ->will($this->returnValue(array(6))); | |
126 | + | |
127 | + $this->assertEquals(array(6), | |
128 | + $stub->getServidorDisciplinas(57, 2)); | |
129 | + } | |
130 | + | |
62 | 131 | } |
63 | 132 | \ No newline at end of file | ... | ... |