Commit 62cc731ca062cac3e66afca3616f16b596035ba4
Committed by
Fabiana Ofugi
1 parent
70dd6f62
Exists in
master
Campo turma adicionado na matricula de aluno, faltando salvar no banco de dados …
…da tabela pmieducar.matricula_turma
Showing
1 changed file
with
45 additions
and
5 deletions
Show diff stats
ieducar/intranet/educar_matricula_cad.php
| ... | ... | @@ -32,6 +32,7 @@ require_once 'include/clsBase.inc.php'; |
| 32 | 32 | require_once 'include/clsCadastro.inc.php'; |
| 33 | 33 | require_once 'include/clsBanco.inc.php'; |
| 34 | 34 | require_once 'include/pmieducar/geral.inc.php'; |
| 35 | +require_once 'include/pmieducar/clsPmieducarMatriculaTurma.inc.php'; | |
| 35 | 36 | |
| 36 | 37 | /** |
| 37 | 38 | * clsIndexBase class. |
| ... | ... | @@ -82,6 +83,7 @@ class indice extends clsCadastro |
| 82 | 83 | var $ref_cod_instituicao; |
| 83 | 84 | var $ref_cod_curso; |
| 84 | 85 | var $ref_cod_escola; |
| 86 | + var $ref_cod_turma; | |
| 85 | 87 | |
| 86 | 88 | var $matricula_transferencia; |
| 87 | 89 | var $semestre; |
| ... | ... | @@ -97,7 +99,7 @@ class indice extends clsCadastro |
| 97 | 99 | |
| 98 | 100 | $this->cod_matricula = $_GET['cod_matricula']; |
| 99 | 101 | $this->ref_cod_aluno = $_GET['ref_cod_aluno']; |
| 100 | - | |
| 102 | + | |
| 101 | 103 | $obj_aluno = new clsPmieducarAluno($this->ref_cod_aluno); |
| 102 | 104 | |
| 103 | 105 | if (! $obj_aluno->existe()) { |
| ... | ... | @@ -157,7 +159,7 @@ class indice extends clsCadastro |
| 157 | 159 | |
| 158 | 160 | $anoLetivoHelperOptions = array('situacoes' => array('em_andamento', 'nao_iniciado')); |
| 159 | 161 | |
| 160 | - $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie')); | |
| 162 | + $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma')); | |
| 161 | 163 | $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions); |
| 162 | 164 | |
| 163 | 165 | |
| ... | ... | @@ -258,6 +260,14 @@ class indice extends clsCadastro |
| 258 | 260 | $serie = $serie['nm_serie']; |
| 259 | 261 | else |
| 260 | 262 | $serie = ''; |
| 263 | + | |
| 264 | +// $turma = new clsPmieducarTurma($m['ref_cod_turma'], null, null, $m['ref_ref_cod_serie'], null, null, $m['ref_cod_curso']); | |
| 265 | +// $turma = $turma->detalhe(); | |
| 266 | +// if (is_array($turma) && count($turma)) | |
| 267 | +// $turma = $turma['nm_turma']; | |
| 268 | +// else | |
| 269 | +// $turma = ''; | |
| 270 | + | |
| 261 | 271 | |
| 262 | 272 | $escola = new clsPmieducarEscola($m['ref_ref_cod_escola']); |
| 263 | 273 | $escola = $escola->detalhe(); |
| ... | ... | @@ -284,7 +294,7 @@ class indice extends clsCadastro |
| 284 | 294 | |
| 285 | 295 | return false; |
| 286 | 296 | } |
| 287 | - } | |
| 297 | + } | |
| 288 | 298 | |
| 289 | 299 | $obj_reserva_vaga = new clsPmieducarReservaVaga(); |
| 290 | 300 | $lst_reserva_vaga = $obj_reserva_vaga->lista(NULL, $this->ref_cod_escola, |
| ... | ... | @@ -385,7 +395,7 @@ class indice extends clsCadastro |
| 385 | 395 | if (! $this->removerFlagUltimaMatricula($this->ref_cod_aluno)) { |
| 386 | 396 | return false; |
| 387 | 397 | } |
| 388 | - | |
| 398 | + | |
| 389 | 399 | $obj = new clsPmieducarMatricula(NULL, $this->ref_cod_reserva_vaga, |
| 390 | 400 | $this->ref_cod_escola, $this->ref_cod_serie, NULL, |
| 391 | 401 | $this->pessoa_logada, $this->ref_cod_aluno, 3, NULL, NULL, 1, $this->ano, |
| ... | ... | @@ -393,6 +403,9 @@ class indice extends clsCadastro |
| 393 | 403 | $this->matricula_transferencia, $this->semestre); |
| 394 | 404 | |
| 395 | 405 | $cadastrou = $obj->cadastra(); |
| 406 | + | |
| 407 | + $this->ref_cod_turma = $_POST['ref_cod_turma']; | |
| 408 | + $this->enturmacaoMatricula($this->cod_matricula, $this->ref_cod_turma); | |
| 396 | 409 | if ($cadastrou) { |
| 397 | 410 | |
| 398 | 411 | $obj_transferencia = new clsPmieducarTransferenciaSolicitacao(); |
| ... | ... | @@ -527,7 +540,7 @@ class indice extends clsCadastro |
| 527 | 540 | #die(); |
| 528 | 541 | #return true; |
| 529 | 542 | } |
| 530 | - | |
| 543 | + | |
| 531 | 544 | $this->mensagem = 'Cadastro não realizado.<br />'; |
| 532 | 545 | return FALSE; |
| 533 | 546 | } |
| ... | ... | @@ -652,6 +665,33 @@ class indice extends clsCadastro |
| 652 | 665 | |
| 653 | 666 | return true; |
| 654 | 667 | } |
| 668 | + | |
| 669 | + function enturmacaoMatricula($matriculaId, $turmaDestinoId) { | |
| 670 | + | |
| 671 | + $enturmacaoExists = new clsPmieducarMatriculaTurma(); | |
| 672 | + $enturmacaoExists = $enturmacaoExists->lista($matriculaId, | |
| 673 | + $turmaDestinoId, | |
| 674 | + NULL, | |
| 675 | + NULL, | |
| 676 | + NULL, | |
| 677 | + NULL, | |
| 678 | + NULL, | |
| 679 | + NULL, | |
| 680 | + 1); | |
| 681 | + | |
| 682 | + $enturmacaoExists = is_array($enturmacaoExists) && count($enturmacaoExists) > 0; | |
| 683 | + if (! $enturmacaoExists) { | |
| 684 | + $enturmacao = new clsPmieducarMatriculaTurma($matriculaId, | |
| 685 | + $turmaDestinoId, | |
| 686 | + $this->pessoa_logada, | |
| 687 | + $this->pessoa_logada, | |
| 688 | + NULL, | |
| 689 | + NULL, | |
| 690 | + 1); | |
| 691 | + return $enturmacao->cadastra(); | |
| 692 | + } | |
| 693 | + return false; | |
| 694 | + } | |
| 655 | 695 | } |
| 656 | 696 | |
| 657 | 697 | // Instancia objeto de página | ... | ... |