Commit 7759b58488199d36cc4fb19e4934967379fa9f78
1 parent
50afb06f
Exists in
master
Correção no cadastro de turma ao inserir novos módulos;
* Na edição da turma não aparecia corretamente todos os módulos já cadastrados anteriormente; * Ao editar turmas (sem o campo "Padrão ano letivo" selecionado no curso) gerava alguns problemas tais como, campo duplicado em "Dia a semana" e perca de módulos; Portabilis/ieducar#145
Showing
2 changed files
with
41 additions
and
5 deletions
Show diff stats
ieducar/intranet/educar_turma_cad.php
... | ... | @@ -474,13 +474,24 @@ class indice extends clsCadastro |
474 | 474 | $this->turma_modulo = unserialize(urldecode($_POST['turma_modulo'])); |
475 | 475 | } |
476 | 476 | |
477 | - $qtd_modulo = count($this->turma_modulo) == 0 ? 1 : (count($this->turma_modulo) + 1); | |
477 | + if ($_POST){ | |
478 | + $qtd_modulo = count($this->turma_modulo) == 0 ? 1 : (count($this->turma_modulo) + 1); | |
479 | + echo " | |
480 | + <script type=\"text/javascript\"> | |
481 | + window.setTimeout(function() { | |
482 | + document.getElementById(\"event_incluir_dia_semana\").focus(); | |
483 | + }, 500); | |
484 | + </script> | |
485 | + "; | |
486 | + } | |
487 | + else | |
488 | + $qtd_modulo = 0; | |
478 | 489 | |
479 | 490 | if (is_numeric($this->cod_turma) && !$_POST) { |
480 | 491 | $obj = new clsPmieducarTurmaModulo(); |
481 | 492 | $registros = $obj->lista($this->cod_turma); |
482 | 493 | |
483 | - if ($registros) { | |
494 | + if ($registros and !$this->padrao_ano_escolar) { | |
484 | 495 | foreach ($registros as $campo) { |
485 | 496 | $this->turma_modulo[$campo[$qtd_modulo]]['sequencial_'] = $campo['sequencial']; |
486 | 497 | $this->turma_modulo[$campo[$qtd_modulo]]['ref_cod_modulo_'] = $campo['ref_cod_modulo']; |
... | ... | @@ -508,6 +519,7 @@ class indice extends clsCadastro |
508 | 519 | $qtd_modulo = 1; |
509 | 520 | |
510 | 521 | unset($aux); |
522 | + $scriptExcluir = ""; | |
511 | 523 | |
512 | 524 | if ($this->turma_modulo) { |
513 | 525 | foreach ($this->turma_modulo as $campo) { |
... | ... | @@ -528,9 +540,18 @@ class indice extends clsCadastro |
528 | 540 | |
529 | 541 | $this->campoTextoInv('data_fim_' . $campo['sequencial_'], '', $campo['data_fim_'], |
530 | 542 | 10, 10, FALSE, FALSE, FALSE, '', |
531 | - "<a href='#' onclick=\"document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", | |
543 | + "<a href='#' id=\"event_excluir_modulo_{$qtd_modulo}\" ><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", | |
532 | 544 | '', '', ''); |
533 | 545 | |
546 | + $scriptExcluir.= "<script type=\"text/javascript\"> | |
547 | + document.getElementById('event_excluir_modulo_{$qtd_modulo}').onclick = excluirModulo{$qtd_modulo}; | |
548 | + function excluirModulo{$qtd_modulo}(){ | |
549 | + document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; | |
550 | + document.getElementById('tipoacao').value = ''; | |
551 | + {$this->__nome}.submit(); | |
552 | + } | |
553 | + </script>"; | |
554 | + | |
534 | 555 | $aux[$qtd_modulo]['sequencial_'] = $qtd_modulo; |
535 | 556 | $aux[$qtd_modulo]['ref_cod_modulo_'] = $campo['ref_cod_modulo_']; |
536 | 557 | $aux[$qtd_modulo]['data_inicio_'] = $campo['data_inicio_']; |
... | ... | @@ -572,7 +593,7 @@ class indice extends clsCadastro |
572 | 593 | $this->campoOculto('incluir_modulo', ''); |
573 | 594 | |
574 | 595 | $this->campoRotulo('bt_incluir_modulo', Portabilis_String_utils::toLatin1('Módulo'), |
575 | - "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>" | |
596 | + "<a href='#' id=\"event_incluir_modulo\" ><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>" | |
576 | 597 | ); |
577 | 598 | |
578 | 599 | $this->campoQuebra2(); |
... | ... | @@ -667,6 +688,8 @@ class indice extends clsCadastro |
667 | 688 | |
668 | 689 | $this->campoOculto('padrao_ano_escolar', $this->padrao_ano_escolar); |
669 | 690 | |
691 | + $this->campoTextoInv('scripts', $scriptExcluir); | |
692 | + | |
670 | 693 | $this->acao_enviar = 'valida()'; |
671 | 694 | } |
672 | 695 | |
... | ... | @@ -1799,4 +1822,17 @@ function atualizaLstEscolaCursoSerie(xml) |
1799 | 1822 | campoSerie.options[0].text = stringUtils.toUtf8('A escola/curso não possui nenhuma série'); |
1800 | 1823 | } |
1801 | 1824 | } |
1825 | + | |
1826 | +document.getElementById('event_incluir_modulo').onclick = incluirModulo; | |
1827 | + | |
1828 | +function incluirModulo(){ | |
1829 | + document.getElementById('incluir_modulo').value = 'S'; | |
1830 | + document.getElementById('tipoacao').value = ''; | |
1831 | + acao(); | |
1832 | +} | |
1833 | + | |
1834 | +$j(document).ready( function(){ | |
1835 | + $j('#scripts').closest('tr').hide(); | |
1836 | +}); | |
1837 | + | |
1802 | 1838 | </script> | ... | ... |
ieducar/modules/Portabilis/Assets/Version.php