Commit c8c9ad32bc54535cabdee7192128f960079a2f4e
1 parent
2ec380bb
Exists in
master
Atualizada funcionalidade Dispensa de Componente Curricular para buscar os compo…
…nentes através da API de {{{App_Model_IedFinder}}}. '''Observação:''' agora o aluno só pode ser dispensado quando estiver enturmado, já que uma turma pode ter componentes curriculares específicos a ela
Showing
4 changed files
with
34 additions
and
27 deletions
Show diff stats
ieducar/intranet/educar_dispensa_disciplina_cad.php
@@ -168,8 +168,6 @@ class indice extends clsCadastro | @@ -168,8 +168,6 @@ class indice extends clsCadastro | ||
168 | $det_escola = $obj_escola->detalhe(); | 168 | $det_escola = $obj_escola->detalhe(); |
169 | $this->ref_cod_instituicao = $det_escola['ref_cod_instituicao']; | 169 | $this->ref_cod_instituicao = $det_escola['ref_cod_instituicao']; |
170 | 170 | ||
171 | - $this->campoRotulo('nm_aluno', 'Nome do Aluno', $det_aluno['nome_aluno']); | ||
172 | - | ||
173 | $obj_matricula_turma = new clsPmieducarMatriculaTurma(); | 171 | $obj_matricula_turma = new clsPmieducarMatriculaTurma(); |
174 | $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, | 172 | $lst_matricula_turma = $obj_matricula_turma->lista($this->ref_cod_matricula, |
175 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, NULL, | 173 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, NULL, |
@@ -181,6 +179,13 @@ class indice extends clsCadastro | @@ -181,6 +179,13 @@ class indice extends clsCadastro | ||
181 | $this->ref_sequencial = $det['sequencial']; | 179 | $this->ref_sequencial = $det['sequencial']; |
182 | } | 180 | } |
183 | 181 | ||
182 | + $this->campoRotulo('nm_aluno', 'Nome do Aluno', $det_aluno['nome_aluno']); | ||
183 | + | ||
184 | + if (!isset($this->ref_cod_turma)) { | ||
185 | + $this->mensagem = 'Para dispensar um aluno de um componente curricular, é necessário que este esteja enturmado.'; | ||
186 | + return; | ||
187 | + } | ||
188 | + | ||
184 | // primary keys | 189 | // primary keys |
185 | $this->campoOculto('ref_cod_matricula', $this->ref_cod_matricula); | 190 | $this->campoOculto('ref_cod_matricula', $this->ref_cod_matricula); |
186 | $this->campoOculto('ref_cod_serie', $this->ref_cod_serie); | 191 | $this->campoOculto('ref_cod_serie', $this->ref_cod_serie); |
@@ -188,15 +193,18 @@ class indice extends clsCadastro | @@ -188,15 +193,18 @@ class indice extends clsCadastro | ||
188 | 193 | ||
189 | $opcoes = array('' => 'Selecione'); | 194 | $opcoes = array('' => 'Selecione'); |
190 | 195 | ||
191 | - $objTemp = new clsPmieducarEscolaSerieDisciplina(); | ||
192 | - $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); | 196 | + // Seleciona os componentes curriculares da turma |
197 | + try { | ||
198 | + $componentes = App_Model_IedFinder::getComponentesTurma($this->ref_cod_serie, | ||
199 | + $this->ref_cod_escola, $this->ref_cod_turma); | ||
200 | + } | ||
201 | + catch (App_Model_Exception $e) { | ||
202 | + $this->mensagem = $e->getMessage(); | ||
203 | + return; | ||
204 | + } | ||
193 | 205 | ||
194 | - $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper(); | ||
195 | - if (is_array($lista) && count($lista)) { | ||
196 | - foreach ($lista as $registro) { | ||
197 | - $componente = $componenteMapper->find($registro['ref_cod_disciplina']); | ||
198 | - $opcoes[$componente->id] = $componente->nome; | ||
199 | - } | 206 | + foreach ($componentes as $componente) { |
207 | + $opcoes[$componente->id] = $componente->nome; | ||
200 | } | 208 | } |
201 | 209 | ||
202 | if ($this->ref_cod_disciplina) { | 210 | if ($this->ref_cod_disciplina) { |
ieducar/intranet/educar_dispensa_disciplina_lst.php
@@ -169,18 +169,12 @@ class indice extends clsListagem | @@ -169,18 +169,12 @@ class indice extends clsListagem | ||
169 | $opcoes = array('' => 'Selecione'); | 169 | $opcoes = array('' => 'Selecione'); |
170 | 170 | ||
171 | // Escola série disciplina | 171 | // Escola série disciplina |
172 | - $objTemp = new clsPmieducarEscolaSerieDisciplina(); | ||
173 | - $lista = $objTemp->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1); | ||
174 | - | ||
175 | - if (is_array($lista) && count($lista)) { | ||
176 | - foreach ($lista as $registro) { | ||
177 | - $obj_disciplina = new clsPmieducarDisciplina( | ||
178 | - $registro['ref_cod_disciplina'], NULL, NULL, NULL, NULL, NULL, NULL, | ||
179 | - NULL, NULL, NULL, 1); | 172 | + $componentes = App_Model_IedFinder::getComponentesTurma( |
173 | + $this->ref_cod_serie, $this->ref_cod_escola, $this->ref_cod_turma | ||
174 | + ); | ||
180 | 175 | ||
181 | - $det_disciplina = $obj_disciplina->detalhe(); | ||
182 | - $opcoes[$registro['ref_cod_disciplina']] = $det_disciplina['nm_disciplina']; | ||
183 | - } | 176 | + foreach ($componentes as $componente) { |
177 | + $opcoes[$componente->id] = $componente->nome; | ||
184 | } | 178 | } |
185 | 179 | ||
186 | $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, | 180 | $this->campoLista('ref_cod_disciplina', 'Disciplina', $opcoes, |
ieducar/intranet/educar_matricula_det.php
@@ -230,7 +230,8 @@ class indice extends clsDetalhe | @@ -230,7 +230,8 @@ class indice extends clsDetalhe | ||
230 | $this->array_botao[] = 'Ocorrências Disciplinares'; | 230 | $this->array_botao[] = 'Ocorrências Disciplinares'; |
231 | $this->array_botao_url_script[] = "go(\"educar_matricula_ocorrencia_disciplinar_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; | 231 | $this->array_botao_url_script[] = "go(\"educar_matricula_ocorrencia_disciplinar_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; |
232 | 232 | ||
233 | - if ($registro['ref_ref_cod_serie']) { | 233 | + // Apenas libera a dispensa de disciplina quando o aluno estiver enturmado |
234 | + if ($registro['ref_ref_cod_serie'] && isset($nm_turma)) { | ||
234 | $this->array_botao[] = 'Dispensa de Componentes Curriculares'; | 235 | $this->array_botao[] = 'Dispensa de Componentes Curriculares'; |
235 | $this->array_botao_url_script[] = "go(\"educar_dispensa_disciplina_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; | 236 | $this->array_botao_url_script[] = "go(\"educar_dispensa_disciplina_lst.php?ref_cod_matricula={$registro['cod_matricula']}\")"; |
236 | } | 237 | } |
ieducar/intranet/include/pmieducar/clsPmieducarDispensaDisciplina.inc.php
@@ -151,13 +151,17 @@ class clsPmieducarDispensaDisciplina | @@ -151,13 +151,17 @@ class clsPmieducarDispensaDisciplina | ||
151 | if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) && | 151 | if (is_numeric($ref_cod_disciplina) && is_numeric($ref_cod_escola) && |
152 | is_numeric($ref_cod_serie) | 152 | is_numeric($ref_cod_serie) |
153 | ) { | 153 | ) { |
154 | - $escolaSerieDisciplina = new clsPmieducarEscolaSerieDisciplina($ref_cod_serie, | ||
155 | - $ref_cod_escola, $ref_cod_disciplina); | ||
156 | - | ||
157 | - if ($escolaSerieDisciplina->existe()) { | 154 | + require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php'; |
155 | + $anoEscolarMapper = new ComponenteCurricular_Model_AnoEscolarDataMapper(); | ||
156 | + $componenteAnos = $anoEscolarMapper->findAll(array(), array( | ||
157 | + 'componenteCurricular' => $ref_cod_disciplina, | ||
158 | + 'anoEscolar' => $ref_cod_serie | ||
159 | + )); | ||
160 | + | ||
161 | + if (1 == count($componenteAnos)) { | ||
158 | $this->ref_cod_disciplina = $ref_cod_disciplina; | 162 | $this->ref_cod_disciplina = $ref_cod_disciplina; |
159 | - $this->ref_cod_escola = $ref_cod_escola; | ||
160 | $this->ref_cod_serie = $ref_cod_serie; | 163 | $this->ref_cod_serie = $ref_cod_serie; |
164 | + $this->ref_cod_escola = $ref_cod_escola; | ||
161 | } | 165 | } |
162 | } | 166 | } |
163 | 167 |