Commit 9309126cd64052b327eaa48088783247eeefab60

Authored by Eriksen Costa
1 parent 576d2642
Exists in master

Adicionada busca por código e nome da turma em {{{App_Model_IedFinder::getMatriculas()}}}

ieducar/lib/App/Model/IedFinder.php
... ... @@ -92,8 +92,8 @@ class App_Model_IedFinder extends CoreExt_Entity
92 92 * Exclui todas os componentes curriculares ao qual o aluno está dispensado
93 93 * de cursar.
94 94 *
95   - * @param int $codMatricula
96   - * @param RegraAvaliacao_Model_RegraDataMapper $mapper
  95 + * @param int $codMatricula
  96 + * @param ComponenteCurricular_Model_ComponenteDataMapper $mapper
97 97 * @return array
98 98 * @throws App_Model_Exception
99 99 */
... ... @@ -147,7 +147,7 @@ class App_Model_IedFinder extends CoreExt_Entity
147 147 /**
148 148 * Retorna um array populado com os dados de uma matricula.
149 149 *
150   - * @param int $codMatricula
  150 + * @param int $codMatricula
151 151 * @return array
152 152 * @throws App_Model_Exception
153 153 */
... ... @@ -157,6 +157,9 @@ class App_Model_IedFinder extends CoreExt_Entity
157 157 $matricula = self::addClassToStorage('clsPmieducarMatricula', NULL,
158 158 'include/pmieducar/clsPmieducarMatricula.inc.php');
159 159  
  160 + $turma = self::addClassToStorage('clsPmieducarMatriculaTurma', NULL,
  161 + 'include/pmieducar/clsPmieducarMatriculaTurma.inc.php');
  162 +
