Commit 937786e865f3783b0a1cdbc3d698ba5fd50fbe67

Authored by Rafael Santos
2 parents 61b1fc2e 91e2fa5c
Exists in master

Merge branch 'devel-unb' of https://github.com/i-educar-unb/ieducar into devel-unb

ieducar/intranet/educar_matricula_cad.php
... ... @@ -82,6 +82,7 @@ class indice extends clsCadastro
82 82 var $ref_cod_instituicao;
83 83 var $ref_cod_curso;
84 84 var $ref_cod_escola;
  85 + var $ref_cod_turma;
85 86  
86 87 var $matricula_transferencia;
87 88 var $semestre;
... ... @@ -97,7 +98,7 @@ class indice extends clsCadastro
97 98  
98 99 $this->cod_matricula = $_GET['cod_matricula'];
99 100 $this->ref_cod_aluno = $_GET['ref_cod_aluno'];
100   -
  101 +
101 102 $obj_aluno = new clsPmieducarAluno($this->ref_cod_aluno);
102 103  
103 104 if (! $obj_aluno->existe()) {
... ... @@ -158,8 +159,9 @@ class indice extends clsCadastro
158 159 $anoLetivoHelperOptions = array('situacoes' => array('em_andamento', 'nao_iniciado'));
159 160  
160 161 $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie'));
  162 + $this->inputsHelper()->dynamic('turma', array('required' => false, 'option value' => 'Enturmar depois'));
161 163 $this->inputsHelper()->dynamic('anoLetivo', array('label' => 'Ano destino'), $anoLetivoHelperOptions);
162   -
  164 +
163 165  
164 166 if (is_numeric($this->ref_cod_curso)) {
165 167 $obj_curso = new clsPmieducarCurso($this->ref_cod_curso);
... ... @@ -257,7 +259,7 @@ class indice extends clsCadastro
257 259 if (is_array($serie) && count($serie))
258 260 $serie = $serie['nm_serie'];
259 261 else
260   - $serie = '';
  262 + $serie = '';
261 263  
262 264 $escola = new clsPmieducarEscola($m['ref_ref_cod_escola']);
263 265 $escola = $escola->detalhe();
... ... @@ -284,7 +286,7 @@ class indice extends clsCadastro
284 286  
285 287 return false;
286 288 }
287   - }
  289 + }
288 290  
289 291 $obj_reserva_vaga = new clsPmieducarReservaVaga();
290 292 $lst_reserva_vaga = $obj_reserva_vaga->lista(NULL, $this->ref_cod_escola,
... ... @@ -385,7 +387,7 @@ class indice extends clsCadastro
385 387 if (! $this->removerFlagUltimaMatricula($this->ref_cod_aluno)) {
386 388 return false;
387 389 }
388   -
  390 +
389 391 $obj = new clsPmieducarMatricula(NULL, $this->ref_cod_reserva_vaga,
390 392 $this->ref_cod_escola, $this->ref_cod_serie, NULL,
391 393 $this->pessoa_logada, $this->ref_cod_aluno, 3, NULL, NULL, 1, $this->ano,
... ... @@ -393,6 +395,11 @@ class indice extends clsCadastro
393 395 $this->matricula_transferencia, $this->semestre);
394 396  
395 397 $cadastrou = $obj->cadastra();
  398 +
  399 + // turma
  400 + $cod_matricula = $cadastrou;
  401 + $this->enturmacaoMatricula($cod_matricula, $this->ref_cod_turma);
  402 +
396 403 if ($cadastrou) {
397 404  
398 405 $obj_transferencia = new clsPmieducarTransferenciaSolicitacao();
... ... @@ -527,7 +534,7 @@ class indice extends clsCadastro
527 534 #die();
528 535 #return true;
529 536 }
530   -
  537 +
531 538 $this->mensagem = 'Cadastro não realizado.<br />';
532 539 return FALSE;
533 540 }
... ... @@ -652,6 +659,33 @@ class indice extends clsCadastro
652 659  
653 660 return true;
654 661 }
  662 +
  663 + function enturmacaoMatricula($matriculaId, $turmaDestinoId) {
  664 +
  665 + $enturmacaoExists = new clsPmieducarMatriculaTurma();
  666 + $enturmacaoExists = $enturmacaoExists->lista($matriculaId,
  667 + $turmaDestinoId,
  668 + NULL,
  669 + NULL,
  670 + NULL,
  671 + NULL,
  672 + NULL,
  673 + NULL,
  674 + 1);
  675 +
  676 + $enturmacaoExists = is_array($enturmacaoExists) && count($enturmacaoExists) > 0;
  677 + if (! $enturmacaoExists) {
  678 + $enturmacao = new clsPmieducarMatriculaTurma($matriculaId,
  679 + $turmaDestinoId,
  680 + $this->pessoa_logada,
  681 + $this->pessoa_logada,
  682 + NULL,
  683 + NULL,
  684 + 1);
  685 + return $enturmacao->cadastra();
  686 + }
  687 + return false;
  688 + }
655 689 }
656 690  
657 691 // Instancia objeto de página
... ...
ieducar/lib/Portabilis/View/Helper/DynamicInput/Turma.php
... ... @@ -80,7 +80,7 @@ class Portabilis_View_Helper_DynamicInput_Turma extends Portabilis_View_Helper_D
80 80 }
81 81 }
82 82  
83   - return $this->insertOption(null, "Selecione uma turma", $resources);
  83 + return $this->insertOption(null, "Enturmar depois", $resources);
84 84 }
85 85  
86 86 protected function turmasPorAno($escolaId, $ano) {
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Turma.js
... ... @@ -11,7 +11,7 @@
11 11  
12 12 var handleGetTurmas = function(response) {
13 13 var selectOptions = jsonResourcesToSelectOptions(response['options']);
14   - updateSelect($turmaField, selectOptions, "Selecione uma turma");
  14 + updateSelect($turmaField, selectOptions, "Enturmar depois");
15 15 }
16 16  
17 17 var updateTurmas = function(){
... ...