Commit 6258eb39960e5b1aec6b90e8ef8d782c74bee243
1 parent
2ea620cb
Exists in
master
Ajustado campo de turma para respeitar o ano em andamento;
portabilis/ieducar#164
Showing
4 changed files
with
30 additions
and
3 deletions
Show diff stats
ieducar/intranet/educar_matricula_cad.php
| ... | ... | @@ -175,7 +175,8 @@ class indice extends clsCadastro |
| 175 | 175 | $this->inputsHelper()->dynamic('turma', array('required' => false, 'option value' => 'Selecione uma turma')); |
| 176 | 176 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); |
| 177 | 177 | $this->inputsHelper()->date('data_matricula', array('label' => 'Data da matrícula', 'placeholder' => 'dd/mm/yyyy', 'value' => date('d/m/Y') )); |
| 178 | - | |
| 178 | + | |
| 179 | + $this->inputsHelper()->hidden('ano_em_andamento', array('value' => '1')); | |
| 179 | 180 | |
| 180 | 181 | if (is_numeric($this->ref_cod_curso)) { |
| 181 | 182 | $obj_curso = new clsPmieducarCurso($this->ref_cod_curso); | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php
| ... | ... | @@ -2097,5 +2097,17 @@ and e.cod_escola = t.ref_ref_cod_escola |
| 2097 | 2097 | return ""; |
| 2098 | 2098 | } |
| 2099 | 2099 | |
| 2100 | + function checaAnoLetivoEmAndamento() | |
| 2101 | + { | |
| 2102 | + if( is_numeric( $this->cod_turma ) ) | |
| 2103 | + { | |
| 2104 | + | |
| 2105 | + $db = new clsBanco(); | |
| 2106 | + $db->Consulta( "SELECT 1 FROM {$this->_tabela} WHERE cod_turma = '{$this->cod_turma}' AND turma.ano = ( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = turma.ref_ref_cod_escola AND andamento = 1)" ); | |
| 2107 | + $db->ProximoRegistro(); | |
| 2108 | + return $db->Tupla(); | |
| 2109 | + } | |
| 2110 | + return false; | |
| 2111 | + } | |
| 2100 | 2112 | } |
| 2101 | 2113 | ?> | ... | ... |
ieducar/modules/DynamicInput/Assets/Javascripts/Turma.js
| ... | ... | @@ -9,7 +9,8 @@ |
| 9 | 9 | var $turmaField = getElementFor('turma'); |
| 10 | 10 | var $ano = getElementFor('ano'); |
| 11 | 11 | |
| 12 | - var $naoFiltrarAno = getElementFor('nao_filtrar_ano') || null; | |
| 12 | + var $naoFiltrarAno = $j('#nao_filtrar_ano').length > 0 ? 1 : false; | |
| 13 | + var anoEmAndamento = $j('#ano_em_andamento').length > 0 ? 1 : false; | |
| 13 | 14 | |
| 14 | 15 | var handleGetTurmas = function(response) { |
| 15 | 16 | var selectOptions = jsonResourcesToSelectOptions(response['options']); |
| ... | ... | @@ -27,7 +28,8 @@ |
| 27 | 28 | escola_id : $escolaField.val(), |
| 28 | 29 | serie_id : $serieField.val(), |
| 29 | 30 | ano : $naoFiltrarAno ? null : $ano.val(), |
| 30 | - nao_filtrar_ano : $naoFiltrarAno ? 1 : null | |
| 31 | + nao_filtrar_ano : $naoFiltrarAno ? 1 : null, | |
| 32 | + ano_em_andamento : anoEmAndamento ? 1 : null | |
| 31 | 33 | }); |
| 32 | 34 | |
| 33 | 35 | var options = { | ... | ... |
ieducar/modules/DynamicInput/Views/TurmaController.php
| ... | ... | @@ -71,6 +71,7 @@ class TurmaController extends ApiCoreController |
| 71 | 71 | $escolaId = $this->getRequest()->escola_id; |
| 72 | 72 | $serieId = $this->getRequest()->serie_id; |
| 73 | 73 | $ano = $this->getRequest()->ano; |
| 74 | + $anoEmAndamento = $this->getRequest()->ano_em_andamento; | |
| 74 | 75 | |
| 75 | 76 | $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); |
| 76 | 77 | |
| ... | ... | @@ -99,6 +100,17 @@ class TurmaController extends ApiCoreController |
| 99 | 100 | } |
| 100 | 101 | } |
| 101 | 102 | |
| 103 | + if ($anoEmAndamento == 1) { | |
| 104 | + foreach ($turmas as $index => $t) { | |
| 105 | + $turma = new clsPmieducarTurma(); | |
| 106 | + $turma->cod_turma = $t['id']; | |
| 107 | + $turma = $turma->checaAnoLetivoEmAndamento(); | |
| 108 | + | |
| 109 | + if (!$turma) | |
| 110 | + unset($turmas[$index]); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 102 | 114 | $options = array(); |
| 103 | 115 | foreach ($turmas as $turma) |
| 104 | 116 | $options['__' . $turma['id']] = $this->toUtf8($turma['nome']); | ... | ... |