Commit efd9248527b82859892e8553da916cce86f6a557
1 parent
e94353e5
Exists in
master
Adicionado módulo Calendário:
* Formulário de dia de calendário agora inclui quais turmas serão afetadas pelo dia letivo extra ou dia não letivo * Relatório de frequência escolar foi atualizado para não contabilizar como dia letivo uma turma que esteja marcada em um dia não letivo * Refactoring consideravelmente complicado, código confusíssimo! * Novo método em {{{App_Model_IedFinder}}}: {{{getTurmas()}}} * Novo arquivo javascript: {{{ied/forms.js}}}, com um Clojure com métodos de manipulação de formulários * Arquivo do {{{PHPJS}}} foi renomeado para {{{ied/phpjs.js}}}
Showing
17 changed files
with
909 additions
and
257 deletions
Show diff stats
ieducar/intranet/educar_calendario_ano_letivo_lst.php
... | ... | @@ -34,6 +34,9 @@ require_once 'include/clsBanco.inc.php'; |
34 | 34 | require_once 'include/pmieducar/geral.inc.php'; |
35 | 35 | require_once 'clsCalendario.inc.php'; |
36 | 36 | |
37 | +require_once 'Calendario/Model/TurmaDataMapper.php'; | |
38 | +require_once 'App/Model/IedFinder.php'; | |
39 | + | |
37 | 40 | /** |
38 | 41 | * clsIndexBase class. |
39 | 42 | * |
... | ... | @@ -246,6 +249,12 @@ class indice extends clsConfig |
246 | 249 | $inicio_ano = explode('/', dataFromPgToBr($inicio_ano)); |
247 | 250 | $fim_ano = explode('/', dataFromPgToBr($fim_ano)); |
248 | 251 | |
252 | + // Turmas da escola | |
253 | + $turmas = App_Model_IedFinder::getTurmas($registro['ref_cod_escola']); | |
254 | + | |
255 | + // Mapper de Calendario_Model_TurmaDataMapper | |
256 | + $calendarioTurmaMapper = new Calendario_Model_TurmaDataMapper(); | |
257 | + | |
249 | 258 | $obj_calendario = new clsCalendario(); |
250 | 259 | $obj_calendario->setLargura(600); |
251 | 260 | $obj_calendario->permite_trocar_ano = TRUE; |
... | ... | @@ -292,9 +301,31 @@ class indice extends clsConfig |
292 | 301 | $tipo = strtoupper($det_motivo['tipo']) == 'E' ? |
293 | 302 | 'Dia Extra-Letivo' : 'Dia Não Letivo'; |
294 | 303 | |
304 | + // Busca pelas turmas que estão marcadas para esse dia | |
305 | + $args = array( | |
306 | + 'calendarioAnoLetivo' => $registro['cod_calendario_ano_letivo'], | |
307 | + 'mes' => $dia['mes'], | |
308 | + 'dia' => $dia['dia'], | |
309 | + 'ano' => $this->ano | |
310 | + ); | |
311 | + | |
312 | + $calendarioTurmas = $calendarioTurmaMapper->findAll(array(), $args); | |
313 | + | |
314 | + $nomeTurmas = array(); | |
315 | + foreach ($calendarioTurmas as $calendarioTurma) { | |
316 | + $nomeTurmas[] = $turmas[$calendarioTurma->turma]; | |
317 | + } | |
318 | + | |
319 | + if (0 == count($nomeTurmas)) { | |
320 | + $calendarioTurmas = ''; | |
321 | + } | |
322 | + else { | |
323 | + $calendarioTurmas = 'Turmas: <ul><li>' . implode('</li><li>', $nomeTurmas) . '</li></ul>'; | |
324 | + } | |
325 | + | |
295 | 326 | $descricao = sprintf( |
296 | - '<div style="z-index: 0;">%s</div><div align="left" style="z-index: 0;">Motivo: %s<br />Descrição: %s</div>%s', | |
297 | - $tipo, $det_motivo['nm_motivo'], $dia['descricao'], $botao_editar | |
327 | + '<div style="z-index: 0;">%s</div><div align="left" style="z-index: 0;">Motivo: %s<br />Descrição: %s<br />%s</div>%s', | |
328 | + $tipo, $det_motivo['nm_motivo'], $dia['descricao'], $calendarioTurmas, $botao_editar | |
298 | 329 | ); |
299 | 330 | |
300 | 331 | $array_descricao[$dia['dia']] = $descricao; |
... | ... | @@ -306,16 +337,9 @@ class indice extends clsConfig |
306 | 337 | elseif (strtoupper($det_motivo['tipo']) == 'N') { |
307 | 338 | $obj_calendario->adicionarLegenda('Não Letivo', '#VERDE_ESCURO'); |
308 | 339 | $obj_calendario->adicionarArrayDias('Não Letivo', array($dia['dia'])); |
309 | - | |
310 | - $descricao = sprintf( | |
311 | - '<div style="z-index: 0;">Descrição: %s</div>%s', | |
312 | - $dia['descricao'], $botao_editar | |
313 | - ); | |
314 | - | |
315 | - $array_descricao[$dia['dia']] = $descricao; | |
316 | - | |
317 | - $obj_calendario->diaDescricao($array_dias, $array_descricao); | |
318 | 340 | } |
341 | + | |
342 | + $obj_calendario->diaDescricao($array_dias, $array_descricao); | |
319 | 343 | } |
320 | 344 | elseif ($dia['descricao']) { |
321 | 345 | $array_dias[$dia['dia']] = $dia['dia']; | ... | ... |
ieducar/intranet/educar_calendario_dia_cad.php
... | ... | @@ -33,6 +33,9 @@ require_once 'include/clsCadastro.inc.php'; |
33 | 33 | require_once 'include/clsBanco.inc.php'; |
34 | 34 | require_once 'include/pmieducar/geral.inc.php'; |
35 | 35 | |
36 | +require_once 'App/Model/IedFinder.php'; | |
37 | +require_once 'Calendario/Model/TurmaDataMapper.php'; | |
38 | + | |
36 | 39 | /** |
37 | 40 | * clsIndexBase class. |
38 | 41 | * |
... | ... | @@ -79,6 +82,85 @@ class indice extends clsCadastro |
79 | 82 | var $ano; |
80 | 83 | var $ref_cod_escola; |
81 | 84 | |
85 | + /** | |
86 | + * @var Calendario_Model_TurmaDataMapper | |
87 | + */ | |
88 | + var $_calendarioTurmaDataMapper = NULL; | |
89 | + | |
90 | + /** | |
91 | + * Getter. | |
92 | + * @access protected | |
93 | + * @return Calendario_Model_TurmaDataMapper | |
94 | + */ | |
95 | + function _getCalendarioTurmaDataMapper() | |
96 | + { | |
97 | + if (is_null($this->_calendarioTurmaDataMapper)) { | |
98 | + $this->_calendarioTurmaDataMapper = new Calendario_Model_TurmaDataMapper(); | |
99 | + } | |
100 | + return $this->_calendarioTurmaDataMapper; | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * Verifica se existe uma instância de Calendario_Model_Turma. | |
105 | + * | |
106 | + * @access protected | |
107 | + * @param int $codCalendarioAnoLetivo Código da chave primária pmieducar.calendario_ano_letivo | |
108 | + * @param int $mes | |
109 | + * @param int $dia | |
110 | + * @param int $ano | |
111 | + * @param int $codTurma Código da chave primária de pmieducar.turma | |
112 | + * @return bool | |
113 | + */ | |
114 | + function _hasEntry($codCalendarioAnoLetivo, $mes, $dia, $ano, $codTurma) | |
115 | + { | |
116 | + $args = array( | |
117 | + 'calendarioAnoLetivo' => $codCalendarioAnoLetivo, | |
118 | + 'mes' => $mes, | |
119 | + 'dia' => $dia, | |
120 | + 'ano' => $ano, | |
121 | + 'turma' => $codTurma | |
122 | + ); | |
123 | + | |
124 | + try { | |
125 | + $this->_getCalendarioTurmaDataMapper()->find($args); | |
126 | + return TRUE; | |
127 | + } | |
128 | + catch (Exception $e) { | |
129 | + } | |
130 | + | |
131 | + return FALSE; | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * Retorna um array de instâncias de Calendario_Model_Turma para um dado | |
136 | + * calendário de ano letivo de escola em mês, dia e ano específicos. | |
137 | + * | |
138 | + * @access protected | |
139 | + * @param int $codCalendarioAnoLetivo Código de pmieducar.calendario_ano_letivo | |
140 | + * @param int $mes | |
141 | + * @param int $dia | |
142 | + * @param int $ano | |
143 | + * @return array (cod_turma => Calendario_Model_Turma) | |
144 | + */ | |
145 | + function _getEntries($codCalendarioAnoLetivo, $mes, $dia, $ano) | |
146 | + { | |
147 | + $where = array( | |
148 | + 'calendarioAnoLetivo' => $codCalendarioAnoLetivo, | |
149 | + 'mes' => $mes, | |
150 | + 'dia' => $dia, | |
151 | + 'ano' => $ano | |
152 | + ); | |
153 | + | |
154 | + $turmas = $this->_getCalendarioTurmaDataMapper()->findAll(array(), $where); | |
155 | + | |
156 | + $ret = array(); | |
157 | + foreach ($turmas as $turma) { | |
158 | + $ret[$turma->turma] = $turma; | |
159 | + } | |
160 | + | |
161 | + return $ret; | |
162 | + } | |
163 | + | |
82 | 164 | function Inicializar() |
83 | 165 | { |
84 | 166 | $retorno = 'Novo'; |
... | ... | @@ -168,27 +250,33 @@ class indice extends clsCadastro |
168 | 250 | |
169 | 251 | // Foreign keys |
170 | 252 | $opcoes = array('' => 'Selecione'); |
171 | - if (class_exists('clsPmieducarCalendarioDiaMotivo')) { | |
172 | - $objTemp = new clsPmieducarCalendarioDiaMotivo(); | |
173 | - $lista = $objTemp->lista(NULL, $ref_cod_escola, NULL, NULL, NULL, NULL, | |
174 | - NULL, NULL, NULL, NULL, NULL, 1 | |
175 | - ); | |
253 | + $objTemp = new clsPmieducarCalendarioDiaMotivo(); | |
254 | + $lista = $objTemp->lista(NULL, $ref_cod_escola, NULL, NULL, NULL, NULL, | |
255 | + NULL, NULL, NULL, NULL, NULL, 1 | |
256 | + ); | |
176 | 257 | |
177 | - if (is_array($lista) && count($lista)) { | |
178 | - foreach ($lista as $registro) { | |
179 | - $opcoes[$registro['cod_calendario_dia_motivo']] = $registro['nm_motivo']; | |
180 | - } | |
258 | + if (is_array($lista) && count($lista)) { | |
259 | + foreach ($lista as $registro) { | |
260 | + $opcoes[$registro['cod_calendario_dia_motivo']] = $registro['nm_motivo']; | |
181 | 261 | } |
182 | 262 | } |
183 | - else { | |
184 | - $opcoes = array('' => 'Erro na geracao'); | |
185 | - } | |
186 | 263 | |
187 | 264 | $this->campoLista( |
188 | 265 | 'ref_cod_calendario_dia_motivo', 'Calendário Dia Motivo', $opcoes, |
189 | 266 | $this->ref_cod_calendario_dia_motivo, '', FALSE, '', '', FALSE, FALSE |
190 | 267 | ); |
191 | 268 | |
269 | + $seletor = '<label><input id="_turmas_sel" onclick="new ied_forms.checkAll(document, \'formcadastro\', \'turmas\')" type="checkbox" /> Selecionar todas</label>'; | |
270 | + $this->campoRotulo('turmas_rotulo', 'Turmas', $seletor); | |
271 | + $turmas = App_Model_IedFinder::getTurmas($ref_cod_escola); | |
272 | + | |
273 | + foreach ($turmas as $codTurma => $nomeTurma) { | |
274 | + $checked = $this->_hasEntry($this->ref_cod_calendario_ano_letivo, | |
275 | + $this->mes, $this->dia, $this->ano, $codTurma); | |
276 | + | |
277 | + $this->campoCheck('turmas[' . $codTurma . ']', '', $checked, $nomeTurma, FALSE); | |
278 | + } | |
279 | + | |
192 | 280 | $this->campoMemo('descricao', 'Descrição', $this->descricao, 30, 10, TRUE); |
193 | 281 | } |
194 | 282 | |
... | ... | @@ -210,6 +298,17 @@ class indice extends clsCadastro |
210 | 298 | |
211 | 299 | $cadastrou = $obj->cadastra(); |
212 | 300 | |
301 | + foreach ($this->turmas as $codTurma => $turma) { | |
302 | + $calendarioTurma = new Calendario_Model_Turma(array( | |
303 | + 'calendarioAnoLetivo' => $this->ref_cod_calendario_ano_letivo, | |
304 | + 'ano' => $this->ano, | |
305 | + 'mes' => $this->mes, | |
306 | + 'dia' => $this->dia, | |
307 | + 'turma' => $codTurma | |
308 | + )); | |
309 | + $this->_getCalendarioTurmaDataMapper()->save($calendarioTurma); | |
310 | + } | |
311 | + | |
213 | 312 | if ($cadastrou) { |
214 | 313 | $this->mensagem .= 'Cadastro efetuado com sucesso. <br />'; |
215 | 314 | $url = sprintf( |
... | ... | @@ -237,11 +336,48 @@ class indice extends clsCadastro |
237 | 336 | $obj = new clsPmieducarCalendarioDia( |
238 | 337 | $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, |
239 | 338 | $this->pessoa_logada, $this->pessoa_logada, $this->ref_cod_calendario_dia_motivo, |
240 | - $this->descricao, $this->data_cadastro, $this->data_exclusao, $this->ativo | |
339 | + $this->descricao, $this->data_cadastro, $this->data_exclusao, 1 | |
241 | 340 | ); |
242 | 341 | |
243 | 342 | $editou = $obj->edita(); |
244 | 343 | |
344 | + // Inicialização de arrays | |
345 | + $insert = $delete = $entries = $intersect = array(); | |
346 | + | |
347 | + if (isset($this->turmas)) { | |
348 | + foreach ($this->turmas as $codTurma => $turma) { | |
349 | + $calendarioTurma = new Calendario_Model_Turma(array( | |
350 | + 'calendarioAnoLetivo' => $this->ref_cod_calendario_ano_letivo, | |
351 | + 'ano' => $this->ano, | |
352 | + 'mes' => $this->mes, | |
353 | + 'dia' => $this->dia, | |
354 | + 'turma' => $codTurma | |
355 | + )); | |
356 | + $insert[$codTurma] = $calendarioTurma; | |
357 | + } | |
358 | + } | |
359 | + | |
360 | + // Instâncias persistidas de Calendario_Model_Turma | |
361 | + $entries = $this->_getEntries($this->ref_cod_calendario_ano_letivo, | |
362 | + $this->mes, $this->dia, $this->ano); | |
363 | + | |
364 | + // Instâncias para apagar | |
365 | + $delete = array_diff(array_keys($entries), array_keys($insert)); | |
366 | + | |
367 | + // Instâncias já persistidas | |
368 | + $intersect = array_intersect(array_keys($entries), array_keys($insert)); | |
369 | + | |
370 | + foreach ($delete as $id) { | |
371 | + $this->_getCalendarioTurmaDataMapper()->delete($entries[$id]); | |
372 | + } | |
373 | + | |
374 | + foreach ($insert as $key => $entry) { | |
375 | + if (in_array($key, $intersect)) { | |
376 | + continue; | |
377 | + } | |
378 | + $this->_getCalendarioTurmaDataMapper()->save($entry); | |
379 | + } | |
380 | + | |
245 | 381 | if ($editou) { |
246 | 382 | $this->mensagem .= 'Edição efetuada com sucesso. <br />'; |
247 | 383 | $url = sprintf( |
... | ... | @@ -269,10 +405,19 @@ class indice extends clsCadastro |
269 | 405 | $obj = new clsPmieducarCalendarioDia( |
270 | 406 | $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, |
271 | 407 | $this->pessoa_logada, $this->pessoa_logada, NULL, NULL, |
272 | - $this->data_cadastro, $this->data_exclusao, 1 | |
408 | + $this->data_cadastro, $this->data_exclusao, 0 | |
273 | 409 | ); |
274 | 410 | |
275 | 411 | $excluiu = $obj->edita(); |
412 | + | |
413 | + $entries = $this->_getEntries( | |
414 | + $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, $this->ano | |
415 | + ); | |
416 | + | |
417 | + foreach ($entries as $entry) { | |
418 | + $this->_getCalendarioTurmaDataMapper()->delete($entry); | |
419 | + } | |
420 | + | |
276 | 421 | if ($excluiu) { |
277 | 422 | $this->mensagem .= 'Exclusão efetuada com sucesso. <br />'; |
278 | 423 | $url = sprintf( | ... | ... |
ieducar/intranet/educar_relatorio_diario_classe_avaliacao_proc.php
... | ... | @@ -189,7 +189,7 @@ class indice extends clsCadastro |
189 | 189 | return TRUE; |
190 | 190 | } |
191 | 191 | |
192 | - $titlo = 'Diário de Classe - ' . $this->ano; | |
192 | + $titulo = 'Diário de Classe - ' . $this->ano; | |
193 | 193 | |
194 | 194 | $prox_mes = $this->mes + 1; |
195 | 195 | $this->pdf = new clsPDF($titulo, $titulo, 'A4', '', FALSE, FALSE); | ... | ... |
ieducar/intranet/educar_relatorio_diario_classe_proc.php
... | ... | @@ -247,7 +247,9 @@ class indice extends clsCadastro |
247 | 247 | $dia = 1; |
248 | 248 | } |
249 | 249 | |
250 | - $total_semanas += $this->getNumeroDiasMes($dia, $mes, $this->ano, $mes_final); | |
250 | + $total_semanas += $this->getNumeroDiasMes($this->ref_cod_turma, $dia, $mes, | |
251 | + $this->ano, $mes_final); | |
252 | + $total_semanas += $ndm; | |
251 | 253 | } |
252 | 254 | |
253 | 255 | $this->pdf = new clsPDF('Diário de Classe - ' . $this->ano, |
... | ... | @@ -340,7 +342,7 @@ class indice extends clsCadastro |
340 | 342 | if (FALSE == $lista_quadro_horarios && TRUE == $this->temporario) { |
341 | 343 | $this->indefinido = TRUE; |
342 | 344 | |
343 | - $total_semanas = $coreExt['Config']->get( | |
345 | + $total_semanas = $coreExt['Config']->get( | |
344 | 346 | $coreExt['Config']->report->diario_classe->dias_temporarios, 30 |
345 | 347 | ); |
346 | 348 | } |
... | ... | @@ -361,7 +363,7 @@ class indice extends clsCadastro |
361 | 363 | } |
362 | 364 | |
363 | 365 | $total_semanas += $this->getDiasSemanaMes( |
364 | - $dia, $mes_, $this->ano, $dia_semana, $mes_final | |
366 | + $this->ref_cod_turma, $dia, $mes_, $this->ano, $dia_semana, $mes_final | |
365 | 367 | ); |
366 | 368 | } |
367 | 369 | } |
... | ... | @@ -681,8 +683,60 @@ class indice extends clsCadastro |
681 | 683 | $this->pdf->linha_relativa(660, 517, 130, 0); |
682 | 684 | } |
683 | 685 | |
684 | - function getNumeroDiasMes($dia, $mes, $ano, $mes_final = FALSE) | |
686 | + /** | |
687 | + * Retorna o número de dias de um mês a partir de certo dia descartando | |
688 | + * domingos, sábados e dias não letivos. | |
689 | + * | |
690 | + * @param int $codTurma | |
691 | + * @param int $dia | |
692 | + * @param int $mes | |
693 | + * @param int $ano | |
694 | + * @param bool $mes_final | |
695 | + * @return int | |
696 | + */ | |
697 | + function getNumeroDiasMes($codTurma, $dia, $mes, $ano, $mes_final = FALSE) | |
698 | + { | |
699 | + return $this->_getNumeroDias($codTurma, $dia, $mes, $ano, | |
700 | + array($this, '_counterNumeroDiaMes'), $mes_final); | |
701 | + } | |
702 | + | |
703 | + /** | |
704 | + * Retorna o número de dias de um mês contabilizando apenas o dia da semana | |
705 | + * (domingo, segunda, ... sábado) desejado, descartando dias não letivos | |
706 | + * enquanto a data do dia da semana não for maior que a data final do | |
707 | + * período definido pelo módulo escolhido. | |
708 | + * | |
709 | + * @param int $codTurma | |
710 | + * @param int $dia | |
711 | + * @param int $mes | |
712 | + * @param int $ano | |
713 | + * @param int $dia_semana | |
714 | + * @param bool $mes_final | |
715 | + * @return int | |
716 | + */ | |
717 | + function getDiasSemanaMes($codTurma, $dia, $mes, $ano, $dia_semana, | |
718 | + $mes_final = FALSE) | |
719 | + { | |
720 | + return $this->_getNumeroDias($codTurma, $dia, $mes, $ano, | |
721 | + array($this, '_counterDiasSemanaMes'), $mes_final, $dia_semana); | |
722 | + } | |
723 | + | |
724 | + /** | |
725 | + * @access protected | |
726 | + * @param int $codTurma | |
727 | + * @param int $dia | |
728 | + * @param int $mes | |
729 | + * @param int $ano | |
730 | + * @param array $counter | |
731 | + * @param int $dia_semana | |
732 | + * @param bool $mes_final | |
733 | + * @return int | |
734 | + */ | |
735 | + function _getNumeroDias($codTurma, $dia, $mes, $ano, $counter, | |
736 | + $mes_final = FALSE, $dia_semana = NULL) | |
685 | 737 | { |
738 | + static $calendarioTurmaMapper = NULL; | |
739 | + | |
686 | 740 | $year = $ano; |
687 | 741 | $month = $mes; |
688 | 742 | |
... | ... | @@ -693,24 +747,44 @@ class indice extends clsCadastro |
693 | 747 | |
694 | 748 | $last_day_of_month = date('d', $last_day_of_month); |
695 | 749 | |
696 | - $numero_dias = 0; | |
697 | - | |
698 | 750 | $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); |
699 | 751 | $obj_calendario->setCamposLista('cod_calendario_ano_letivo'); |
700 | - $lista = $obj_calendario->lista(NULL, $this->ref_cod_escola, NULL, NULL, | |
701 | - $this->ano, NULL, NULL, NULL, NULL, 1); | |
752 | + $lista_calendario = $obj_calendario->lista(NULL, $this->ref_cod_escola, | |
753 | + NULL, NULL, $this->ano, NULL, NULL, NULL, NULL, 1); | |
702 | 754 | |
703 | - if ($lista) { | |
704 | - $lista_calendario = array_shift($lista); | |
705 | - } | |
755 | + // Dias não letivos da turma | |
756 | + $diasNaoLetivosTurma = array(); | |
757 | + | |
758 | + if (is_array($lista_calendario)) { | |
759 | + $lista_calendario = array_shift($lista_calendario); | |
760 | + | |
761 | + $obj_dia = new clsPmieducarCalendarioDia(); | |
762 | + $obj_dia->setCamposLista('dia'); | |
763 | + $dias_nao_letivo = $obj_dia->lista($lista_calendario, $mes, NULL, NULL, | |
764 | + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, "'n'"); | |
765 | + | |
766 | + // Instancia o mapper apenas uma vez | |
767 | + if (is_null($calendarioTurmaMapper)) { | |
768 | + require_once 'Calendario/Model/TurmaDataMapper.php'; | |
769 | + $calendarioTurmaMapper = new Calendario_Model_TurmaDataMapper(); | |
770 | + } | |
706 | 771 | |
707 | - $obj_dia = new clsPmieducarCalendarioDia(); | |
708 | - $obj_dia->setCamposLista('dia'); | |
709 | - $dias_nao_letivo = $obj_dia->lista($lista_calendario, $mes, NULL, NULL, NULL, | |
710 | - NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, "'n'"); | |
772 | + // Carrega os dias do mês da turma | |
773 | + $where = array( | |
774 | + 'calendarioAnoLetivo' => $lista_calendario, | |
775 | + 'ano' => $ano, | |
776 | + 'mes' => $mes, | |
777 | + 'turma' => $codTurma | |
778 | + ); | |
779 | + | |
780 | + $diasTurma = $calendarioTurmaMapper->findAll(array(), $where); | |
711 | 781 | |
712 | - if (!$dias_nao_letivo) { | |
713 | - $dias_nao_letivo = array(); | |
782 | + // Separa apenas os dias da turma que forem não-letivos | |
783 | + foreach ($diasTurma as $diaTurma) { | |
784 | + if (in_array($diaTurma->dia, $dias_nao_letivo)) { | |
785 | + $diasNaoLetivosTurma[] = $diaTurma->dia; | |
786 | + } | |
787 | + } | |
714 | 788 | } |
715 | 789 | |
716 | 790 | if ($mes_final) { |
... | ... | @@ -718,12 +792,39 @@ class indice extends clsCadastro |
718 | 792 | $dia = 1; |
719 | 793 | } |
720 | 794 | |
795 | + // Argumentos para o callback $counter | |
796 | + $args = array( | |
797 | + 'dia' => $dia, | |
798 | + 'mes' => $mes, | |
799 | + 'ano' => $ano, | |
800 | + 'last_day_of_month' => $last_day_of_month, | |
801 | + 'diasNaoLetivosTurma' => $diasNaoLetivosTurma, | |
802 | + 'dia_semana' => $dia_semana | |
803 | + ); | |
804 | + | |
805 | + return call_user_func_array($counter, $args); | |
806 | + } | |
807 | + | |
808 | + /** | |
809 | + * @access protected | |
810 | + * @param int $dia | |
811 | + * @param int $mes | |
812 | + * @param int $ano | |
813 | + * @param int $last_day_of_month | |
814 | + * @param array $diasNaoLetivosTurma | |
815 | + * @return int | |
816 | + */ | |
817 | + function _counterNumeroDiaMes($dia, $mes, $ano, $last_day_of_month, | |
818 | + $diasNaoLetivosTurma) | |
819 | + { | |
820 | + $numero_dias = 0; | |
821 | + | |
721 | 822 | for ($day = $dia; $day <= $last_day_of_month; $day++) { |
722 | - $date = mktime(1, 1, 1, $month, $day, $year); | |
823 | + $date = mktime(1, 1, 1, $mes, $day, $ano); | |
723 | 824 | $dia_semana_corrente = getdate($date); |
724 | 825 | $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; |
725 | 826 | |
726 | - if (($dia_semana_corrente != 1 && $dia_semana_corrente != 7) && (array_search($day, $dias_nao_letivo) === FALSE)) { | |
827 | + if (($dia_semana_corrente != 1 && $dia_semana_corrente != 7) && !in_array($day, $diasNaoLetivosTurma)) { | |
727 | 828 | $numero_dias++; |
728 | 829 | } |
729 | 830 | } |
... | ... | @@ -731,53 +832,32 @@ class indice extends clsCadastro |
731 | 832 | return $numero_dias; |
732 | 833 | } |
733 | 834 | |
734 | - function getDiasSemanaMes($dia, $mes, $ano, $dia_semana, $mes_final = FALSE) | |
835 | + /** | |
836 | + * @access protected | |
837 | + * @param int $dia | |
838 | + * @param int $mes | |
839 | + * @param int $ano | |
840 | + * @param int $last_day_of_month | |
841 | + * @param array $diasNaoLetivosTurma | |
842 | + * @return int | |
843 | + */ | |
844 | + function _counterDiasSemanaMes($dia, $mes, $ano, $last_day_of_month, | |
845 | + $diasNaoLetivosTurma, $dia_semana) | |
735 | 846 | { |
736 | - $year = $ano; | |
737 | - $month = $mes; | |
738 | - | |
739 | - $date = mktime(1, 1, 1, $month, $dia, $year); | |
740 | - | |
741 | - $first_day_of_month = strtotime('-' . (date('d', $date) - 1) . ' days', $date); | |
742 | - $last_day_of_month = strtotime('+' . (date('t', $first_day_of_month) - 1) . ' days', $first_day_of_month); | |
743 | - | |
744 | - $last_day_of_month = date('d', $last_day_of_month); | |
745 | - | |
746 | 847 | $numero_dias = 0; |
747 | 848 | |
748 | - $obj_calendario = new clsPmieducarCalendarioAnoLetivo(); | |
749 | - $obj_calendario->setCamposLista('cod_calendario_ano_letivo'); | |
750 | - $lista_calendario = $obj_calendario->lista(NULL, $this->ref_cod_escola, NULL, | |
751 | - NULL, $this->ano, NULL, NULL, NULL, NULL, 1); | |
752 | - | |
753 | - if (is_array($lista_calendario)) { | |
754 | - $lista_calendario = array_shift($lista_calendario); | |
755 | - } | |
756 | - | |
757 | - $obj_dia = new clsPmieducarCalendarioDia(); | |
758 | - $obj_dia->setCamposLista('dia'); | |
759 | - $dias_nao_letivo = $obj_dia->lista($lista_calendario, $mes, NULL, NULL, NULL, | |
760 | - NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, "'n'"); | |
761 | - | |
762 | - if (!$dias_nao_letivo) { | |
763 | - $dias_nao_letivo = array(); | |
764 | - } | |
765 | - | |
766 | - if ($mes_final) { | |
767 | - $last_day_of_month = $dia; | |
768 | - $dia = 1; | |
769 | - } | |
770 | - | |
771 | 849 | for($day = $dia; $day <= $last_day_of_month; $day++) { |
772 | - $date = mktime(1, 1, 1, $month, $day, $year); | |
850 | + $date = mktime(1, 1, 1, $mes, $day, $ano); | |
773 | 851 | $dia_semana_corrente = getdate($date); |
774 | 852 | $dia_semana_corrente = $dia_semana_corrente['wday'] + 1; |
775 | 853 | |
776 | 854 | $data_atual = sprintf('%s/%s/%s', $day, $mes, $ano); |
777 | 855 | $data_final = sprintf('%s/%s', $this->data_fim, $ano); |
778 | 856 | |
779 | - if (($dia_semana == $dia_semana_corrente) && | |
780 | - (array_search($day, $dias_nao_letivo) === FALSE) && data_maior($data_final, $data_atual) | |
857 | + if ( | |
858 | + ($dia_semana == $dia_semana_corrente) && | |
859 | + !in_array($day, $diasNaoLetivosTurma) && | |
860 | + data_maior($data_final, $data_atual) | |
781 | 861 | ) { |
782 | 862 | $numero_dias++; |
783 | 863 | } | ... | ... |
... | ... | @@ -0,0 +1,61 @@ |
1 | +/** | |
2 | + * i-Educar - Sistema de gestão escolar | |
3 | + * | |
4 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
5 | + * <ctima@itajai.sc.gov.br> | |
6 | + * | |
7 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
8 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
9 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
10 | + * qualquer versão posterior. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
13 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
14 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
15 | + * do GNU para mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
18 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
19 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
20 | + * | |
21 | + * @author Eriksen Costa <eriksen.paixao_bs@cobra.com.br> | |
22 | + * @license @@license@@ | |
23 | + * @since Arquivo disponível desde a versão 2.0.0 | |
24 | + * @version $Id$ | |
25 | + */ | |
26 | + | |
27 | +/** | |
28 | + * Closure com funções utilitárias para o manuseamento de formulários. | |
29 | + */ | |
30 | +var ied_forms = new function() { | |
31 | + var checker = 0; | |
32 | + | |
33 | + /** | |
34 | + * Seleciona/deseleciona campos checkbox de um formulário. Cada chamada ao | |
35 | + * método executa uma ação de forma alternada: a primeira vez, altera a | |
36 | + * propriedade dos checkboxes para "checked", na segunda, remove a | |
37 | + * propriedade "checked" dos mesmos. Esse padrão segue nas chamadas | |
38 | + * subsequentes. | |
39 | + * | |
40 | + * @param document docObj | |
41 | + * @param string formId | |
42 | + * @param string fieldsName | |
43 | + */ | |
44 | + this.checkAll = function(docObj, formId, fieldsName) { | |
45 | + if (checker === 0) { | |
46 | + checker = 1; | |
47 | + } else { | |
48 | + checker = 0; | |
49 | + } | |
50 | + | |
51 | + var regex = new RegExp(fieldsName); | |
52 | + var form = docObj.getElementById(formId); | |
53 | + | |
54 | + for (var i = 0; i < form.elements.length; i++) { | |
55 | + var elementName = form.elements[i].name; | |
56 | + if (null !== elementName.match(regex)) { | |
57 | + form.elements[i].checked = checker == 1 ? true : false; | |
58 | + } | |
59 | + } | |
60 | + }; | |
61 | +}; | |
0 | 62 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,174 @@ |
1 | +/** | |
2 | + * i-Educar - Sistema de gestão escolar | |
3 | + * | |
4 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
5 | + * <ctima@itajai.sc.gov.br> | |
6 | + * | |
7 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
8 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
9 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
10 | + * qualquer versão posterior. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
13 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
14 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
15 | + * do GNU para mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
18 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
19 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
20 | + * | |
21 | + * Contém funções PHP portadas para o Javascript. | |
22 | + * | |
23 | + * Pacote PHPJS disponível em: | |
24 | + * <http://phpjs.org/packages/view/3063/name:933975c113578d0edd81fd2a76bcd480> | |
25 | + * | |
26 | + * Transliterado com iconv para ISO-8859-1. | |
27 | + * $ iconv -f UTF-8 -t ISO-8859-1//translit | |
28 | + * | |
29 | + * Contém as seguintes funções: | |
30 | + * - checkdate | |
31 | + * | |
32 | + * @author Eriksen Costa <eriksen.paixao_bs@cobra.com.br> | |
33 | + * @license @@license@@ | |
34 | + * @since Arquivo disponível desde a versão 2.0.0 | |
35 | + * @version $Id$ | |
36 | + */ | |
37 | + | |
38 | +/** | |
39 | + * Singleton para evitar múltipla instanciação de PHP_JS. Para obter o objeto, | |
40 | + * basta chamar o método getInstance(): | |
41 | + * | |
42 | + * <code> | |
43 | + * phpjs = ied_phpjs.getInstance() | |
44 | + * phpjs.PHP_JS_FUNCTION(args, ...); | |
45 | + * </code> | |
46 | + * | |
47 | + * @return PHP_JS | |
48 | + */ | |
49 | +var ied_phpjs = new function() { | |
50 | + var phpjs = new PHP_JS(); | |
51 | + this.getInstance = function() { | |
52 | + return phpjs; | |
53 | + } | |
54 | +} | |
55 | + | |
56 | + | |
57 | + /* | |
58 | + * More info at: http://phpjs.org | |
59 | + * | |
60 | + * This is version: 3.17 | |
61 | + * php.js is copyright 2010 Kevin van Zonneveld. | |
62 | + * | |
63 | + * Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld | |
64 | + * (http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White | |
65 | + * (http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jonas Raoni | |
66 | + * Soares Silva (http://www.jsfromhell.com), Jack, Philip Peterson, Legaev | |
67 | + * Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, | |
68 | + * lmeyrick (https://sourceforge.net/projects/bcmath-js/), Nate, Philippe | |
69 | + * Baumann, Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), | |
70 | + * Jani Hartikainen, Ash Searle (http://hexmen.com/blog/), travc, Ole | |
71 | + * Vrijenhoek, Carlos R. L. Rodrigues (http://www.jsfromhell.com), | |
72 | + * http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, | |
73 | + * Michael Grier, Johnny Mast (http://www.phpvrouwen.nl), stag019, Rafal | |
74 | + * Kukawski (http://blog.kukawski.pl), pilus, T.Wild, Andrea Giammarchi | |
75 | + * (http://webreflection.blogspot.com), WebDevHobo | |
76 | + * (http://webdevhobo.blogspot.com/), GeekFG (http://geekfg.blogspot.com), | |
77 | + * d3x, Erkekjetter, marrtins, Steve Hilder, Martin | |
78 | + * (http://www.erlenwiese.de/), Robin, Oleg Eremeev, mdsjack | |
79 | + * (http://www.mdsjack.bo.it), majak, Mailfaker (http://www.weedem.fr/), | |
80 | + * David, felix, Mirek Slugen, KELAN, Paul Smith, Marc Palau, Chris, Josh | |
81 | + * Fraser | |
82 | + * (http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), | |
83 | + * Breaking Par Consulting Inc | |
84 | + * (http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), | |
85 | + * Tim de Koning (http://www.kingsquare.nl), Arpad Ray (mailto:arpad@php.net), | |
86 | + * Public Domain (http://www.json.org/json2.js), Michael White, Steven | |
87 | + * Levithan (http://blog.stevenlevithan.com), Joris, gettimeofday, Sakimori, | |
88 | + * Alfonso Jimenez (http://www.alfonsojimenez.com), Aman Gupta, Caio Ariede | |
89 | + * (http://caioariede.com), AJ, Diplom@t (http://difane.com/), saulius, | |
90 | + * Pellentesque Malesuada, Thunder.m, Tyler Akins (http://rumkin.com), Felix | |
91 | + * Geisendoerfer (http://www.debuggable.com/felix), gorthaur, Imgen Tata | |
92 | + * (http://www.myipdf.com/), Karol Kowalski, Kankrelune | |
93 | + * (http://www.webfaktory.info/), Lars Fischer, Subhasis Deb, josh, Frank | |
94 | + * Forte, Douglas Crockford (http://javascript.crockford.com), Adam Wallner | |
95 | + * (http://web2.bitbaro.hu/), Marco, paulo kuong, madipta, Gilbert, duncan, | |
96 | + * ger, mktime, Oskar Larsson Högfeldt (http://oskar-lh.name/), Arno, Nathan, | |
97 | + * Mateusz "loonquawl" Zalega, ReverseSyntax, Francois, Scott Cariss, Slawomir | |
98 | + * Kaniecki, Denny Wardhana, sankai, 0m3r, noname, john | |
99 | + * (http://www.jd-tech.net), Nick Kolosov (http://sammy.ru), Sanjoy Roy, | |
100 | + * Shingo, nobbler, Fox, marc andreu, T. Wild, class_exists, Jon Hohle, | |
101 | + * Pyerre, JT, Thiago Mata (http://thiagomata.blog.com), Linuxworld, Ozh, | |
102 | + * nord_ua, lmeyrick (https://sourceforge.net/projects/bcmath-js/this.), | |
103 | + * Thomas Beaucourt (http://www.webapp.fr), David Randall, merabi, T0bsn, | |
104 | + * Soren Hansen, Peter-Paul Koch (http://www.quirksmode.org/js/beat.html), | |
105 | + * MeEtc (http://yass.meetcweb.com), Bryan Elliott, Tim Wiel, Brad Touesnard, | |
106 | + * XoraX (http://www.xorax.info), djmix, Hyam Singer | |
107 | + * (http://www.impact-computing.com/), Paul, J A R, kenneth, Raphael (Ao | |
108 | + * RUDLER), David James, Steve Clay, Ole Vrijenhoek (http://www.nervous.nl/), | |
109 | + * Marc Jansen, Francesco, Der Simon (http://innerdom.sourceforge.net/), echo | |
110 | + * is bad, Lincoln Ramsay, Eugene Bulkin (http://doubleaw.com/), JB, Bayron | |
111 | + * Guevara, Stoyan Kyosev (http://www.svest.org/), LH, Matt Bradley, date, | |
112 | + * Kristof Coomans (SCK-CEN Belgian Nucleair Research Centre), Pierre-Luc | |
113 | + * Paour, Martin Pool, Brant Messenger (http://www.brantmessenger.com/), Kirk | |
114 | + * Strobeck, Saulo Vallory, Christoph, Wagner B. Soares, Artur Tchernychev, | |
115 | + * Valentina De Rosa, Jason Wong (http://carrot.org/), Daniel Esteban, | |
116 | + * strftime, Rick Waldron, Mick@el, Anton Ongson, Simon Willison | |
117 | + * (http://simonwillison.net), Gabriel Paderni, Philipp Lenssen, Marco van | |
118 | + * Oort, Bug?, Blues (http://tech.bluesmoon.info/), Tomasz Wesolowski, rezna, | |
119 | + * Eric Nagel, Bobby Drake, Luke Godfrey, Pul, uestla, Alan C, Zahlii, Ulrich, | |
120 | + * Yves Sucaet, hitwork, sowberry, johnrembo, Brian Tafoya | |
121 | + * (http://www.premasolutions.com/), Nick Callen, Steven Levithan | |
122 | + * (stevenlevithan.com), ejsanders, Scott Baker, Philippe Jausions | |
123 | + * (http://pear.php.net/user/jausions), Aidan Lister | |
124 | + * (http://aidanlister.com/), Norman "zEh" Fuchs, Rob, HKM, ChaosNo1, metjay, | |
125 | + * strcasecmp, strcmp, Taras Bogach, jpfle, Alexander Ermolaev | |
126 | + * (http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, | |
127 | + * dptr1988, Le Torbi, Pedro Tainha (http://www.pedrotainha.com), James, | |
128 | + * penutbutterjelly, Christian Doebler, baris ozdil, Greg Frazier, Tod | |
129 | + * Gentille, Alexander M Beedie, Ryan W Tenney (http://ryan.10e.us), | |
130 | + * FGFEmperor, gabriel paderni, Atli Þór, Maximusya, daniel airton wermann | |
131 | + * (http://wermann.com.br), 3D-GRAF, Yannoo, jakes, Riddler | |
132 | + * (http://www.frontierwebdev.com/), T.J. Leahy, stensi, Matteo, Billy, vlado | |
133 | + * houba, Itsacon (http://www.itsacon.net/), Jalal Berrami, Victor, fearphage | |
134 | + * (http://http/my.opera.com/fearphage/), Luis Salazar | |
135 | + * (http://www.freaky-media.com/), FremyCompany, Tim de Koning, taith, Cord, | |
136 | + * Manish, davook, Benjamin Lupton, Garagoth, Andrej Pavlovic, Dino, William, | |
137 | + * rem, Russell Walker (http://www.nbill.co.uk/), Jamie Beck | |
138 | + * (http://www.terabit.ca/), setcookie, Michael, YUI Library: | |
139 | + * http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at | |
140 | + * http://hacks.bluesmoon.info/strftime/strftime.js, DtTvB | |
141 | + * (http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, meo, | |
142 | + * Greenseed, Luke Smith (http://lucassmith.name), Kheang Hok Chin | |
143 | + * (http://www.distantia.ca/), Rival, Diogo Resende, Allan Jensen | |
144 | + * (http://www.winternet.no), Howard Yeend, Jay Klehr, Amir Habibi | |
145 | + * (http://www.residence-mixte.com/), mk.keck, Yen-Wei Liu, Leslie Hoare, Ben | |
146 | + * Bryan, Cagri Ekin, booeyOH | |
147 | + * | |
148 | + * Dual licensed under the MIT (MIT-LICENSE.txt) | |
149 | + * and GPL (GPL-LICENSE.txt) licenses. | |
150 | + * | |
151 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
152 | + * copy of this software and associated documentation files (the | |
153 | + * "Software"), to deal in the Software without restriction, including | |
154 | + * without limitation the rights to use, copy, modify, merge, publish, | |
155 | + * distribute, sublicense, and/or sell copies of the Software, and to | |
156 | + * permit persons to whom the Software is furnished to do so, subject to | |
157 | + * the following conditions: | |
158 | + * | |
159 | + * The above copyright notice and this permission notice shall be included | |
160 | + * in all copies or substantial portions of the Software. | |
161 | + * | |
162 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
163 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
164 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
165 | + * IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES | |
166 | + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
167 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
168 | + * OTHER DEALINGS IN THE SOFTWARE. | |
169 | + */ | |
170 | + | |
171 | + // Compression: minified | |
172 | + (function(){if(typeof(this.PHP_JS)==="undefined"){var PHP_JS=function(cfgObj){if(!(this instanceof PHP_JS)){return new PHP_JS(cfgObj);} | |
173 | + this.window=cfgObj&&cfgObj.window?cfgObj.window:window;this.php_js={};this.php_js.ini={};if(cfgObj){for(var ini in cfgObj.ini){this.php_js.ini[ini]={};this.php_js.ini[ini].local_value=cfgObj.ini[ini];this.php_js.ini[ini].global_value=cfgObj.ini[ini];}}};} | |
174 | + var php_js_shared={};PHP_JS.prototype={constructor:PHP_JS,checkdate:function(m,d,y){return m>0&&m<13&&y>0&&y<32768&&d>0&&d<=(new Date(y,m,0)).getDate();}};this.PHP_JS=PHP_JS;}()); | |
0 | 175 | \ No newline at end of file | ... | ... |
ieducar/intranet/scripts/phpjs/ieducar.package.js
... | ... | @@ -1,174 +0,0 @@ |
1 | -/** | |
2 | - * i-Educar - Sistema de gestão escolar | |
3 | - * | |
4 | - * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
5 | - * <ctima@itajai.sc.gov.br> | |
6 | - * | |
7 | - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
8 | - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
9 | - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
10 | - * qualquer versão posterior. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
13 | - * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
14 | - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
15 | - * do GNU para mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
18 | - * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
19 | - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
20 | - * | |
21 | - * Contém funções PHP portadas para o Javascript. | |
22 | - * | |
23 | - * Pacote PHPJS disponível em: | |
24 | - * <http://phpjs.org/packages/view/3063/name:933975c113578d0edd81fd2a76bcd480> | |
25 | - * | |
26 | - * Transliterado com iconv para ISO-8859-1. | |
27 | - * $ iconv -f UTF-8 -t ISO-8859-1//translit | |
28 | - * | |
29 | - * Contém as seguintes funções: | |
30 | - * - checkdate | |
31 | - * | |
32 | - * @author Eriksen Costa <eriksen.paixao_bs@cobra.com.br> | |
33 | - * @license @@license@@ | |
34 | - * @since Arquivo disponível desde a versão 2.0.0 | |
35 | - * @version $Id$ | |
36 | - */ | |
37 | - | |
38 | -/** | |
39 | - * Singleton para evitar múltipla instanciação de PHP_JS. Para obter o objeto, | |
40 | - * basta chamar o método getInstance(): | |
41 | - * | |
42 | - * <code> | |
43 | - * phpjs = ied_phpjs.getInstance() | |
44 | - * phpjs.PHP_JS_FUNCTION(args, ...); | |
45 | - * </code> | |
46 | - * | |
47 | - * @return PHP_JS | |
48 | - */ | |
49 | -var ied_phpjs = new function() { | |
50 | - var phpjs = new PHP_JS(); | |
51 | - this.getInstance = function() { | |
52 | - return phpjs; | |
53 | - } | |
54 | -} | |
55 | - | |
56 | - | |
57 | - /* | |
58 | - * More info at: http://phpjs.org | |
59 | - * | |
60 | - * This is version: 3.17 | |
61 | - * php.js is copyright 2010 Kevin van Zonneveld. | |
62 | - * | |
63 | - * Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld | |
64 | - * (http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White | |
65 | - * (http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jonas Raoni | |
66 | - * Soares Silva (http://www.jsfromhell.com), Jack, Philip Peterson, Legaev | |
67 | - * Andrey, Ates Goral (http://magnetiq.com), Alex, Ratheous, Martijn Wieringa, | |
68 | - * lmeyrick (https://sourceforge.net/projects/bcmath-js/), Nate, Philippe | |
69 | - * Baumann, Enrique Gonzalez, Webtoolkit.info (http://www.webtoolkit.info/), | |
70 | - * Jani Hartikainen, Ash Searle (http://hexmen.com/blog/), travc, Ole | |
71 | - * Vrijenhoek, Carlos R. L. Rodrigues (http://www.jsfromhell.com), | |
72 | - * http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript, | |
73 | - * Michael Grier, Johnny Mast (http://www.phpvrouwen.nl), stag019, Rafal | |
74 | - * Kukawski (http://blog.kukawski.pl), pilus, T.Wild, Andrea Giammarchi | |
75 | - * (http://webreflection.blogspot.com), WebDevHobo | |
76 | - * (http://webdevhobo.blogspot.com/), GeekFG (http://geekfg.blogspot.com), | |
77 | - * d3x, Erkekjetter, marrtins, Steve Hilder, Martin | |
78 | - * (http://www.erlenwiese.de/), Robin, Oleg Eremeev, mdsjack | |
79 | - * (http://www.mdsjack.bo.it), majak, Mailfaker (http://www.weedem.fr/), | |
80 | - * David, felix, Mirek Slugen, KELAN, Paul Smith, Marc Palau, Chris, Josh | |
81 | - * Fraser | |
82 | - * (http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/), | |
83 | - * Breaking Par Consulting Inc | |
84 | - * (http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7), | |
85 | - * Tim de Koning (http://www.kingsquare.nl), Arpad Ray (mailto:arpad@php.net), | |
86 | - * Public Domain (http://www.json.org/json2.js), Michael White, Steven | |
87 | - * Levithan (http://blog.stevenlevithan.com), Joris, gettimeofday, Sakimori, | |
88 | - * Alfonso Jimenez (http://www.alfonsojimenez.com), Aman Gupta, Caio Ariede | |
89 | - * (http://caioariede.com), AJ, Diplom@t (http://difane.com/), saulius, | |
90 | - * Pellentesque Malesuada, Thunder.m, Tyler Akins (http://rumkin.com), Felix | |
91 | - * Geisendoerfer (http://www.debuggable.com/felix), gorthaur, Imgen Tata | |
92 | - * (http://www.myipdf.com/), Karol Kowalski, Kankrelune | |
93 | - * (http://www.webfaktory.info/), Lars Fischer, Subhasis Deb, josh, Frank | |
94 | - * Forte, Douglas Crockford (http://javascript.crockford.com), Adam Wallner | |
95 | - * (http://web2.bitbaro.hu/), Marco, paulo kuong, madipta, Gilbert, duncan, | |
96 | - * ger, mktime, Oskar Larsson Högfeldt (http://oskar-lh.name/), Arno, Nathan, | |
97 | - * Mateusz "loonquawl" Zalega, ReverseSyntax, Francois, Scott Cariss, Slawomir | |
98 | - * Kaniecki, Denny Wardhana, sankai, 0m3r, noname, john | |
99 | - * (http://www.jd-tech.net), Nick Kolosov (http://sammy.ru), Sanjoy Roy, | |
100 | - * Shingo, nobbler, Fox, marc andreu, T. Wild, class_exists, Jon Hohle, | |
101 | - * Pyerre, JT, Thiago Mata (http://thiagomata.blog.com), Linuxworld, Ozh, | |
102 | - * nord_ua, lmeyrick (https://sourceforge.net/projects/bcmath-js/this.), | |
103 | - * Thomas Beaucourt (http://www.webapp.fr), David Randall, merabi, T0bsn, | |
104 | - * Soren Hansen, Peter-Paul Koch (http://www.quirksmode.org/js/beat.html), | |
105 | - * MeEtc (http://yass.meetcweb.com), Bryan Elliott, Tim Wiel, Brad Touesnard, | |
106 | - * XoraX (http://www.xorax.info), djmix, Hyam Singer | |
107 | - * (http://www.impact-computing.com/), Paul, J A R, kenneth, Raphael (Ao | |
108 | - * RUDLER), David James, Steve Clay, Ole Vrijenhoek (http://www.nervous.nl/), | |
109 | - * Marc Jansen, Francesco, Der Simon (http://innerdom.sourceforge.net/), echo | |
110 | - * is bad, Lincoln Ramsay, Eugene Bulkin (http://doubleaw.com/), JB, Bayron | |
111 | - * Guevara, Stoyan Kyosev (http://www.svest.org/), LH, Matt Bradley, date, | |
112 | - * Kristof Coomans (SCK-CEN Belgian Nucleair Research Centre), Pierre-Luc | |
113 | - * Paour, Martin Pool, Brant Messenger (http://www.brantmessenger.com/), Kirk | |
114 | - * Strobeck, Saulo Vallory, Christoph, Wagner B. Soares, Artur Tchernychev, | |
115 | - * Valentina De Rosa, Jason Wong (http://carrot.org/), Daniel Esteban, | |
116 | - * strftime, Rick Waldron, Mick@el, Anton Ongson, Simon Willison | |
117 | - * (http://simonwillison.net), Gabriel Paderni, Philipp Lenssen, Marco van | |
118 | - * Oort, Bug?, Blues (http://tech.bluesmoon.info/), Tomasz Wesolowski, rezna, | |
119 | - * Eric Nagel, Bobby Drake, Luke Godfrey, Pul, uestla, Alan C, Zahlii, Ulrich, | |
120 | - * Yves Sucaet, hitwork, sowberry, johnrembo, Brian Tafoya | |
121 | - * (http://www.premasolutions.com/), Nick Callen, Steven Levithan | |
122 | - * (stevenlevithan.com), ejsanders, Scott Baker, Philippe Jausions | |
123 | - * (http://pear.php.net/user/jausions), Aidan Lister | |
124 | - * (http://aidanlister.com/), Norman "zEh" Fuchs, Rob, HKM, ChaosNo1, metjay, | |
125 | - * strcasecmp, strcmp, Taras Bogach, jpfle, Alexander Ermolaev | |
126 | - * (http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando, | |
127 | - * dptr1988, Le Torbi, Pedro Tainha (http://www.pedrotainha.com), James, | |
128 | - * penutbutterjelly, Christian Doebler, baris ozdil, Greg Frazier, Tod | |
129 | - * Gentille, Alexander M Beedie, Ryan W Tenney (http://ryan.10e.us), | |
130 | - * FGFEmperor, gabriel paderni, Atli Þór, Maximusya, daniel airton wermann | |
131 | - * (http://wermann.com.br), 3D-GRAF, Yannoo, jakes, Riddler | |
132 | - * (http://www.frontierwebdev.com/), T.J. Leahy, stensi, Matteo, Billy, vlado | |
133 | - * houba, Itsacon (http://www.itsacon.net/), Jalal Berrami, Victor, fearphage | |
134 | - * (http://http/my.opera.com/fearphage/), Luis Salazar | |
135 | - * (http://www.freaky-media.com/), FremyCompany, Tim de Koning, taith, Cord, | |
136 | - * Manish, davook, Benjamin Lupton, Garagoth, Andrej Pavlovic, Dino, William, | |
137 | - * rem, Russell Walker (http://www.nbill.co.uk/), Jamie Beck | |
138 | - * (http://www.terabit.ca/), setcookie, Michael, YUI Library: | |
139 | - * http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at | |
140 | - * http://hacks.bluesmoon.info/strftime/strftime.js, DtTvB | |
141 | - * (http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, meo, | |
142 | - * Greenseed, Luke Smith (http://lucassmith.name), Kheang Hok Chin | |
143 | - * (http://www.distantia.ca/), Rival, Diogo Resende, Allan Jensen | |
144 | - * (http://www.winternet.no), Howard Yeend, Jay Klehr, Amir Habibi | |
145 | - * (http://www.residence-mixte.com/), mk.keck, Yen-Wei Liu, Leslie Hoare, Ben | |
146 | - * Bryan, Cagri Ekin, booeyOH | |
147 | - * | |
148 | - * Dual licensed under the MIT (MIT-LICENSE.txt) | |
149 | - * and GPL (GPL-LICENSE.txt) licenses. | |
150 | - * | |
151 | - * Permission is hereby granted, free of charge, to any person obtaining a | |
152 | - * copy of this software and associated documentation files (the | |
153 | - * "Software"), to deal in the Software without restriction, including | |
154 | - * without limitation the rights to use, copy, modify, merge, publish, | |
155 | - * distribute, sublicense, and/or sell copies of the Software, and to | |
156 | - * permit persons to whom the Software is furnished to do so, subject to | |
157 | - * the following conditions: | |
158 | - * | |
159 | - * The above copyright notice and this permission notice shall be included | |
160 | - * in all copies or substantial portions of the Software. | |
161 | - * | |
162 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
163 | - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
164 | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
165 | - * IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES | |
166 | - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
167 | - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
168 | - * OTHER DEALINGS IN THE SOFTWARE. | |
169 | - */ | |
170 | - | |
171 | - // Compression: minified | |
172 | - (function(){if(typeof(this.PHP_JS)==="undefined"){var PHP_JS=function(cfgObj){if(!(this instanceof PHP_JS)){return new PHP_JS(cfgObj);} | |
173 | - this.window=cfgObj&&cfgObj.window?cfgObj.window:window;this.php_js={};this.php_js.ini={};if(cfgObj){for(var ini in cfgObj.ini){this.php_js.ini[ini]={};this.php_js.ini[ini].local_value=cfgObj.ini[ini];this.php_js.ini[ini].global_value=cfgObj.ini[ini];}}};} | |
174 | - var php_js_shared={};PHP_JS.prototype={constructor:PHP_JS,checkdate:function(m,d,y){return m>0&&m<13&&y>0&&y<32768&&d>0&&d<=(new Date(y,m,0)).getDate();}};this.PHP_JS=PHP_JS;}()); | |
175 | 0 | \ No newline at end of file |
ieducar/intranet/templates/nvp_htmlhead.tpl
... | ... | @@ -20,9 +20,10 @@ |
20 | 20 | <script type="text/javascript" src="scripts/novo.js?1"></script> |
21 | 21 | <script type="text/javascript" src="scripts/dom.js?1"></script> |
22 | 22 | <script type="text/javascript" src="scripts/menu.js?1"></script> |
23 | + <script type="text/javascript" src="scripts/ied/forms.js?1"></script> | |
24 | + <script type="text/javascript" src="scripts/ied/phpjs.js?1"></script> | |
23 | 25 | <script type="text/javascript" src="scripts/scriptaculous/prototype.js"></script> |
24 | 26 | <script type="text/javascript" src="scripts/scriptaculous/scriptaculous.js?load=effects"></script> |
25 | - <script type="text/javascript" src="scripts/phpjs/ieducar.package.js?1"></script> | |
26 | 27 | |
27 | 28 | <script type="text/javascript"> |
28 | 29 | var running = false; | ... | ... |
ieducar/lib/App/Model/IedFinder.php
... | ... | @@ -453,6 +453,28 @@ class App_Model_IedFinder extends CoreExt_Entity |
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
456 | + * Retorna as turmas de uma escola. | |
457 | + * @param int $escola | |
458 | + * @return array (cod_turma => nm_turma) | |
459 | + */ | |
460 | + public static function getTurmas($escola) | |
461 | + { | |
462 | + $turma = self::addClassToStorage('clsPmieducarTurma', NULL, | |
463 | + 'include/pmieducar/clsPmieducarTurma.inc.php'); | |
464 | + | |
465 | + // Carrega as turmas da escola | |
466 | + $turma->setOrderBy('nm_turma ASC'); | |
467 | + $turmas = $turma->lista(NULL, NULL, NULL, NULL, $escola); | |
468 | + | |
469 | + $ret = array(); | |
470 | + foreach ($turmas as $turma) { | |
471 | + $ret[$turma['cod_turma']] = $turma['nm_turma']; | |
472 | + } | |
473 | + | |
474 | + return $ret; | |
475 | + } | |
476 | + | |
477 | + /** | |
456 | 478 | * @see CoreExt_Entity_Validatable#getDefaultValidatorCollection() |
457 | 479 | */ |
458 | 480 | public function getDefaultValidatorCollection() | ... | ... |
ieducar/misc/database/deltas/21_cria_tabelas_modulo_calendario.sql
0 → 100644
... | ... | @@ -0,0 +1,31 @@ |
1 | +-- // | |
2 | + | |
3 | +-- | |
4 | +-- Cria as tabelas para o módulo Calendário. | |
5 | +-- | |
6 | +-- @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
7 | +-- @license @@license@@ | |
8 | +-- @version $Id$ | |
9 | +-- | |
10 | + | |
11 | +CREATE TABLE "modules"."calendario_turma" ( | |
12 | + "calendario_ano_letivo_id" int NOT NULL, | |
13 | + "ano" int NOT NULL, | |
14 | + "mes" int NOT NULL, | |
15 | + "dia" int NOT NULL, | |
16 | + "turma_id" int NOT NULL | |
17 | +); | |
18 | +ALTER TABLE "modules"."calendario_turma" | |
19 | + ADD CONSTRAINT "calendario_turma_calendario_dia_fk" | |
20 | + FOREIGN KEY("calendario_ano_letivo_id", "mes", "dia") | |
21 | + REFERENCES "pmieducar"."calendario_dia"("ref_cod_calendario_ano_letivo", "mes", "dia") | |
22 | + MATCH FULL | |
23 | + ON DELETE CASCADE | |
24 | + ON UPDATE NO ACTION; | |
25 | + | |
26 | +-- //@UNDO | |
27 | + | |
28 | +ALTER TABLE "modules"."calendario_turma" DROP CONSTRAINT "calendario_turma_calendario_dia_fk" CASCADE; | |
29 | +DROP TABLE "modules"."calendario_turma"; | |
30 | + | |
31 | +-- // | |
0 | 32 | \ No newline at end of file | ... | ... |
ieducar/misc/database/ieducar.sql
... | ... | @@ -10273,6 +10273,19 @@ SELECT pg_catalog.setval('area_conhecimento_id_seq', 1, false); |
10273 | 10273 | |
10274 | 10274 | |
10275 | 10275 | -- |
10276 | +-- Name: calendario_turma; Type: TABLE; Schema: modules; Owner: -; Tablespace: | |
10277 | +-- | |
10278 | + | |
10279 | +CREATE TABLE calendario_turma ( | |
10280 | + calendario_ano_letivo_id integer NOT NULL, | |
10281 | + ano integer NOT NULL, | |
10282 | + mes integer NOT NULL, | |
10283 | + dia integer NOT NULL, | |
10284 | + turma_id integer NOT NULL | |
10285 | +); | |
10286 | + | |
10287 | + | |
10288 | +-- | |
10276 | 10289 | -- Name: componente_curricular; Type: TABLE; Schema: modules; Owner: -; Tablespace: |
10277 | 10290 | -- |
10278 | 10291 | |
... | ... | @@ -17687,6 +17700,12 @@ SET search_path = modules, pg_catalog; |
17687 | 17700 | |
17688 | 17701 | |
17689 | 17702 | -- |
17703 | +-- Data for Name: calendario_turma; Type: TABLE DATA; Schema: modules; Owner: - | |
17704 | +-- | |
17705 | + | |
17706 | + | |
17707 | + | |
17708 | +-- | |
17690 | 17709 | -- Data for Name: componente_curricular; Type: TABLE DATA; Schema: modules; Owner: - |
17691 | 17710 | -- |
17692 | 17711 | |
... | ... | @@ -20094,6 +20113,7 @@ INSERT INTO changelog VALUES (17, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '17_adic |
20094 | 20113 | INSERT INTO changelog VALUES (18, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '18_cria_tabelas_de_parecer_descritivo.sql'); |
20095 | 20114 | INSERT INTO changelog VALUES (19, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '19_atualiza_nome_de_relatorio_no_menu_e_permissoes.sql'); |
20096 | 20115 | INSERT INTO changelog VALUES (20, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '20_remove_permissao_e_menu_diario_avaliacao_temp.sql'); |
20116 | +INSERT INTO changelog VALUES (21, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '21_cria_tabelas_modulo_calendario.sql'); | |
20097 | 20117 | |
20098 | 20118 | |
20099 | 20119 | -- |
... | ... | @@ -32757,6 +32777,14 @@ ALTER TABLE ONLY tipo_incoerencia |
32757 | 32777 | SET search_path = modules, pg_catalog; |
32758 | 32778 | |
32759 | 32779 | -- |
32780 | +-- Name: calendario_turma_calendario_dia_fk; Type: FK CONSTRAINT; Schema: modules; Owner: - | |
32781 | +-- | |
32782 | + | |
32783 | +ALTER TABLE ONLY calendario_turma | |
32784 | + ADD CONSTRAINT calendario_turma_calendario_dia_fk FOREIGN KEY (calendario_ano_letivo_id, mes, dia) REFERENCES pmieducar.calendario_dia(ref_cod_calendario_ano_letivo, mes, dia) MATCH FULL ON DELETE CASCADE; | |
32785 | + | |
32786 | + | |
32787 | +-- | |
32760 | 32788 | -- Name: componente_curricular_ano_escolar_fk; Type: FK CONSTRAINT; Schema: modules; Owner: - |
32761 | 32789 | -- |
32762 | 32790 | ... | ... |
... | ... | @@ -0,0 +1,71 @@ |
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 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Calendario | |
27 | + * @subpackage Modules | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'CoreExt/Entity.php'; | |
33 | + | |
34 | +/** | |
35 | + * Calendario_Model_Turma class. | |
36 | + * | |
37 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
38 | + * @category i-Educar | |
39 | + * @license @@license@@ | |
40 | + * @package Calendario | |
41 | + * @subpackage Modules | |
42 | + * @since Classe disponível desde a versão 1.2.0 | |
43 | + * @version @@package_version@@ | |
44 | + */ | |
45 | +class Calendario_Model_Turma extends CoreExt_Entity | |
46 | +{ | |
47 | + protected $_data = array( | |
48 | + 'calendarioAnoLetivo' => NULL, | |
49 | + 'ano' => NULL, | |
50 | + 'mes' => NULL, | |
51 | + 'dia' => NULL, | |
52 | + 'turma' => NULL | |
53 | + ); | |
54 | + | |
55 | + public function getDefaultValidatorCollection() | |
56 | + { | |
57 | + return array( | |
58 | + 'calendarioAnoLetivo' => new CoreExt_Validate_Numeric(array('min' => 0)), | |
59 | + 'ano' => new CoreExt_Validate_Numeric(array('min' => 0)), | |
60 | + 'mes' => new CoreExt_Validate_Numeric(array('min' => 0)), | |
61 | + 'dia' => new CoreExt_Validate_Numeric(array('min' => 0)), | |
62 | + 'turma' => new CoreExt_Validate_Numeric(array('min' => 0)) | |
63 | + ); | |
64 | + } | |
65 | + | |
66 | + public function __construct(array $options = array()) | |
67 | + { | |
68 | + parent::__construct($options); | |
69 | + unset($this->_data['id']); | |
70 | + } | |
71 | +} | |
0 | 72 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,60 @@ |
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 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Calendario | |
27 | + * @subpackage Modules | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'CoreExt/DataMapper.php'; | |
33 | +require_once 'Calendario/Model/Turma.php'; | |
34 | + | |
35 | +/** | |
36 | + * Calendario_Model_TurmaDataMapper class. | |
37 | + * | |
38 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
39 | + * @category i-Educar | |
40 | + * @license @@license@@ | |
41 | + * @package Calendario | |
42 | + * @subpackage Modules | |
43 | + * @since Classe disponível desde a versão 1.2.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
46 | +class Calendario_Model_TurmaDataMapper extends CoreExt_DataMapper | |
47 | +{ | |
48 | + protected $_entityClass = 'Calendario_Model_Turma'; | |
49 | + protected $_tableName = 'calendario_turma'; | |
50 | + protected $_tableSchema = 'modules'; | |
51 | + | |
52 | + protected $_attributeMap = array( | |
53 | + 'calendarioAnoLetivo' => 'calendario_ano_letivo_id', | |
54 | + 'turma' => 'turma_id' | |
55 | + ); | |
56 | + | |
57 | + protected $_primaryKey = array( | |
58 | + 'calendarioAnoLetivo', 'mes', 'dia', 'ano', 'turma' | |
59 | + ); | |
60 | +} | |
0 | 61 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +TODO | |
2 | +==== | |
3 | + | |
4 | +1. Analisar a obrigatoriedade de selecionar alguma turma no cadastro de | |
5 | + Calendário Dia | |
6 | + | |
7 | +No momento em que é cadastrado um dia no calendário, pode-se selecionar as | |
8 | +turmas que serão afetadas (por ser um dia extra letivo ou não letivo). Deve-se | |
9 | +analisar qual é a melhor estratégia para tornar claro que a não seleção de | |
10 | +turma(s) afeta na contagem de dias letivos para a(s) turma(s). | |
11 | + | |
12 | +2. Verificar uma forma efetiva de remover registros quando uma turma for | |
13 | + removida do banco de dados (ou apenas "desativada") | |
14 | + | |
15 | +Existe apenas uma restrição referencial a pmieducar.calendario_dia. Testar | |
16 | +a inclusão de uma segunda restrição para pmieducar.turma. | |
0 | 17 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,31 @@ |
1 | +-- // | |
2 | + | |
3 | +-- | |
4 | +-- Cria as tabelas para o módulo Calendário. | |
5 | +-- | |
6 | +-- @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
7 | +-- @license @@license@@ | |
8 | +-- @version $Id$ | |
9 | +-- | |
10 | + | |
11 | +CREATE TABLE "modules"."calendario_turma" ( | |
12 | + "calendario_ano_letivo_id" int NOT NULL, | |
13 | + "ano" int NOT NULL, | |
14 | + "mes" int NOT NULL, | |
15 | + "dia" int NOT NULL, | |
16 | + "turma_id" int NOT NULL | |
17 | +); | |
18 | +ALTER TABLE "modules"."calendario_turma" | |
19 | + ADD CONSTRAINT "calendario_turma_calendario_dia_fk" | |
20 | + FOREIGN KEY("calendario_ano_letivo_id", "mes", "dia") | |
21 | + REFERENCES "pmieducar"."calendario_dia"("ref_cod_calendario_ano_letivo", "mes", "dia") | |
22 | + MATCH FULL | |
23 | + ON DELETE CASCADE | |
24 | + ON UPDATE NO ACTION; | |
25 | + | |
26 | +-- //@UNDO | |
27 | + | |
28 | +ALTER TABLE "modules"."calendario_turma" DROP CONSTRAINT "calendario_turma_calendario_dia_fk" CASCADE; | |
29 | +DROP TABLE "modules"."calendario_turma"; | |
30 | + | |
31 | +-- // | |
0 | 32 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,63 @@ |
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 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Calendario | |
27 | + * @subpackage UnitTests | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'Calendario/Model/Turma.php'; | |
33 | + | |
34 | +/** | |
35 | + * TurmaTest class. | |
36 | + * | |
37 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
38 | + * @category i-Educar | |
39 | + * @license @@license@@ | |
40 | + * @package Calendario | |
41 | + * @subpackage UnitTests | |
42 | + * @since Classe disponível desde a versão 1.2.0 | |
43 | + * @version @@package_version@@ | |
44 | + */ | |
45 | +class TurmaTest extends UnitBaseTest | |
46 | +{ | |
47 | + protected $_entity = NULL; | |
48 | + | |
49 | + protected function setUp() | |
50 | + { | |
51 | + $this->_entity = new Calendario_Model_Turma(); | |
52 | + } | |
53 | + | |
54 | + public function testEntityValidators() | |
55 | + { | |
56 | + $validators = $this->_entity->getDefaultValidatorCollection(); | |
57 | + $this->assertType('CoreExt_Validate_Numeric', $validators['calendarioAnoLetivo']); | |
58 | + $this->assertType('CoreExt_Validate_Numeric', $validators['ano']); | |
59 | + $this->assertType('CoreExt_Validate_Numeric', $validators['mes']); | |
60 | + $this->assertType('CoreExt_Validate_Numeric', $validators['dia']); | |
61 | + $this->assertType('CoreExt_Validate_Numeric', $validators['turma']); | |
62 | + } | |
63 | +} | |
0 | 64 | \ No newline at end of file | ... | ... |
ieducar/tests/unit/App/Model/IedFinderTest.php
... | ... | @@ -37,6 +37,7 @@ require_once 'include/pmieducar/clsPmieducarMatriculaTurma.inc.php'; |
37 | 37 | require_once 'include/pmieducar/clsPmieducarEscolaSerieDisciplina.inc.php'; |
38 | 38 | require_once 'include/pmieducar/clsPmieducarEscolaAnoLetivo.inc.php'; |
39 | 39 | require_once 'include/pmieducar/clsPmieducarAnoLetivoModulo.inc.php'; |
40 | +require_once 'include/pmieducar/clsPmieducarTurma.inc.php'; | |
40 | 41 | require_once 'RegraAvaliacao/Model/RegraDataMapper.php'; |
41 | 42 | require_once 'FormulaMedia/Model/FormulaDataMapper.php'; |
42 | 43 | require_once 'TabelaArredondamento/Model/TabelaDataMapper.php'; |
... | ... | @@ -154,6 +155,24 @@ class App_Model_IedFinderTest extends UnitBaseTest |
154 | 155 | $this->assertEquals($expected, $instituicoes); |
155 | 156 | } |
156 | 157 | |
158 | + public function testCarregaTurmas() | |
159 | + { | |
160 | + $returnValue = array(1 => array('cod_turma' => 1, 'nm_turma' => 'Primeiro ano')); | |
161 | + $expected = array(1 => 'Primeiro ano'); | |
162 | + | |
163 | + $mock = $this->getCleanMock('clsPmieducarTurma'); | |
164 | + $mock->expects($this->once()) | |
165 | + ->method('lista') | |
166 | + ->with(NULL, NULL, NULL, NULL, 1) | |
167 | + ->will($this->returnValue($returnValue)); | |
168 | + | |
169 | + $instance = CoreExt_Entity::addClassToStorage( | |
170 | + 'clsPmieducarTurma', $mock, NULL, TRUE); | |
171 | + | |
172 | + $turmas = App_Model_IedFinder::getTurmas(1); | |
173 | + $this->assertEquals($expected, $turmas); | |
174 | + } | |
175 | + | |
157 | 176 | public function testGetMatricula() |
158 | 177 | { |
159 | 178 | $expected = array( | ... | ... |