Commit f54fe0f72e8d6aa8483d3afa5610a11faeb89432
1 parent
4beda40e
Exists in
master
Alterado cadastro de turmas
Alterado para que na edição de turmas com alunos enturmados campos como instituição, escola, curso, série fiquem desabilitados para evitar inconsistências; portabilis/ieducar#30
Showing
1 changed file
with
32 additions
and
4 deletions
Show diff stats
ieducar/intranet/educar_turma_cad.php
| ... | ... | @@ -191,6 +191,29 @@ class indice extends clsCadastro |
| 191 | 191 | $sem_padrao = TRUE; |
| 192 | 192 | $get_curso = TRUE; |
| 193 | 193 | |
| 194 | + $bloqueia = false; | |
| 195 | + $anoVisivel = false; | |
| 196 | + if (isset($this->ano) || !is_numeric($this->cod_turma)){ | |
| 197 | + $anoVisivel=true; | |
| 198 | + } | |
| 199 | + if(! isset($this->cod_turma)){ | |
| 200 | + $bloqueia = false; | |
| 201 | + }else{ | |
| 202 | + if (is_numeric($this->cod_turma)) { | |
| 203 | + $obj_matriculas_turma = new clsPmieducarMatriculaTurma(); | |
| 204 | + $obj_matriculas_turma->setOrderby('nome_aluno'); | |
| 205 | + $lst_matriculas_turma = $obj_matriculas_turma->lista(NULL, $this->cod_turma, | |
| 206 | + NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, | |
| 207 | + array(1, 2, 3), NULL, NULL, NULL, NULL, TRUE, NULL, 1, TRUE); | |
| 208 | + | |
| 209 | + if (is_array($lst_matriculas_turma) && count($lst_matriculas_turma)>0) { | |
| 210 | + $bloqueia = true; | |
| 211 | + } | |
| 212 | + } | |
| 213 | + } | |
| 214 | + | |
| 215 | + $desabilitado = $bloqueia; | |
| 216 | + | |
| 194 | 217 | include 'include/pmieducar/educar_campo_lista.php'; |
| 195 | 218 | |
| 196 | 219 | if ($this->ref_cod_escola) { |
| ... | ... | @@ -225,12 +248,14 @@ class indice extends clsCadastro |
| 225 | 248 | } |
| 226 | 249 | |
| 227 | 250 | $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, |
| 228 | - '', FALSE, '', $script); | |
| 251 | + '', FALSE, '', $script, $bloqueia); | |
| 229 | 252 | |
| 230 | 253 | // o campo ano somente é exibido para turmas novas ou cadastradas após inclusão deste campo. |
| 231 | - if (! isset($this->cod_turma) || isset($this->ano)) | |
| 232 | - $this->inputsHelper()->dynamic('anoLetivo'); | |
| 233 | - | |
| 254 | + if ($anoVisivel){ | |
| 255 | + $this->inputsHelper()->dynamic('anoLetivo', array('disabled' => $bloqueia)); | |
| 256 | + if($bloqueia) | |
| 257 | + $this->inputsHelper()->hidden('ano_hidden', array('value' => $this->ano)); | |
| 258 | + } | |
| 234 | 259 | // Infra prédio cômodo |
| 235 | 260 | $opcoes = array('' => 'Selecione'); |
| 236 | 261 | |
| ... | ... | @@ -789,6 +814,9 @@ class indice extends clsCadastro |
| 789 | 814 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
| 790 | 815 | @session_write_close(); |
| 791 | 816 | |
| 817 | + if(is_numeric($this->ano_hidden)) | |
| 818 | + $this->ano = $this->ano_hidden; | |
| 819 | + | |
| 792 | 820 | $this->ref_cod_instituicao_regente = $this->ref_cod_instituicao; |
| 793 | 821 | |
| 794 | 822 | if (isset($this->multiseriada)) { | ... | ... |