Commit 6f9462a0299efb600bdd20a8eafc4ab2b3e25388
1 parent
677912db
Exists in
master
Vinculado turma a ano letivo close #4
Showing
13 changed files
with
288 additions
and
41 deletions
Show diff stats
ieducar/intranet/educar_ano_letivo_modulo_cad.php
| ... | ... | @@ -35,6 +35,8 @@ require_once 'include/pmieducar/geral.inc.php'; |
| 35 | 35 | |
| 36 | 36 | require_once 'App/Date/Utils.php'; |
| 37 | 37 | |
| 38 | +require_once 'ComponenteCurricular/Model/TurmaDataMapper.php'; | |
| 39 | + | |
| 38 | 40 | /** |
| 39 | 41 | * clsIndexBase class. |
| 40 | 42 | * |
| ... | ... | @@ -281,8 +283,11 @@ class indice extends clsCadastro |
| 281 | 283 | $this->ano_letivo_modulo = unserialize(urldecode($this->ano_letivo_modulo)); |
| 282 | 284 | |
| 283 | 285 | if ($this->ano_letivo_modulo) { |
| 286 | + | |
| 287 | + $this->copiarTurmasUltimoAno($this->ref_ref_cod_escola, $this->ref_ano); | |
| 288 | + | |
| 284 | 289 | $obj = new clsPmieducarEscolaAnoLetivo($this->ref_ref_cod_escola, |
| 285 | - $this->ref_ano, $this->pessoa_logada, NULL, 0, NULL, NULL, 1 | |
| 290 | + $this->ref_ano, $this->pessoa_logada, NULL, 0, NULL, NULL, 1, 1 | |
| 286 | 291 | ); |
| 287 | 292 | |
| 288 | 293 | $cadastrou = $obj->cadastra(); |
| ... | ... | @@ -434,6 +439,122 @@ class indice extends clsCadastro |
| 434 | 439 | |
| 435 | 440 | return TRUE; |
| 436 | 441 | } |
| 442 | + | |
| 443 | + function copiarTurmasUltimoAno($escolaId, $anoDestino) { | |
| 444 | + $sql = 'select ano, turmas_por_ano from pmieducar.escola_ano_letivo where ref_cod_escola = $1 ' . | |
| 445 | + 'and ativo = 1 and ano in (select max(ano) from pmieducar.escola_ano_letivo where ' . | |
| 446 | + 'ref_cod_escola = $1 and ativo = 1)'; | |
| 447 | + | |
| 448 | + $ultimoAnoLetivo = Portabilis_Utils_Database::selectRow($sql, $escolaId); | |
| 449 | + | |
| 450 | + $anoTurmasPorAno = $ultimoAnoLetivo['turmas_por_ano'] == 1 ? $ultimoAnoLetivo['ano'] : null; | |
| 451 | + | |
| 452 | + $turmasEscola = new clsPmieducarTurma(); | |
| 453 | + $turmasEscola = $turmasEscola->lista(null, null, null, null, $escolaId, null, null, null, | |
| 454 | + null, null, null, null, null, null, 1, null, null, | |
| 455 | + null, null, null, null, null, null, null, null, null, | |
| 456 | + null, null, null, null, null, false, null, true, null, | |
| 457 | + null, $anoTurmasPorAno); | |
| 458 | + | |
| 459 | + foreach ($turmasEscola as $turma) | |
| 460 | + $this->copiarTurma($turma, $ultimoAnoLetivo['ano'], $anoDestino); | |
| 461 | + } | |
| 462 | + | |
| 463 | + function copiarTurma($turmaOrigem, $anoOrigem, $anoDestino) { | |
| 464 | + $sql = "select 1 from turma where ativo = 1 and visivel = true | |
| 465 | + and ref_ref_cod_escola = $1 and nm_turma = $2 and ref_ref_cod_serie = $3 and ano = $4 limit 1"; | |
| 466 | + | |
| 467 | + $params = array( | |
| 468 | + $turmaOrigem['ref_ref_cod_escola'], | |
| 469 | + $turmaOrigem['nm_turma'], | |
| 470 | + $turmaOrigem['ref_ref_cod_serie'], | |
| 471 | + $anoDestino | |
| 472 | + ); | |
| 473 | + | |
| 474 | + $existe = Portabilis_Utils_Database::selectField($sql, $params); | |
| 475 | + | |
| 476 | + if ($existe != 1) { | |
| 477 | + $fields = array('ref_usuario_exc', 'ref_usuario_cad', 'ref_ref_cod_serie', 'ref_ref_cod_escola', | |
| 478 | + 'ref_cod_infra_predio_comodo', 'nm_turma', 'sgl_turma', 'max_aluno', 'multiseriada', | |
| 479 | + 'data_cadastro', 'data_exclusao', 'ativo', 'ref_cod_turma_tipo', 'hora_inicial', 'hora_final', | |
| 480 | + 'hora_inicio_intervalo', 'hora_fim_intervalo', 'ref_cod_regente', 'ref_cod_instituicao_regente', | |
| 481 | + 'ref_cod_instituicao', 'ref_cod_curso', 'ref_ref_cod_serie_mult', 'ref_ref_cod_escola_mult', | |
| 482 | + 'visivel', 'turma_turno_id', 'tipo_boletim', 'ano'); | |
| 483 | + | |
| 484 | + $turmaDestino = new clsPmieducarTurma(); | |
| 485 | + | |
| 486 | + foreach ($fields as $fieldName) | |
| 487 | + $turmaDestino->$fieldName = $turmaOrigem[$fieldName]; | |
| 488 | + | |
| 489 | + $turmaDestino->ano = $anoDestino; | |
| 490 | + $turmaDestinoId = $turmaDestino->cadastra(); | |
| 491 | + | |
| 492 | + $this->copiarComponenteCurricularTurma($turmaOrigem['cod_turma'], $turmaDestinoId); | |
| 493 | + $this->copiarModulosTurma($turmaOrigem['cod_turma'], $turmaDestinoId, $anoOrigem, $anoDestino); | |
| 494 | + $this->copiarDiasSemanaTurma($turmaOrigem['cod_turma'], $turmaDestinoId); | |
| 495 | + } | |
| 496 | + } | |
| 497 | + | |
| 498 | + function copiarComponenteCurricularTurma($turmaOrigemId, $turmaDestinoId) { | |
| 499 | + $dataMapper = new ComponenteCurricular_Model_TurmaDataMapper(); | |
| 500 | + $componentesTurmaOrigem = $dataMapper->findAll(array(), array('turma' => $turmaOrigemId)); | |
| 501 | + | |
| 502 | + foreach ($componentesTurmaOrigem as $componenteTurmaOrigem) { | |
| 503 | + $data = array( | |
| 504 | + 'componenteCurricular' => $componenteTurmaOrigem->get('componenteCurricular'), | |
| 505 | + 'escola' => $componenteTurmaOrigem->get('escola'), | |
| 506 | + 'cargaHoraria' => $componenteTurmaOrigem->get('cargaHoraria'), | |
| 507 | + 'turma' => $turmaDestinoId, | |
| 508 | + | |
| 509 | + // está sendo mantido o mesmo ano_escolar_id, uma vez que não foi | |
| 510 | + // foi encontrado de onde o valor deste campo é obtido. | |
| 511 | + 'anoEscolar' => $componenteTurmaOrigem->get('anoEscolar') | |
| 512 | + ); | |
| 513 | + | |
| 514 | + $componenteTurmaDestino = $dataMapper->createNewEntityInstance($data); | |
| 515 | + $dataMapper->save($componenteTurmaDestino); | |
| 516 | + } | |
| 517 | + } | |
| 518 | + | |
| 519 | + function copiarModulosTurma($turmaOrigemId, $turmaDestinoId, $anoOrigem, $anoDestino) { | |
| 520 | + $modulosTurmaOrigem = new clsPmieducarTurmaModulo(); | |
| 521 | + $modulosTurmaOrigem = $modulosTurmaOrigem->lista($turmaOrigemId); | |
| 522 | + | |
| 523 | + foreach ($modulosTurmaOrigem as $moduloOrigem) { | |
| 524 | + $moduloDestino = new clsPmieducarTurmaModulo(); | |
| 525 | + | |
| 526 | + $moduloDestino->ref_cod_modulo = $moduloOrigem['ref_cod_modulo']; | |
| 527 | + $moduloDestino->sequencial = $moduloOrigem['sequencial']; | |
| 528 | + $moduloDestino->ref_cod_turma = $turmaDestinoId; | |
| 529 | + | |
| 530 | + $moduloDestino->data_inicio = str_replace( | |
| 531 | + $anoOrigem, $anoDestino, $moduloOrigem['data_inicio'] | |
| 532 | + ); | |
| 533 | + | |
| 534 | + $moduloDestino->data_fim = str_replace( | |
| 535 | + $anoOrigem, $anoDestino, $moduloOrigem['data_fim'] | |
| 536 | + ); | |
| 537 | + | |
| 538 | + $moduloDestino->cadastra(); | |
| 539 | + } | |
| 540 | + } | |
| 541 | + | |
| 542 | + function copiarDiasSemanaTurma($turmaOrigemId, $turmaDestinoId) { | |
| 543 | + $diasSemanaTurmaOrigem = new clsPmieducarTurmaDiaSemana(); | |
| 544 | + $diasSemanaTurmaOrigem = $diasSemanaTurmaOrigem->lista(null, $turmaOrigemId); | |
| 545 | + | |
| 546 | + $fields = array('dia_semana', 'hora_inicial', 'hora_final'); | |
| 547 | + | |
| 548 | + foreach ($diasSemanaTurmaOrigem as $diaSemanaOrigem) { | |
| 549 | + $diaSemanaDestino = new clsPmieducarTurmaDiaSemana(); | |
| 550 | + | |
| 551 | + foreach ($fields as $fieldName) | |
| 552 | + $diaSemanaDestino->$fieldName = $diaSemanaOrigem[$fieldName]; | |
| 553 | + | |
| 554 | + $diaSemanaDestino->ref_cod_turma = $turmaDestinoId; | |
| 555 | + $diaSemanaDestino->cadastra(); | |
| 556 | + } | |
| 557 | + } | |
| 437 | 558 | } |
| 438 | 559 | |
| 439 | 560 | // Instancia objeto de página |
| ... | ... | @@ -450,7 +571,7 @@ $pagina->MakeAll(); |
| 450 | 571 | ?> |
| 451 | 572 | <script type="text/javascript"> |
| 452 | 573 | /** |
| 453 | - * Realiza validação client-side do formulário. | |
| 574 | + * Realiza validação client-side do forComponenteCurricular_Model_TurmaDataMappermulário. | |
| 454 | 575 | */ |
| 455 | 576 | function incluir() |
| 456 | 577 | { | ... | ... |
ieducar/intranet/educar_turma_cad.php
| ... | ... | @@ -226,6 +226,10 @@ class indice extends clsCadastro |
| 226 | 226 | $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, |
| 227 | 227 | '', FALSE, '', $script); |
| 228 | 228 | |
| 229 | + // o campo ano somente é exibido para turmas novas ou cadastradas após inclusão deste campo. | |
| 230 | + if (! isset($this->cod_turma) || isset($this->ano)) | |
| 231 | + $this->inputsHelper()->dynamic('anoLetivo'); | |
| 232 | + | |
| 229 | 233 | // Infra prédio cômodo |
| 230 | 234 | $opcoes = array('' => 'Selecione'); |
| 231 | 235 | |
| ... | ... | @@ -302,7 +306,8 @@ class indice extends clsCadastro |
| 302 | 306 | |
| 303 | 307 | $this->campoNumero('max_aluno', 'Máximo de Alunos', $this->max_aluno, 3, 3, TRUE); |
| 304 | 308 | |
| 305 | - $this->campoCheck('visivel', 'Ativo', dbBool($this->visivel)); | |
| 309 | + $ativo = isset($this->cod_turma) ? dbBool($this->visivel) : true; | |
| 310 | + $this->campoCheck('visivel', 'Ativo', $ativo); | |
| 306 | 311 | |
| 307 | 312 | $this->campoCheck('multiseriada', 'Multi-Seriada', $this->multiseriada, '', |
| 308 | 313 | FALSE, FALSE); |
| ... | ... | @@ -687,7 +692,7 @@ class indice extends clsCadastro |
| 687 | 692 | $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, |
| 688 | 693 | $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, |
| 689 | 694 | $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, |
| 690 | - $this->visivel, $this->turma_turno_id, $this->tipo_boletim); | |
| 695 | + $this->visivel, $this->turma_turno_id, $this->tipo_boletim, $this->ano); | |
| 691 | 696 | |
| 692 | 697 | $cadastrou = $obj->cadastra(); |
| 693 | 698 | |
| ... | ... | @@ -753,7 +758,7 @@ class indice extends clsCadastro |
| 753 | 758 | $this->ref_cod_regente, $this->ref_cod_instituicao_regente, |
| 754 | 759 | $this->ref_cod_instituicao, $this->ref_cod_curso, |
| 755 | 760 | $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, $this->visivel, |
| 756 | - $this->turma_turno_id, $this->tipo_boletim); | |
| 761 | + $this->turma_turno_id, $this->tipo_boletim, $this->ano); | |
| 757 | 762 | |
| 758 | 763 | $cadastrou = $obj->cadastra(); |
| 759 | 764 | |
| ... | ... | @@ -814,7 +819,8 @@ class indice extends clsCadastro |
| 814 | 819 | $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, |
| 815 | 820 | $this->visivel, |
| 816 | 821 | $this->turma_turno_id, |
| 817 | - $this->tipo_boletim); | |
| 822 | + $this->tipo_boletim, | |
| 823 | + $this->ano); | |
| 818 | 824 | |
| 819 | 825 | $editou = $obj->edita(); |
| 820 | 826 | |
| ... | ... | @@ -885,7 +891,7 @@ class indice extends clsCadastro |
| 885 | 891 | $this->hora_inicio_intervalo, $this->hora_fim_intervalo, $this->ref_cod_regente, |
| 886 | 892 | $this->ref_cod_instituicao_regente, $this->ref_cod_instituicao, |
| 887 | 893 | $this->ref_cod_curso, $this->ref_ref_cod_serie_mult, $this->ref_cod_escola, |
| 888 | - $this->visivel, $this->turma_turno_id, $this->tipo_boletim); | |
| 894 | + $this->visivel, $this->turma_turno_id, $this->tipo_boletim, $this->ano); | |
| 889 | 895 | |
| 890 | 896 | $editou = $obj->edita(); |
| 891 | 897 | } | ... | ... |
ieducar/intranet/educar_turma_lst.php
| ... | ... | @@ -109,6 +109,7 @@ class indice extends clsListagem |
| 109 | 109 | $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); |
| 110 | 110 | |
| 111 | 111 | $lista_busca = array( |
| 112 | + "Ano", | |
| 112 | 113 | "Turma", |
| 113 | 114 | "Turno", |
| 114 | 115 | "Série", |
| ... | ... | @@ -121,7 +122,7 @@ class indice extends clsListagem |
| 121 | 122 | if ($nivel_usuario == 1) |
| 122 | 123 | { |
| 123 | 124 | $lista_busca[] = "Escola"; |
| 124 | - $lista_busca[] = "Instituição"; | |
| 125 | + //$lista_busca[] = "Instituição"; | |
| 125 | 126 | } |
| 126 | 127 | else if ($nivel_usuario == 2) |
| 127 | 128 | { |
| ... | ... | @@ -142,8 +143,11 @@ class indice extends clsListagem |
| 142 | 143 | $this->ref_ref_cod_escola = $this->ref_cod_escola; |
| 143 | 144 | } |
| 144 | 145 | |
| 146 | + $helperOptions = array(); | |
| 147 | + $this->inputsHelper()->dynamic('anoLetivo', array(), $helperOptions); | |
| 148 | + | |
| 145 | 149 | $this->campoTexto( "nm_turma", "Turma", $this->nm_turma, 30, 255, false ); |
| 146 | - $this->campoLista("visivel", "Situação", array("" => "Selecione", "1" => "Visível", "2" => "Invisível"), $this->visivel); | |
| 150 | + $this->campoLista("visivel", "Situação", array("" => "Selecione", "1" => "Ativo", "2" => "Inativo"), $this->visivel); | |
| 147 | 151 | // Paginador |
| 148 | 152 | $this->limite = 20; |
| 149 | 153 | $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; |
| ... | ... | @@ -187,7 +191,7 @@ class indice extends clsListagem |
| 187 | 191 | null, |
| 188 | 192 | $this->ref_cod_curso, |
| 189 | 193 | $this->ref_cod_instituicao, |
| 190 | - null, null, null, null, null, $visivel | |
| 194 | + null, null, null, null, null, $visivel, null, null, $this->ano | |
| 191 | 195 | ); |
| 192 | 196 | |
| 193 | 197 | $total = $obj_turma->_total; |
| ... | ... | @@ -250,6 +254,7 @@ class indice extends clsListagem |
| 250 | 254 | |
| 251 | 255 | |
| 252 | 256 | $lista_busca = array( |
| 257 | + "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["ano"]}</a>", | |
| 253 | 258 | "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["nm_turma"]}</a>" |
| 254 | 259 | ); |
| 255 | 260 | |
| ... | ... | @@ -276,7 +281,7 @@ class indice extends clsListagem |
| 276 | 281 | else |
| 277 | 282 | $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">-</a>"; |
| 278 | 283 | |
| 279 | - $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["nm_instituicao"]}</a>"; | |
| 284 | + //$lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">{$registro["nm_instituicao"]}</a>"; | |
| 280 | 285 | } |
| 281 | 286 | else if ($nivel_usuario == 2) |
| 282 | 287 | { |
| ... | ... | @@ -291,7 +296,7 @@ class indice extends clsListagem |
| 291 | 296 | } |
| 292 | 297 | else |
| 293 | 298 | { |
| 294 | - $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">Desativo</a>"; | |
| 299 | + $lista_busca[] = "<a href=\"educar_turma_det.php?cod_turma={$registro["cod_turma"]}\">Inativo</a>"; | |
| 295 | 300 | } |
| 296 | 301 | $this->addLinhas($lista_busca); |
| 297 | 302 | } | ... | ... |
ieducar/intranet/include/clsCadastro.inc.php
| ... | ... | @@ -725,7 +725,7 @@ class clsCadastro extends clsCampos |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | |
| 728 | - public function inputsHelper() { | |
| 728 | + protected function inputsHelper() { | |
| 729 | 729 | if (! isset($this->_inputsHelper)) |
| 730 | 730 | $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); |
| 731 | 731 | ... | ... |
ieducar/intranet/include/clsListagem.inc.php
| ... | ... | @@ -35,6 +35,7 @@ if (class_exists('clsPmiajudaPagina')) { |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | require_once 'Portabilis/View/Helper/Application.php'; |
| 38 | +require_once 'Portabilis/View/Helper/Inputs.php'; | |
| 38 | 39 | |
| 39 | 40 | define('alTopLeft', 'valign=top align=left'); |
| 40 | 41 | define('alTopCenter', 'valign=top align=center'); |
| ... | ... | @@ -745,4 +746,11 @@ class clsListagem extends clsCampos |
| 745 | 746 | { |
| 746 | 747 | die("<div style='width: 300px; height: 100px; font: 700 11px Arial,Helv,Sans; background-color: #f6f6f6; color: #e11; position: absolute; left: 50%; top: 50%; margin-top: -20px; margin-left: -100px; text-align: center; border: solid 1px #a1a1f1;'>{$msg}</div><script>setTimeout('window.location=\'$redir\'',5000);</script>"); |
| 747 | 748 | } |
| 749 | + | |
| 750 | + public function inputsHelper() { | |
| 751 | + if (! isset($this->_inputsHelper)) | |
| 752 | + $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); | |
| 753 | + | |
| 754 | + return $this->_inputsHelper; | |
| 755 | + } | |
| 748 | 756 | } | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarEscolaAnoLetivo.inc.php
| ... | ... | @@ -107,13 +107,13 @@ class clsPmieducarEscolaAnoLetivo |
| 107 | 107 | * |
| 108 | 108 | * @return object |
| 109 | 109 | */ |
| 110 | - function clsPmieducarEscolaAnoLetivo( $ref_cod_escola = null, $ano = null, $ref_usuario_cad = null, $ref_usuario_exc = null, $andamento = null, $data_cadastro = null, $data_exclusao = null, $ativo = null ) | |
| 110 | + function clsPmieducarEscolaAnoLetivo( $ref_cod_escola = null, $ano = null, $ref_usuario_cad = null, $ref_usuario_exc = null, $andamento = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $turmas_por_ano = null ) | |
| 111 | 111 | { |
| 112 | 112 | $db = new clsBanco(); |
| 113 | 113 | $this->_schema = "pmieducar."; |
| 114 | 114 | $this->_tabela = "{$this->_schema}escola_ano_letivo"; |
| 115 | 115 | |
| 116 | - $this->_campos_lista = $this->_todos_campos = "ref_cod_escola, ano, ref_usuario_cad, ref_usuario_exc, andamento, data_cadastro, data_exclusao, ativo"; | |
| 116 | + $this->_campos_lista = $this->_todos_campos = "ref_cod_escola, ano, ref_usuario_cad, ref_usuario_exc, andamento, data_cadastro, data_exclusao, ativo, turmas_por_ano"; | |
| 117 | 117 | |
| 118 | 118 | if( is_numeric( $ref_usuario_exc ) ) |
| 119 | 119 | { |
| ... | ... | @@ -222,6 +222,7 @@ class clsPmieducarEscolaAnoLetivo |
| 222 | 222 | $this->ativo = $ativo; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | + $this->turmas_por_ano = $turmas_por_ano; | |
| 225 | 226 | } |
| 226 | 227 | |
| 227 | 228 | /** |
| ... | ... | @@ -263,13 +264,21 @@ class clsPmieducarEscolaAnoLetivo |
| 263 | 264 | $valores .= "{$gruda}'{$this->andamento}'"; |
| 264 | 265 | $gruda = ", "; |
| 265 | 266 | } |
| 267 | + | |
| 266 | 268 | $campos .= "{$gruda}data_cadastro"; |
| 267 | 269 | $valores .= "{$gruda}NOW()"; |
| 268 | 270 | $gruda = ", "; |
| 271 | + | |
| 269 | 272 | $campos .= "{$gruda}ativo"; |
| 270 | 273 | $valores .= "{$gruda}'1'"; |
| 271 | 274 | $gruda = ", "; |
| 272 | 275 | |
| 276 | + if( is_numeric( $this->turmas_por_ano ) ) | |
| 277 | + { | |
| 278 | + $campos .= "{$gruda}turmas_por_ano"; | |
| 279 | + $valores .= "{$gruda}'{$this->turmas_por_ano}'"; | |
| 280 | + $gruda = ", "; | |
| 281 | + } | |
| 273 | 282 | |
| 274 | 283 | $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); |
| 275 | 284 | return true; | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php
| ... | ... | @@ -126,13 +126,13 @@ class clsPmieducarTurma |
| 126 | 126 | * |
| 127 | 127 | * @return object |
| 128 | 128 | */ |
| 129 | - function clsPmieducarTurma( $cod_turma = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $ref_ref_cod_serie = null, $ref_ref_cod_escola = null, $ref_cod_infra_predio_comodo = null, $nm_turma = null, $sgl_turma = null, $max_aluno = null, $multiseriada = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $ref_cod_turma_tipo = null, $hora_inicial = null, $hora_final = null, $hora_inicio_intervalo = null, $hora_fim_intervalo = null, $ref_cod_regente = null, $ref_cod_instituicao_regente = null, $ref_cod_instituicao = null, $ref_cod_curso = null, $ref_ref_cod_serie_mult = null, $ref_ref_cod_escola_mult = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null) | |
| 129 | + function clsPmieducarTurma( $cod_turma = null, $ref_usuario_exc = null, $ref_usuario_cad = null, $ref_ref_cod_serie = null, $ref_ref_cod_escola = null, $ref_cod_infra_predio_comodo = null, $nm_turma = null, $sgl_turma = null, $max_aluno = null, $multiseriada = null, $data_cadastro = null, $data_exclusao = null, $ativo = null, $ref_cod_turma_tipo = null, $hora_inicial = null, $hora_final = null, $hora_inicio_intervalo = null, $hora_fim_intervalo = null, $ref_cod_regente = null, $ref_cod_instituicao_regente = null, $ref_cod_instituicao = null, $ref_cod_curso = null, $ref_ref_cod_serie_mult = null, $ref_ref_cod_escola_mult = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null) | |
| 130 | 130 | { |
| 131 | 131 | $db = new clsBanco(); |
| 132 | 132 | $this->_schema = "pmieducar."; |
| 133 | 133 | $this->_tabela = "{$this->_schema}turma"; |
| 134 | 134 | |
| 135 | - $this->_campos_lista = $this->_todos_campos = "t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie, t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma, t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo, t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo, t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult, t.ref_ref_cod_escola_mult, t.visivel, t.turma_turno_id, t.tipo_boletim"; | |
| 135 | + $this->_campos_lista = $this->_todos_campos = "t.cod_turma, t.ref_usuario_exc, t.ref_usuario_cad, t.ref_ref_cod_serie, t.ref_ref_cod_escola, t.ref_cod_infra_predio_comodo, t.nm_turma, t.sgl_turma, t.max_aluno, t.multiseriada, t.data_cadastro, t.data_exclusao, t.ativo, t.ref_cod_turma_tipo, t.hora_inicial, t.hora_final, t.hora_inicio_intervalo, t.hora_fim_intervalo, t.ref_cod_regente, t.ref_cod_instituicao_regente,t.ref_cod_instituicao, t.ref_cod_curso, t.ref_ref_cod_serie_mult, t.ref_ref_cod_escola_mult, t.visivel, t.turma_turno_id, t.tipo_boletim, t.ano"; | |
| 136 | 136 | |
| 137 | 137 | if( is_numeric( $ref_cod_turma_tipo ) ) |
| 138 | 138 | { |
| ... | ... | @@ -455,7 +455,7 @@ class clsPmieducarTurma |
| 455 | 455 | |
| 456 | 456 | $this->turma_turno_id = $turma_turno_id; |
| 457 | 457 | $this->tipo_boletim = $tipo_boletim; |
| 458 | - | |
| 458 | + $this->ano = $ano; | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
| ... | ... | @@ -610,6 +610,12 @@ class clsPmieducarTurma |
| 610 | 610 | $gruda = ", "; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | + if(is_numeric($this->ano)){ | |
| 614 | + $campos .= "{$gruda}ano"; | |
| 615 | + $valores .= "{$gruda}'{$this->ano}'"; | |
| 616 | + $gruda = ", "; | |
| 617 | + } | |
| 618 | + | |
| 613 | 619 | $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); |
| 614 | 620 | return $db->InsertId( "{$this->_tabela}_cod_turma_seq"); |
| 615 | 621 | } |
| ... | ... | @@ -762,7 +768,7 @@ class clsPmieducarTurma |
| 762 | 768 | $set .= "{$gruda}visivel = TRUE"; |
| 763 | 769 | $gruda = ", "; |
| 764 | 770 | } |
| 765 | - else | |
| 771 | + else | |
| 766 | 772 | { |
| 767 | 773 | $set .= "{$gruda}visivel = FALSE"; |
| 768 | 774 | $gruda = ", "; |
| ... | ... | @@ -786,6 +792,15 @@ class clsPmieducarTurma |
| 786 | 792 | $gruda = ", "; |
| 787 | 793 | } |
| 788 | 794 | |
| 795 | + if(is_numeric($this->ano)) { | |
| 796 | + $set .= "{$gruda}ano = '{$this->ano}'"; | |
| 797 | + $gruda = ", "; | |
| 798 | + } | |
| 799 | + else { | |
| 800 | + $set .= "{$gruda}ano = NULL"; | |
| 801 | + $gruda = ", "; | |
| 802 | + } | |
| 803 | + | |
| 789 | 804 | if( $set ) |
| 790 | 805 | { |
| 791 | 806 | $db->Consulta( "UPDATE {$this->_tabela} SET $set WHERE cod_turma = '{$this->cod_turma}'" ); |
| ... | ... | @@ -1131,7 +1146,7 @@ class clsPmieducarTurma |
| 1131 | 1146 | * |
| 1132 | 1147 | * @return array |
| 1133 | 1148 | */ |
| 1134 | - function lista( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $bool_verifica_serie_multiseriada = false, $bool_tem_alunos_aguardando_nota = null, $visivel = null, $turma_turno_id = null) | |
| 1149 | + function lista( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $bool_verifica_serie_multiseriada = false, $bool_tem_alunos_aguardando_nota = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null) | |
| 1135 | 1150 | { |
| 1136 | 1151 | |
| 1137 | 1152 | $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela} t"; |
| ... | ... | @@ -1335,7 +1350,7 @@ class clsPmieducarTurma |
| 1335 | 1350 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
| 1336 | 1351 | $whereAnd = " AND "; |
| 1337 | 1352 | } |
| 1338 | - else | |
| 1353 | + else | |
| 1339 | 1354 | { |
| 1340 | 1355 | $filtros .= "{$whereAnd} t.visivel = FALSE"; |
| 1341 | 1356 | $whereAnd = " AND "; |
| ... | ... | @@ -1346,17 +1361,27 @@ class clsPmieducarTurma |
| 1346 | 1361 | $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; |
| 1347 | 1362 | $whereAnd = " AND "; |
| 1348 | 1363 | } |
| 1349 | - else | |
| 1364 | + else | |
| 1350 | 1365 | { |
| 1351 | 1366 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
| 1352 | 1367 | $whereAnd = " AND "; |
| 1353 | 1368 | } |
| 1354 | - if( is_numeric( $turma_turno_id ) ) | |
| 1355 | - { | |
| 1369 | + | |
| 1370 | + if( is_numeric( $turma_turno_id ) ) { | |
| 1356 | 1371 | $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; |
| 1357 | 1372 | $whereAnd = " AND "; |
| 1358 | 1373 | } |
| 1359 | 1374 | |
| 1375 | + if( is_numeric( $tipo_boletim ) ) { | |
| 1376 | + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; | |
| 1377 | + $whereAnd = " AND "; | |
| 1378 | + } | |
| 1379 | + | |
| 1380 | + if( is_numeric( $ano ) ) { | |
| 1381 | + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; | |
| 1382 | + $whereAnd = " AND "; | |
| 1383 | + } | |
| 1384 | + | |
| 1360 | 1385 | $db = new clsBanco(); |
| 1361 | 1386 | $countCampos = count( explode( ",", $this->_campos_lista ) ); |
| 1362 | 1387 | $resultado = array(); |
| ... | ... | @@ -1398,7 +1423,7 @@ class clsPmieducarTurma |
| 1398 | 1423 | * |
| 1399 | 1424 | * @return array |
| 1400 | 1425 | */ |
| 1401 | - function lista2( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null ) | |
| 1426 | + function lista2( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) | |
| 1402 | 1427 | { |
| 1403 | 1428 | |
| 1404 | 1429 | /*$nm_escola = "( |
| ... | ... | @@ -1595,7 +1620,7 @@ and e.cod_escola = t.ref_ref_cod_escola |
| 1595 | 1620 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
| 1596 | 1621 | $whereAnd = " AND "; |
| 1597 | 1622 | } |
| 1598 | - else | |
| 1623 | + else | |
| 1599 | 1624 | { |
| 1600 | 1625 | $filtros .= "{$whereAnd} t.visivel = FALSE"; |
| 1601 | 1626 | $whereAnd = " AND "; |
| ... | ... | @@ -1606,12 +1631,26 @@ and e.cod_escola = t.ref_ref_cod_escola |
| 1606 | 1631 | $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; |
| 1607 | 1632 | $whereAnd = " AND "; |
| 1608 | 1633 | } |
| 1609 | - else | |
| 1634 | + else | |
| 1610 | 1635 | { |
| 1611 | 1636 | $filtros .= "{$whereAnd} t.visivel = TRUE"; |
| 1612 | 1637 | $whereAnd = " AND "; |
| 1613 | 1638 | } |
| 1614 | 1639 | |
| 1640 | + if( is_numeric( $turma_turno_id ) ) { | |
| 1641 | + $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; | |
| 1642 | + $whereAnd = " AND "; | |
| 1643 | + } | |
| 1644 | + | |
| 1645 | + if( is_numeric( $tipo_boletim ) ) { | |
| 1646 | + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; | |
| 1647 | + $whereAnd = " AND "; | |
| 1648 | + } | |
| 1649 | + | |
| 1650 | + if( is_numeric( $ano ) ) { | |
| 1651 | + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; | |
| 1652 | + $whereAnd = " AND "; | |
| 1653 | + } | |
| 1615 | 1654 | |
| 1616 | 1655 | $db = new clsBanco(); |
| 1617 | 1656 | $countCampos = count( explode( ",", $this->_campos_lista ) ); | ... | ... |
ieducar/lib/Portabilis/Controller/Page/ListController.php
| ... | ... | @@ -50,13 +50,6 @@ class Portabilis_Controller_Page_ListController extends Core_Controller_Page_Lis |
| 50 | 50 | parent::__construct(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - protected function inputsHelper() { | |
| 54 | - if (! isset($this->_inputsHelper)) | |
| 55 | - $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); | |
| 56 | - | |
| 57 | - return $this->_inputsHelper; | |
| 58 | - } | |
| 59 | - | |
| 60 | 53 | protected function loadResourceAssets($dispatcher){ |
| 61 | 54 | $rootPath = $_SERVER['DOCUMENT_ROOT']; |
| 62 | 55 | $controllerName = ucwords($dispatcher->getControllerName()); | ... | ... |
ieducar/lib/Portabilis/View/Helper/DynamicInput/Turma.php
| ... | ... | @@ -53,7 +53,8 @@ class Portabilis_View_Helper_DynamicInput_Turma extends Portabilis_View_Helper_D |
| 53 | 53 | $instituicaoId = $this->getInstituicaoId($options['instituicaoId']); |
| 54 | 54 | $escolaId = $this->getEscolaId($options['escolaId']); |
| 55 | 55 | $serieId = $this->getSerieId($options['serieId']); |
| 56 | - //$cursoId = $this->getCursoId($options['cursoId']); | |
| 56 | + $ano = $this->viewInstance->ano; | |
| 57 | + | |
| 57 | 58 | $userId = $this->getCurrentUserId(); |
| 58 | 59 | $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); |
| 59 | 60 | |
| ... | ... | @@ -64,9 +65,33 @@ class Portabilis_View_Helper_DynamicInput_Turma extends Portabilis_View_Helper_D |
| 64 | 65 | elseif ($escolaId && $serieId && empty($resources)) |
| 65 | 66 | $resources = App_Model_IedFinder::getTurmas($escolaId, $serieId); |
| 66 | 67 | |
| 68 | + | |
| 69 | + // caso no letivo esteja definido para filtrar turmas por ano, | |
| 70 | + // somente exibe as turmas do ano letivo. | |
| 71 | + | |
| 72 | + if ($escolaId && $ano && $this->turmasPorAno($escolaId, $ano)) { | |
| 73 | + foreach ($resources as $id => $nome) { | |
| 74 | + $turma = new clsPmieducarTurma(); | |
| 75 | + $turma->cod_turma = $id; | |
| 76 | + $turma = $turma->detalhe(); | |
| 77 | + | |
| 78 | + if ($turma['ano'] != $ano) | |
| 79 | + unset($resources[$id]); | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 67 | 83 | return $this->insertOption(null, "Selecione uma turma", $resources); |
| 68 | 84 | } |
| 69 | 85 | |
| 86 | + protected function turmasPorAno($escolaId, $ano) { | |
| 87 | + $anoLetivo = new clsPmieducarEscolaAnoLetivo(); | |
| 88 | + $anoLetivo->ref_cod_escola = $escolaId; | |
| 89 | + $anoLetivo->ano = $ano; | |
| 90 | + $anoLetivo = $anoLetivo->detalhe(); | |
| 91 | + | |
| 92 | + return ($anoLetivo['turmas_por_ano'] == 1); | |
| 93 | + } | |
| 94 | + | |
| 70 | 95 | public function turma($options = array()) { |
| 71 | 96 | parent::select($options); |
| 72 | 97 | } | ... | ... |
ieducar/misc/database/deltas/portabilis/50_adiciona_ano_em_turma_e_turmas_por_ano_em_escola_ano_letivo.sql
0 → 100644
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | + -- // | |
| 2 | + | |
| 3 | + -- | |
| 4 | + -- Adiciona ano em em pmieducar.turma e turmas_por_ano em pmieducar.escola_ano_letivo | |
| 5 | + -- @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
| 6 | + -- @license @@license@@ | |
| 7 | + -- @version $Id$ | |
| 8 | + | |
| 9 | + ALTER TABLE pmieducar.turma ADD COLUMN ano integer; | |
| 10 | + ALTER TABLE pmieducar.escola_ano_letivo ADD COLUMN turmas_por_ano smallint; | |
| 11 | + | |
| 12 | + -- //@UNDO | |
| 13 | + | |
| 14 | + ALTER TABLE pmieducar.turma DROP COLUMN ano; | |
| 15 | + ALTER TABLE pmieducar.escola_ano_letivo DROP COLUMN turmas_por_ano; | |
| 16 | + | |
| 17 | + -- // | ... | ... |
ieducar/modules/DynamicInput/Assets/Javascripts/Turma.js
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | var $serieField = getElementFor('serie'); |
| 9 | 9 | var $turmaField = getElementFor('turma'); |
| 10 | + var $ano = getElementFor('ano'); | |
| 10 | 11 | |
| 11 | 12 | var handleGetTurmas = function(response) { |
| 12 | 13 | var selectOptions = jsonResourcesToSelectOptions(response['options']); |
| ... | ... | @@ -20,9 +21,10 @@ |
| 20 | 21 | $turmaField.children().first().html('Aguarde carregando...'); |
| 21 | 22 | |
| 22 | 23 | var urlForGetTurmas = getResourceUrlBuilder.buildUrl('/module/DynamicInput/turma', 'turmas', { |
| 23 | - instituicao_id : $instituicaoField.attr('value'), | |
| 24 | - escola_id : $escolaField.attr('value'), | |
| 25 | - serie_id : $serieField.attr('value') | |
| 24 | + instituicao_id : $instituicaoField.val(), | |
| 25 | + escola_id : $escolaField.val(), | |
| 26 | + serie_id : $serieField.val(), | |
| 27 | + ano : $ano.val() | |
| 26 | 28 | }); |
| 27 | 29 | |
| 28 | 30 | var options = { | ... | ... |
ieducar/modules/DynamicInput/Views/TurmaController.php
| ... | ... | @@ -55,12 +55,22 @@ class TurmaController extends ApiCoreController |
| 55 | 55 | $this->validatesId('serie'); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + protected function turmasPorAno($escolaId, $ano) { | |
| 59 | + $anoLetivo = new clsPmieducarEscolaAnoLetivo(); | |
| 60 | + $anoLetivo->ref_cod_escola = $escolaId; | |
| 61 | + $anoLetivo->ano = $ano; | |
| 62 | + $anoLetivo = $anoLetivo->detalhe(); | |
| 63 | + | |
| 64 | + return ($anoLetivo['turmas_por_ano'] == 1); | |
| 65 | + } | |
| 66 | + | |
| 58 | 67 | protected function getTurmas() { |
| 59 | 68 | if ($this->canGetTurmas()) { |
| 60 | 69 | $userId = $this->getSession()->id_pessoa; |
| 61 | 70 | $instituicaoId = $this->getRequest()->instituicao_id; |
| 62 | 71 | $escolaId = $this->getRequest()->escola_id; |
| 63 | 72 | $serieId = $this->getRequest()->serie_id; |
| 73 | + $ano = $this->getRequest()->ano; | |
| 64 | 74 | |
| 65 | 75 | $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); |
| 66 | 76 | |
| ... | ... | @@ -68,13 +78,27 @@ class TurmaController extends ApiCoreController |
| 68 | 78 | $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); |
| 69 | 79 | |
| 70 | 80 | else { |
| 71 | - $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1 | |
| 81 | + $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1 | |
| 72 | 82 | and (ref_ref_cod_serie = $2 or ref_ref_cod_serie_mult = $2) and ativo = 1 and |
| 73 | 83 | visivel != 'f' order by nm_turma asc"; |
| 74 | 84 | |
| 75 | 85 | $turmas = $this->fetchPreparedQuery($sql, array($escolaId, $serieId)); |
| 76 | 86 | } |
| 77 | 87 | |
| 88 | + // caso no ano letivo esteja definido para filtrar turmas por ano, | |
| 89 | + // somente retorna as turmas do ano letivo. | |
| 90 | + | |
| 91 | + if ($ano && $this->turmasPorAno($escolaId, $ano)) { | |
| 92 | + foreach ($turmas as $index => $t) { | |
| 93 | + $turma = new clsPmieducarTurma(); | |
| 94 | + $turma->cod_turma = $t['id']; | |
| 95 | + $turma = $turma->detalhe(); | |
| 96 | + | |
| 97 | + if ($turma['ano'] != $ano) | |
| 98 | + unset($turmas[$index]); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 78 | 102 | $options = array(); |
| 79 | 103 | foreach ($turmas as $turma) |
| 80 | 104 | $options['__' . $turma['id']] = $this->toUtf8($turma['nome']); | ... | ... |
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Process.js
| ... | ... | @@ -256,7 +256,5 @@ var $resultTable = $j('#form_resultado .tablelistagem').addClass('horizontal-exp |
| 256 | 256 | onClickSelectAllEvent ? $selectAllButton.click(onClickSelectAllEvent) : $selectAllButton.hide(); |
| 257 | 257 | onClickActionEvent ? $actionButton.click(onClickActionEvent) : $actionButton.hide(); |
| 258 | 258 | onClickDeleteEvent ? $deleteButton.click(onClickDeleteEvent) : $deleteButton.hide(); |
| 259 | - | |
| 260 | - fixupFieldsWidth(); | |
| 261 | 259 | }); // ready |
| 262 | 260 | })(jQuery); | ... | ... |