160 163 $curso = self::addClassToStorage('clsPmieducarCurso', NULL,
161 164 'include/pmieducar/clsPmieducarCurso.inc.php');
162 165  
... ... @@ -174,6 +177,17 @@ class App_Model_IedFinder extends CoreExt_Entity
174 177 }
175 178  
176 179 // Atribui dados extra a matrícula
  180 + $turmas = $turma->lista($codMatricula, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
  181 + if (0 < count($turmas)) {
  182 + $turma = array_shift($turmas);
  183 +
  184 + $matricula['ref_cod_turma'] = $turma['ref_cod_turma'];
  185 + $matricula['turma_nome'] = isset($turma['nm_turma']) ? $turma['nm_turma'] : NULL;
  186 + }
  187 + else {
  188 + throw new App_Model_Exception('Aluno não enturmado.');
  189 + }
  190 +
177 191 $curso->cod_curso = $matricula['ref_cod_curso'];
178 192 $curso = $curso->detalhe();
179 193  
... ... @@ -297,7 +311,6 @@ class App_Model_IedFinder extends CoreExt_Entity
297 311 *
298 312 * @param int $codMatricula
299 313 * @return int
300   - * @throws App_Model_Exception
301 314 */
302 315 public static function getQuantidadeDeModulosMatricula($codMatricula)
303 316 {
... ... @@ -307,20 +320,7 @@ class App_Model_IedFinder extends CoreExt_Entity
307 320 $matricula = self::getMatricula($codMatricula);
308 321 $codEscola = $matricula['ref_ref_cod_escola'];
309 322 $codCurso = $matricula['ref_cod_curso'];
310   - $codTurma = NULL;
311   -
312   - $matriculaTurma = self::addClassToStorage('clsPmieducarMatriculaTurma',
313   - NULL, 'include/pmieducar/clsPmieducarMatriculaTurma.inc.php');
314   -
315   - $matriculas = $matriculaTurma->lista($codMatricula);
316   -
317   - if (is_array($matriculas)) {
318   - $matricula = array_shift($matriculas);
319   - $codTurma = $matricula['ref_cod_turma'];
320   - }
321   - else {
322   - throw new App_Model_Exception('Aluno não enturmado.');
323   - }
  323 + $codTurma = $matricula['ref_cod_turma'];
324 324  
325 325 $modulos = self::getModulo($codEscola, $codCurso, $codTurma);
326 326  
... ...
ieducar/modules/Avaliacao/Views/BoletimController.php
... ... @@ -152,17 +152,7 @@ class BoletimController extends Core_Controller_Page_ViewController
152 152 $serie = $matricula['serie_nome'];
153 153  
154 154 // Nome da turma
155   - $matTurma = new clsPmieducarMatriculaTurma();
156   - $matTurma = $matTurma->lista($matricula['cod_matricula']);
157   -
158   - if (FALSE != $matTurma) {
159   - $matTurma = array_shift($matTurma);
160   -
161   - $turma = new clsPmieducarTurma();
162   - $turma->cod_turma = $matTurma['ref_cod_turma'];
163   - $turma = $turma->detalhe();
164   - $turma = $turma['nm_turma'];
165   - }
  155 + $turma = $matricula['turma_nome'];
166 156  
167 157 // Situação da matrícula
168 158 $situacao = App_Model_MatriculaSituacao::getInstance();
... ...
ieducar/modules/Avaliacao/Views/FaltaController.php
... ... @@ -143,7 +143,8 @@ class FaltaController extends Core_Controller_Page_EditController
143 143 $this->campoRotulo('1nome', 'Nome', $matricula['nome']);
144 144 $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']);
145 145 $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']);
146   - $this->campoRotulo('4etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa);
  146 + $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']);
  147 + $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa);
147 148  
148 149 $this->campoLista('falta', 'Falta', range(0, 100, 1), $this->_falta->quantidade);
149 150 }
... ...
ieducar/modules/Avaliacao/Views/NotaController.php
... ... @@ -159,10 +159,11 @@ class NotaController extends Core_Controller_Page_EditController
159 159 $this->campoRotulo('1nome', 'Nome', $matricula['nome']);
160 160 $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']);
161 161 $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']);
162   - $this->campoRotulo('4etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Exame' : $this->_etapa);
  162 + $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']);
  163 + $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Exame' : $this->_etapa);
163 164  
164 165 $componentes = $this->_service->getComponentes();
165   - $this->campoRotulo('5componente_curricular', 'Componente curricular', $componentes[$this->getRequest()->componenteCurricular]);
  166 + $this->campoRotulo('6componente_curricular', 'Componente curricular', $componentes[$this->getRequest()->componenteCurricular]);
166 167  
167 168 // Valores de arredondamento
168 169 $valoresArredondamento = $this->_service->getRegra()->tabelaArredondamento->findTabelaValor();
... ...
ieducar/modules/Avaliacao/Views/ParecerController.php
... ... @@ -151,17 +151,18 @@ class ParecerController extends Core_Controller_Page_EditController
151 151 $this->campoRotulo('1nome', 'Nome', $matricula['nome']);
152 152 $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']);
153 153 $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']);
  154 + $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']);
154 155  
155 156 if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_GERAL) {
156   - $this->campoRotulo('4etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa);
  157 + $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa);
157 158 }
158 159 else {
159   - $this->campoRotulo('4etapa', 'Etapa', 'Anual');
  160 + $this->campoRotulo('5etapa', 'Etapa', 'Anual');
160 161 }
161 162  
162 163 if ($this->_componenteCurricular) {
163 164 $componentes = $this->_service->getComponentes();
164   - $this->campoRotulo('5componente_curricular', 'Componente curricular', $componentes[$this->_componenteCurricular]);
  165 + $this->campoRotulo('6componente_curricular', 'Componente curricular', $componentes[$this->_componenteCurricular]);
165 166 }
166 167  
167 168 $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, TRUE);
... ...
ieducar/tests/unit/App/Model/IedFinderTest.php
... ... @@ -180,6 +180,8 @@ class App_Model_IedFinderTest extends UnitBaseTest
180 180 'ref_ref_cod_serie' => 1,
181 181 'ref_ref_cod_escola' => 1,
182 182 'ref_cod_curso' => 1,
  183 + 'ref_cod_turma' => 1,
  184 + 'turma_nome' => 'Turma 1',
183 185 'curso_carga_horaria' => 800,
184 186 'curso_hora_falta' => (50 /60),
185 187 'serie_carga_horaria' => 800,
... ... @@ -189,6 +191,7 @@ class App_Model_IedFinderTest extends UnitBaseTest
189 191 );
190 192  
191 193 $returnMatricula = array('cod_matricula' => 1, 'ref_ref_cod_serie' => 1, 'ref_ref_cod_escola' => 1, 'ref_cod_curso' => 1);
  194 + $returnTurma = array(array('ref_cod_matricula' => 1, 'ref_cod_turma' => 1, 'nm_turma' => 'Turma 1', 'ativo' => 1));
192 195 $returnSerie = array('cod_serie' => 1, 'carga_horaria' => 800, 'regra_avaliacao_id' => 1);
193 196 $returnCurso = array('cod_curso' => 1, 'carga_horaria' => 800, 'hora_falta' => (50 / 60), 'padrao_ano_escolar' => 1);
194 197  
... ... @@ -197,6 +200,12 @@ class App_Model_IedFinderTest extends UnitBaseTest
197 200 ->method('detalhe')
198 201 ->will($this->returnValue($returnMatricula));
199 202  
  203 + $turmaMock = $this->getCleanMock('clsPmieducarMatriculaTurma');
  204 + $turmaMock->expects($this->any())
  205 + ->method('lista')
  206 + ->with(1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1)
  207 + ->will($this->returnValue($returnTurma));
  208 +
200 209 $serieMock = $this->getCleanMock('clsPmieducarSerie');
201 210 $serieMock->expects($this->any())
202 211 ->method('detalhe')
... ... @@ -208,6 +217,7 @@ class App_Model_IedFinderTest extends UnitBaseTest
208 217 ->will($this->returnValue($returnCurso));
209 218  
210 219 CoreExt_Entity::addClassToStorage('clsPmieducarMatricula', $matriculaMock, NULL, TRUE);
  220 + CoreExt_Entity::addClassToStorage('clsPmieducarMatriculaTurma', $turmaMock, NULL, TRUE);
211 221 CoreExt_Entity::addClassToStorage('clsPmieducarSerie', $serieMock, NULL, TRUE);
212 222 CoreExt_Entity::addClassToStorage('clsPmieducarCurso', $cursoMock, NULL, TRUE);
213 223  
... ... @@ -416,17 +426,6 @@ class App_Model_IedFinderTest extends UnitBaseTest
416 426  
417 427 CoreExt_Entity::addClassToStorage('clsPmieducarCurso', $cursoMock, NULL, TRUE);
418 428  
419   - // Pega informação da turma
420   - /*$returnMatriculaTurma = array(
421   - array('ref_cod_matricula' => 1, 'ref_cod_turma' => 1)
422   - );
423   -
424   - $matriculaTurmaMock = $this->getCleanMock('clsPmieducarMatriculaTurma');
425   - $matriculaTurmaMock->expects($this->at(0))
426   - ->method('lista')
427   - ->with(1)
428   - ->will($this->returnValue($returnMatriculaTurma));*/
429   -
430 429 $returnTurmaModulo = array(
431 430 array('ref_cod_turma' => 1, 'ref_cod_modulo' => 1, 'sequencial' => 1),
432 431 array('ref_cod_turma' => 1, 'ref_cod_modulo' => 1, 'sequencial' => 2),
... ... @@ -440,9 +439,6 @@ class App_Model_IedFinderTest extends UnitBaseTest
440 439 ->with(1)
441 440 ->will($this->returnValue($returnTurmaModulo));
442 441  
443   - #App_Model_IedFinder::addClassToStorage('clsPmieducarMatriculaTurma',
444   - # $matriculaTurmaMock, NULL, TRUE);
445   -
446 442 App_Model_IedFinder::addClassToStorage('clsPmieducarTurmaModulo',
447 443 $turmaModuloMock, NULL, TRUE);
448 444  
... ...