Commit be7b62aa134a3f5fd8552bf6a4da1c4963fc5a41
1 parent
52e74b0c
Exists in
master
Adicionado modulo laçamento de notas, faltas e pareceres descritivos por turma /…
… aplicado correções ao serviço boletim / lançamento por aluno
Showing
6 changed files
with
1468 additions
and
155 deletions
Show diff stats
ieducar/modules/Avaliacao/Service/Boletim.php
... | ... | @@ -815,12 +815,13 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
815 | 815 | $matricula = App_Model_IedFinder::getMatricula($codMatricula); |
816 | 816 | |
817 | 817 | $etapas = App_Model_IedFinder::getQuantidadeDeModulosMatricula($codMatricula); |
818 | - $this->setOption('matriculaData', $matricula); | |
819 | - $this->setOption('aprovado', $matricula['aprovado']); | |
820 | - $this->setOption('cursoHoraFalta', $matricula['curso_hora_falta']); | |
818 | + $this->setOption('matriculaData', $matricula); | |
819 | + $this->setOption('aprovado', $matricula['aprovado']); | |
820 | + $this->setOption('cursoHoraFalta', $matricula['curso_hora_falta']); | |
821 | 821 | $this->setOption('cursoCargaHoraria', $matricula['curso_carga_horaria']); |
822 | 822 | $this->setOption('serieCargaHoraria', $matricula['serie_carga_horaria']); |
823 | - $this->setOption('etapas', $etapas); | |
823 | + $this->setOption('serieDiasLetivos', $matricula['serie_dias_letivos']); | |
824 | + $this->setOption('etapas', $etapas); | |
824 | 825 | |
825 | 826 | return $this; |
826 | 827 | } |
... | ... | @@ -1052,43 +1053,17 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1052 | 1053 | return FALSE; |
1053 | 1054 | } |
1054 | 1055 | |
1055 | - /** | |
1056 | - * Retorna a situação geral do aluno, levando em consideração as situações | |
1057 | - * das notas (médias) e faltas. O retorno é baseado em booleanos, indicando | |
1058 | - * se o aluno está aprovado, em andamento, em recuperação ou retido por falta. | |
1059 | - * | |
1060 | - * Retorna também a situação das notas e faltas tais quais retornadas pelos | |
1061 | - * métodos getSituacaoComponentesCurriculares() e getSituacaoFaltas(). | |
1062 | - * | |
1063 | - * <code> | |
1064 | - * <?php | |
1065 | - * $situacao = new stdClass(); | |
1066 | - * $situacao->aprovado = TRUE; | |
1067 | - * $situacao->andamento = FALSE; | |
1068 | - * $situacao->recuperacao = FALSE; | |
1069 | - * $situacao->retidoFalta = FALSE; | |
1070 | - * $situacao->nota = $this->getSituacaoComponentesCurriculares(); | |
1071 | - * $situacao->falta = $this->getSituacaoFaltas(); | |
1072 | - * </code> | |
1073 | - * | |
1074 | - * @return stdClass | |
1075 | - * @see Avaliacao_Service_Boletim#getSituacaoComponentesCurriculares() | |
1076 | - * @see Avaliacao_Service_Boletim#getSituacaoFaltas() | |
1077 | - */ | |
1078 | - public function getSituacaoAluno() | |
1056 | + | |
1057 | + function getSituacaoNotaFalta($flagSituacaoNota, $flagSituacaoFalta) | |
1079 | 1058 | { |
1080 | - $situacao = new stdClass(); | |
1059 | + $situacao = new stdClass(); | |
1060 | + $situacao->situacao = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
1081 | 1061 | $situacao->aprovado = TRUE; |
1082 | 1062 | $situacao->andamento = FALSE; |
1083 | 1063 | $situacao->recuperacao = FALSE; |
1084 | 1064 | $situacao->retidoFalta = FALSE; |
1085 | - $situacao->nota = NULL; | |
1086 | - $situacao->falta = NULL; | |
1087 | 1065 | |
1088 | - $nota = $this->getSituacaoComponentesCurriculares(); | |
1089 | - $falta = $this->getSituacaoFaltas(); | |
1090 | - | |
1091 | - switch ($nota->situacao) { | |
1066 | + switch ($flagSituacaoNota) { | |
1092 | 1067 | case App_Model_MatriculaSituacao::EM_ANDAMENTO: |
1093 | 1068 | $situacao->aprovado = FALSE; |
1094 | 1069 | $situacao->andamento = TRUE; |
... | ... | @@ -1106,7 +1081,7 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1106 | 1081 | break; |
1107 | 1082 | } |
1108 | 1083 | |
1109 | - switch ($falta->situacao) { | |
1084 | + switch ($flagSituacaoFalta) { | |
1110 | 1085 | case App_Model_MatriculaSituacao::EM_ANDAMENTO: |
1111 | 1086 | $situacao->aprovado = FALSE; |
1112 | 1087 | $situacao->andamento = TRUE; |
... | ... | @@ -1114,20 +1089,69 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1114 | 1089 | case App_Model_MatriculaSituacao::REPROVADO: |
1115 | 1090 | $situacao->retidoFalta = TRUE; |
1116 | 1091 | $situacao->aprovado = FALSE; |
1092 | + | |
1093 | + // Se reprovado por falta, mesmo que falte lançar a nota de exame, considera como reprovado. | |
1094 | + $situacao->andamento = FALSE; | |
1117 | 1095 | break; |
1118 | 1096 | case App_Model_MatriculaSituacao::APROVADO: |
1119 | 1097 | $situacao->retidoFalta = FALSE; |
1120 | 1098 | break; |
1121 | 1099 | } |
1122 | 1100 | |
1123 | - $situacao->nota = $nota; | |
1124 | - $situacao->falta = $falta; | |
1101 | + // seta situacao geral | |
1102 | + if ($situacao->andamento and $situacao->recuperacao) | |
1103 | + $situacao->situacao = App_Model_MatriculaSituacao::EM_EXAME; | |
1104 | + | |
1105 | + elseif (! $situacao->andamento and $situacao->aprovado and $situacao->recuperacao) | |
1106 | + $situacao->situacao = App_Model_MatriculaSituacao::APROVADO_APOS_EXAME; | |
1107 | + | |
1108 | + elseif (! $situacao->andamento and $situacao->aprovado) | |
1109 | + $situacao->situacao = App_Model_MatriculaSituacao::APROVADO; | |
1110 | + | |
1111 | + elseif (! $situacao->andamento and (! $situacao->aprovado || $situacao->retidoFalta)) | |
1112 | + $situacao->situacao = App_Model_MatriculaSituacao::REPROVADO; | |
1125 | 1113 | |
1126 | 1114 | return $situacao; |
1127 | 1115 | } |
1128 | 1116 | |
1117 | + | |
1129 | 1118 | /** |
1130 | - * Retorna a situação dos componentes curriculares cursados pelo aluno. Possui | |
1119 | + * Retorna a situação geral do aluno, levando em consideração as situações | |
1120 | + * das notas (médias) e faltas. O retorno é baseado em booleanos, indicando | |
1121 | + * se o aluno está aprovado, em andamento, em recuperação ou retido por falta. | |
1122 | + * | |
1123 | + * Retorna também a situação das notas e faltas tais quais retornadas pelos | |
1124 | + * métodos getSituacaoComponentesCurriculares() e getSituacaoFaltas(). | |
1125 | + * | |
1126 | + * <code> | |
1127 | + * <?php | |
1128 | + * $situacao = new stdClass(); | |
1129 | + * $situacao->aprovado = TRUE; | |
1130 | + * $situacao->andamento = FALSE; | |
1131 | + * $situacao->recuperacao = FALSE; | |
1132 | + * $situacao->retidoFalta = FALSE; | |
1133 | + * $situacao->nota = $this->getSituacaoComponentesCurriculares(); | |
1134 | + * $situacao->falta = $this->getSituacaoFaltas(); | |
1135 | + * </code> | |
1136 | + * | |
1137 | + * @return stdClass | |
1138 | + * @see Avaliacao_Service_Boletim#getSituacaoComponentesCurriculares() | |
1139 | + * @see Avaliacao_Service_Boletim#getSituacaoFaltas() | |
1140 | + */ | |
1141 | + public function getSituacaoAluno() | |
1142 | + { | |
1143 | + $situacaoNotas = $this->getSituacaoNotas(); | |
1144 | + $situacaoFaltas = $this->getSituacaoFaltas(); | |
1145 | + | |
1146 | + $situacao = $this->getSituacaoNotaFalta($situacaoNotas->situacao, $situacaoFaltas->situacao); | |
1147 | + $situacao->nota = $situacaoNotas; | |
1148 | + $situacao->falta = $situacaoFaltas; | |
1149 | + | |
1150 | + return $situacao; | |
1151 | + } | |
1152 | + | |
1153 | + /** | |
1154 | + * Retorna a situação das notas lançadas para os componentes curriculares cursados pelo aluno. Possui | |
1131 | 1155 | * uma flag "situacao" global, que indica a situação global do aluno, podendo |
1132 | 1156 | * ser: |
1133 | 1157 | * |
... | ... | @@ -1155,13 +1179,19 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1155 | 1179 | * $situacao->componentesCurriculares[1]->situacao = App_Model_MatriculaSituacao::APROVADO; |
1156 | 1180 | * </code> |
1157 | 1181 | * |
1158 | - * Esses valores são definidos através da verificação SOMENTE das médias dos | |
1182 | + * Esses valores são definidos SOMENTE através da verificação das médias dos | |
1159 | 1183 | * componentes curriculares já avaliados. |
1160 | 1184 | * |
1185 | + * Obs: Anteriormente este metódo se chamava getSituacaoComponentesCurriculares, porem na verdade não retornava a | |
1186 | + * situação dos componentes curriculares (que seria a situação baseada nas notas e das faltas lançadas) e sim | |
1187 | + * então foi renomeado este metodo para getSituacaoNotas, para que no metódo getSituacaoComponentesCurriculares | |
1188 | + * fosse retornado a situação do baseada nas notas e faltas lançadas. | |
1189 | + * | |
1190 | + * | |
1161 | 1191 | * @return stdClass|NULL Retorna NULL caso não |
1162 | 1192 | * @see App_Model_MatriculaSituacao |
1163 | 1193 | */ |
1164 | - public function getSituacaoComponentesCurriculares() | |
1194 | + public function getSituacaoNotas() | |
1165 | 1195 | { |
1166 | 1196 | $situacao = new stdClass(); |
1167 | 1197 | $situacao->situacao = 0; |
... | ... | @@ -1174,8 +1204,7 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1174 | 1204 | return $situacao; |
1175 | 1205 | } |
1176 | 1206 | |
1177 | - // Carrega as médias pois este método pode ser chamado após a chamada a | |
1178 | - // saveNotas(). | |
1207 | + // Carrega as médias pois este método pode ser chamado após a chamada a saveNotas() | |
1179 | 1208 | $mediasComponentes = $this->_loadNotaComponenteCurricularMedia() |
1180 | 1209 | ->getMediasComponentes(); |
1181 | 1210 | |
... | ... | @@ -1203,11 +1232,13 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1203 | 1232 | $this->hasRecuperacao()) { |
1204 | 1233 | $situacao->componentesCurriculares[$id]->situacao = App_Model_MatriculaSituacao::EM_EXAME; |
1205 | 1234 | } |
1206 | - elseif (($etapa == $this->getOption('etapas') || $etapa == 'Rc') && | |
1207 | - $media < $this->getRegra()->media) { | |
1235 | + elseif ($etapa == $this->getOption('etapas') && $media < $this->getRegra()->media) { | |
1236 | + $situacao->componentesCurriculares[$id]->situacao = App_Model_MatriculaSituacao::REPROVADO; | |
1237 | + } | |
1238 | + elseif ($etapa == 'Rc' && $media < $this->getRegra()->mediaRecuperacao) { | |
1208 | 1239 | $situacao->componentesCurriculares[$id]->situacao = App_Model_MatriculaSituacao::REPROVADO; |
1209 | 1240 | } |
1210 | - elseif ($etapa == 'Rc' && $media >= $this->getRegra()->media && $this->hasRecuperacao()) { | |
1241 | + elseif ($etapa == 'Rc' && $media >= $this->getRegra()->mediaRecuperacao && $this->hasRecuperacao()) { | |
1211 | 1242 | $situacao->componentesCurriculares[$id]->situacao = App_Model_MatriculaSituacao::APROVADO_APOS_EXAME; |
1212 | 1243 | } |
1213 | 1244 | elseif ($etapa < $this->getOption('etapas') && $etapa != 'Rc') { |
... | ... | @@ -1275,40 +1306,31 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1275 | 1306 | */ |
1276 | 1307 | public function getSituacaoFaltas() |
1277 | 1308 | { |
1278 | - $presenca = new stdClass(); | |
1279 | - $presenca->situacao = 0; | |
1280 | - $presenca->tipoFalta = 0; | |
1281 | - $presenca->cargaHoraria = 0; | |
1282 | - $presenca->cursoHoraFalta = 0; | |
1309 | + $presenca = new stdClass(); | |
1283 | 1310 | $presenca->totalFaltas = 0; |
1284 | 1311 | $presenca->horasFaltas = 0; |
1285 | 1312 | $presenca->porcentagemFalta = 0; |
1286 | 1313 | $presenca->porcentagemPresenca = 0; |
1287 | - $presenca->porcentagemPresencaRegra = 0; | |
1288 | - $presenca->componentesCurriculares = array(); | |
1289 | - | |
1290 | - // Tipo de falta do aluno | |
1291 | - $tipoFalta = $this->_getFaltaAluno(); | |
1292 | - $tipoFalta = $tipoFalta->get('tipoFalta'); | |
1293 | - | |
1294 | - $presenca->tipoFalta = $tipoFalta; | |
1295 | - $presenca->cursoHoraFalta = $this->getOption('cursoHoraFalta'); | |
1296 | 1314 | $presenca->porcentagemPresencaRegra = $this->getRegra()->porcentagemPresenca; |
1297 | - $presenca->cargaHoraria = $this->getOption('serieCargaHoraria'); | |
1298 | 1315 | |
1299 | - // A situação é "aprovado" por padrão | |
1300 | - $situacaoGeral = App_Model_MatriculaSituacao::APROVADO; | |
1316 | + $presenca->tipoFalta = $this->getRegra()->get('tipoPresenca'); | |
1317 | + $presenca->cargaHoraria = $this->getOption('serieCargaHoraria'); | |
1318 | + $presenca->diasLetivos = $this->getOption('serieDiasLetivos'); | |
1301 | 1319 | |
1302 | - // Faltas | |
1303 | - $faltasComponentes = array(); | |
1320 | + $presenca->cursoHoraFalta = $this->getOption('cursoHoraFalta'); | |
1321 | + $presenca->componentesCurriculares = array(); | |
1322 | + $presenca->situacao = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
1304 | 1323 | |
1305 | - // Etapa padrão | |
1306 | - $etapa = 0; | |
1324 | + $etapa = 0; | |
1325 | + $faltasComponentes = array(); | |
1307 | 1326 | |
1308 | - // Faltas lançadas (persistidas) | |
1327 | + // Carrega faltas lançadas (persistidas) | |
1309 | 1328 | $this->_loadFalta(); |
1310 | 1329 | |
1311 | - if ($presenca->tipoFalta == RegraAvaliacao_Model_TipoPresenca::GERAL) { | |
1330 | + $tipoFaltaGeral = $presenca->tipoFalta == RegraAvaliacao_Model_TipoPresenca::GERAL; | |
1331 | + $tipoFaltaPorComponente = $presenca->tipoFalta == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE; | |
1332 | + | |
1333 | + if ($tipoFaltaGeral) { | |
1312 | 1334 | $faltas = $this->_faltasGerais; |
1313 | 1335 | |
1314 | 1336 | if (0 == count($faltas)) { |
... | ... | @@ -1316,12 +1338,12 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1316 | 1338 | $etapa = 0; |
1317 | 1339 | } |
1318 | 1340 | else { |
1319 | - $total = array_sum(CoreExt_Entity::entityFilterAttr($faltas, 'id', 'quantidade')); | |
1320 | - $falta = (array_pop($faltas)); | |
1321 | - $etapa = $falta->etapa; | |
1341 | + $total = array_sum(CoreExt_Entity::entityFilterAttr($faltas, 'id', 'quantidade')); | |
1342 | + $etapa = array_pop($faltas)->etapa; | |
1322 | 1343 | } |
1323 | 1344 | } |
1324 | - elseif ($presenca->tipoFalta == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { | |
1345 | + | |
1346 | + elseif ($tipoFaltaPorComponente) { | |
1325 | 1347 | $faltas = $this->_faltasComponentes; |
1326 | 1348 | $total = 0; |
1327 | 1349 | $etapasComponentes = array(); |
... | ... | @@ -1334,8 +1356,8 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1334 | 1356 | |
1335 | 1357 | // Pega o id de ComponenteCurricular_Model_Componente da última etapa do array |
1336 | 1358 | $componenteEtapa = array_pop($falta); |
1337 | - $id = $componenteEtapa->get('componenteCurricular'); | |
1338 | - $etapa = $componenteEtapa->etapa; | |
1359 | + $id = $componenteEtapa->get('componenteCurricular'); | |
1360 | + $etapa = $componenteEtapa->etapa; | |
1339 | 1361 | |
1340 | 1362 | // Etapas lançadas |
1341 | 1363 | $etapasComponentes[$etapa] = $etapa; |
... | ... | @@ -1346,6 +1368,8 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1346 | 1368 | $faltasComponentes[$id]->horasFaltas = NULL; |
1347 | 1369 | $faltasComponentes[$id]->porcentagemFalta = NULL; |
1348 | 1370 | $faltasComponentes[$id]->porcentagemPresenca = NULL; |
1371 | + $faltasComponentes[$id]->total = $componenteTotal; | |
1372 | + //$faltasComponentes[$id]->componenteCurricular = $componenteEtapa; | |
1349 | 1373 | |
1350 | 1374 | // Calcula a quantidade de horas/faltas no componente |
1351 | 1375 | $faltasComponentes[$id]->horasFaltas = |
... | ... | @@ -1360,10 +1384,11 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1360 | 1384 | $faltasComponentes[$id]->porcentagemPresenca = |
1361 | 1385 | 100 - $faltasComponentes[$id]->porcentagemFalta; |
1362 | 1386 | |
1387 | + // Na última etapa seta situação presença como aprovado ou reprovado. | |
1363 | 1388 | if ($etapa == $this->getOption('etapas') || $etapa == 'Rc') { |
1364 | 1389 | $aprovado = ($faltasComponentes[$id]->porcentagemPresenca >= $this->getRegra()->porcentagemPresenca); |
1365 | - $faltasComponentes[$id]->situacao = $aprovado ? | |
1366 | - App_Model_MatriculaSituacao::APROVADO : App_Model_MatriculaSituacao::REPROVADO; | |
1390 | + $faltasComponentes[$id]->situacao = $aprovado ? App_Model_MatriculaSituacao::APROVADO : | |
1391 | + App_Model_MatriculaSituacao::REPROVADO; | |
1367 | 1392 | } |
1368 | 1393 | |
1369 | 1394 | // Adiciona a quantidade de falta do componente ao total geral de faltas |
... | ... | @@ -1377,39 +1402,119 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1377 | 1402 | else { |
1378 | 1403 | $etapa = min($etapasComponentes); |
1379 | 1404 | } |
1380 | - } | |
1405 | + } // fim if por_componente | |
1381 | 1406 | |
1382 | - // Total de faltas | |
1383 | 1407 | $presenca->totalFaltas = $total; |
1384 | - | |
1385 | - // Horas faltas total | |
1386 | 1408 | $presenca->horasFaltas = $this->_calculateHoraFalta($total, $presenca->cursoHoraFalta); |
1387 | 1409 | |
1388 | - // Porcentagem de faltas | |
1389 | - $presenca->porcentagemFalta = $this->_calculatePorcentagem($presenca->cargaHoraria, | |
1390 | - $presenca->horasFaltas, FALSE); | |
1391 | - | |
1392 | - // Porcentagem de presença geral | |
1393 | - $presenca->porcentagemPresenca = 100 - $presenca->porcentagemFalta; | |
1410 | + if ($tipoFaltaGeral) { | |
1411 | + $presenca->porcentagemFalta = $this->_calculatePorcentagem($presenca->diasLetivos, | |
1412 | + $presenca->totalFaltas, FALSE); | |
1413 | + } | |
1414 | + elseif ($tipoFaltaPorComponente) { | |
1415 | + $presenca->porcentagemFalta = $this->_calculatePorcentagem($presenca->cargaHoraria, | |
1416 | + $presenca->horasFaltas, FALSE); | |
1417 | + } | |
1394 | 1418 | |
1395 | - // Componentes curriculares | |
1419 | + $presenca->porcentagemPresenca = 100 - $presenca->porcentagemFalta; | |
1396 | 1420 | $presenca->componentesCurriculares = $faltasComponentes; |
1397 | 1421 | |
1398 | - // Situação geral. Última verificação pois somente ao fim é possível saber | |
1399 | - // se está em andamento ou se pode estabelecer como aprovado ou reprovado | |
1422 | + // Na última etapa seta situação presença como aprovado ou reprovado. | |
1400 | 1423 | if ($etapa == $this->getOption('etapas') || $etapa === 'Rc') { |
1401 | - $aprovado = ($presenca->porcentagemPresenca >= $this->getRegra()->porcentagemPresenca); | |
1402 | - $presenca->situacao = $aprovado ? | |
1403 | - App_Model_MatriculaSituacao::APROVADO : | |
1404 | - App_Model_MatriculaSituacao::REPROVADO; | |
1405 | - } | |
1406 | - else { | |
1407 | - $presenca->situacao = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
1424 | + $aprovado = ($presenca->porcentagemPresenca >= $this->getRegra()->porcentagemPresenca); | |
1425 | + $presenca->situacao = $aprovado ? App_Model_MatriculaSituacao::APROVADO : | |
1426 | + App_Model_MatriculaSituacao::REPROVADO; | |
1408 | 1427 | } |
1409 | 1428 | |
1410 | 1429 | return $presenca; |
1411 | 1430 | } |
1412 | 1431 | |
1432 | + | |
1433 | + /** | |
1434 | + * Retorna a situação dos componentes curriculares cursados pelo aluno. Possui | |
1435 | + * uma flag "situacao" global, que indica a situação global do aluno, podendo | |
1436 | + * ser: | |
1437 | + * | |
1438 | + * - Em andamento | |
1439 | + * - Em exame | |
1440 | + * - Aprovado | |
1441 | + * - Reprovado | |
1442 | + * | |
1443 | + * Esses valores são definidos no enum App_Model_MatriculaSituacao. | |
1444 | + * | |
1445 | + * Para cada componente curricular, será indicado a situação do aluno no | |
1446 | + * componente. | |
1447 | + * | |
1448 | + * Esses resultados são retornados como um objeto stdClass que possui dois | |
1449 | + * atributos: "situacao" e "componentesCurriculares". O primeiro é um tipo | |
1450 | + * inteiro e o segundo um array indexado pelo id do componente e com um | |
1451 | + * atributo inteiro "situacao": | |
1452 | + * | |
1453 | + * <code> | |
1454 | + * <?php | |
1455 | + * $situacao = new stdClass(); | |
1456 | + * $situacao->situacao = App_Model_MatriculaSituacao::APROVADO; | |
1457 | + * $situacao->componentesCurriculares = array(); | |
1458 | + * $situacao->componentesCurriculares[1] = new stdClass(); | |
1459 | + * $situacao->componentesCurriculares[1]->situacao = App_Model_MatriculaSituacao::APROVADO; | |
1460 | + * </code> | |
1461 | + * | |
1462 | + * Esses valores são definidos através da verificação das médias dos | |
1463 | + * componentes curriculares já avaliados e das faltas lançadas. | |
1464 | + * | |
1465 | + * Obs: Anteriormente este metódo SOMENTE verificava a situação baseando-se nas médias lançadas, | |
1466 | + * porem o mesmo foi alterado para verificar a situação baseada nas notas e faltas lançadas. | |
1467 | + * | |
1468 | + * A implementa antiga deste metodo esta contida no metodo getSituacaoNotas | |
1469 | + * | |
1470 | + * @return stdClass|NULL Retorna NULL caso não | |
1471 | + * @see App_Model_MatriculaSituacao | |
1472 | + */ | |
1473 | + public function getSituacaoComponentesCurriculares() | |
1474 | + { | |
1475 | + $situacao = new stdClass(); | |
1476 | + $situacao->situacao = App_Model_MatriculaSituacao::APROVADO; | |
1477 | + $situacao->componentesCurriculares = array(); | |
1478 | + | |
1479 | + $situacaoNotas = $this->getSituacaoNotas(); | |
1480 | + $situacaoFaltas = $this->getSituacaofaltas(); | |
1481 | + | |
1482 | + foreach($situacaoNotas->componentesCurriculares as $ccId => $situacaoNotaCc) { | |
1483 | + // seta tipos nota, falta | |
1484 | + $tipoNotaNenhum = $this->getRegra()->get('tipoNota') == | |
1485 | + RegraAvaliacao_Model_Nota_TipoValor::NENHUM; | |
1486 | + | |
1487 | + $tipoFaltaPorComponente = $this->getRegra()->get('tipoPresenca') == | |
1488 | + RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE; | |
1489 | + | |
1490 | + // inicializa situacaoFaltaCc a ser usado caso tipoFaltaPorComponente | |
1491 | + $situacaoFaltaCc = new stdClass(); | |
1492 | + $situacaoFaltaCc->situacao = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
1493 | + | |
1494 | + // caso possua situacaoFalta para o componente substitui situacao inicializada | |
1495 | + if ($tipoFaltaPorComponente and isset($situacaoFaltas->componentesCurriculares[$ccId])) | |
1496 | + $situacaoFaltaCc = $situacaoFaltas->componentesCurriculares[$ccId]; | |
1497 | + | |
1498 | + // pega situação nota geral ou do componente | |
1499 | + if ($tipoNotaNenhum) | |
1500 | + $situacaoNota = $situacaoNotas->situacao; | |
1501 | + else | |
1502 | + $situacaoNota = $situacaoNotaCc->situacao; | |
1503 | + | |
1504 | + // pega situacao da falta componente ou geral. | |
1505 | + if($tipoFaltaPorComponente) | |
1506 | + $situacaoFalta = $situacaoFaltas->componentesCurriculares[$ccId]->situacao; | |
1507 | + else | |
1508 | + $situacaoFalta = $situacaoFaltas->situacao; | |
1509 | + | |
1510 | + $situacao->componentesCurriculares[$ccId] = $this->getSituacaoNotaFalta($situacaoNota, $situacaoFalta); | |
1511 | + } | |
1512 | + | |
1513 | + // #FIXME verificar porque para regras sem nota, não é retornado a situacao. | |
1514 | + | |
1515 | + return $situacao; | |
1516 | + } | |
1517 | + | |
1413 | 1518 | /** |
1414 | 1519 | * Verifica se uma determinada situação tem prioridade sobre a outra. |
1415 | 1520 | * |
... | ... | @@ -1529,6 +1634,14 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1529 | 1634 | protected function _setFaltaAluno(Avaliacao_Model_FaltaAluno $falta) |
1530 | 1635 | { |
1531 | 1636 | $this->_faltaAluno = $falta; |
1637 | + $tipoFaltaAtual = $this->_faltaAluno->get('tipoFalta'); | |
1638 | + $tipoFaltaRegraAvaliacao = $this->getRegra()->get('tipoPresenca'); | |
1639 | + | |
1640 | + if ($tipoFaltaAtual != $tipoFaltaRegraAvaliacao){ | |
1641 | + $this->_faltaAluno->tipoFalta = $tipoFaltaRegraAvaliacao; | |
1642 | + $this->getFaltaAlunoDataMapper()->save($this->_faltaAluno); | |
1643 | + } | |
1644 | + | |
1532 | 1645 | return $this; |
1533 | 1646 | } |
1534 | 1647 | |
... | ... | @@ -2320,6 +2433,31 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
2320 | 2433 | return $this; |
2321 | 2434 | } |
2322 | 2435 | |
2436 | + protected function updateSituacaoMatricula($situacaoNotasFaltas) | |
2437 | + { | |
2438 | + $matriculaSituacao = null; | |
2439 | + | |
2440 | + //se a situacao da matricula não é aprovado e a situacao da nota e falta estão aprovadas, aprova a matricula | |
2441 | + if (($this->getOption('aprovado') != App_Model_MatriculaSituacao::APROVADO) && | |
2442 | + ($situacaoNotasFaltas->aprovado && ! $situacaoNotasFaltas->andamento)) | |
2443 | + { | |
2444 | + $matriculaSituacao = App_Model_MatriculaSituacao::APROVADO; | |
2445 | + } | |
2446 | + //se a situacao da matricula não é reprovado e a situacao da nota e falta não estão aprovadas e nem em andamento, reprova a matricula | |
2447 | + elseif (($this->getOption('aprovado') != App_Model_MatriculaSituacao::REPROVADO) && | |
2448 | + (! $situacaoNotasFaltas->aprovado && ! $situacaoNotasFaltas->andamento)) | |
2449 | + { | |
2450 | + $matriculaSituacao = App_Model_MatriculaSituacao::REPROVADO; | |
2451 | + } | |
2452 | + elseif ($this->getOption('aprovado') != App_Model_MatriculaSituacao::EM_ANDAMENTO) | |
2453 | + { | |
2454 | + $matriculaSituacao = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
2455 | + } | |
2456 | + | |
2457 | + if ($matriculaSituacao) | |
2458 | + $this->_updateMatricula($this->getOption('matricula'), $this->getOption('usuario'), $matriculaSituacao); | |
2459 | + } | |
2460 | + | |
2323 | 2461 | /** |
2324 | 2462 | * Promove o aluno de etapa escolar caso esteja aprovado de acordo com o |
2325 | 2463 | * necessário estabelecido por tipoProgressao de |
... | ... | @@ -2329,52 +2467,65 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
2329 | 2467 | * confirmação externa para a promoção do aluno. |
2330 | 2468 | * @return bool |
2331 | 2469 | */ |
2332 | - public function promover($ok = NULL) | |
2470 | + | |
2471 | + public function promover($novaSituacaoMatricula = NULL) | |
2333 | 2472 | { |
2334 | - $situacao = $this->getSituacaoAluno(); | |
2473 | + $tipoProgressao = $this->getRegra()->get('tipoProgressao'); | |
2474 | + $situacaoMatricula = $this->getOption('aprovado'); | |
2475 | + $situacaoBoletim = $this->getSituacaoAluno(); | |
2476 | + $exceptionMsg = ''; | |
2335 | 2477 | |
2336 | - if (TRUE == $situacao->andamento) { | |
2337 | - require_once 'CoreExt/Service/Exception.php'; | |
2338 | - throw new CoreExt_Service_Exception('Não é possível promover uma matrícula em andamento.'); | |
2339 | - } | |
2478 | + if ($situacaoBoletim->andamento) | |
2479 | + $novaSituacaoMatricula = App_Model_MatriculaSituacao::EM_ANDAMENTO; | |
2480 | + else | |
2481 | + { | |
2340 | 2482 | |
2341 | - // Se a matrícula já foi alterada (aluno aprovado ou reprovado), lança exceção. | |
2342 | - if (App_Model_MatriculaSituacao::EM_ANDAMENTO > $this->getOption('aprovado')) { | |
2343 | - require_once 'CoreExt/Service/Exception.php'; | |
2344 | - throw new CoreExt_Service_Exception('A matrícula já foi promovida.'); | |
2345 | - } | |
2483 | + switch ($tipoProgressao) { | |
2484 | + case RegraAvaliacao_Model_TipoProgressao::CONTINUADA: | |
2346 | 2485 | |
2347 | - $tipoProgressao = $this->getRegra()->get('tipoProgressao'); | |
2486 | + $novaSituacaoMatricula = App_Model_MatriculaSituacao::APROVADO; | |
2487 | + break; | |
2348 | 2488 | |
2349 | - switch ($tipoProgressao) { | |
2350 | - case RegraAvaliacao_Model_TipoProgressao::CONTINUADA: | |
2351 | - $promover = TRUE; | |
2352 | - break; | |
2353 | - case RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_AUTO_MEDIA_PRESENCA: | |
2354 | - $promover = $situacao->aprovado && !$situacao->retidoFalta; | |
2355 | - break; | |
2356 | - case RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_AUTO_SOMENTE_MEDIA: | |
2357 | - $promover = $situacao->aprovado; | |
2358 | - break; | |
2359 | - case RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_MANUAL: | |
2360 | - if (is_null($ok)) { | |
2361 | - $enum = RegraAvaliacao_Model_TipoProgressao::getInstance(); | |
2362 | - $message = sprintf('Para atualizar a matrícula em uma regra %s é ' | |
2363 | - . 'necessário confirmação externa no argumento "$ok".', | |
2364 | - $enum->getValue($tipoProgressao)); | |
2365 | - | |
2366 | - require_once 'CoreExt/Service/Exception.php'; | |
2367 | - throw new CoreExt_Service_Exception($message); | |
2368 | - } | |
2489 | + case RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_AUTO_MEDIA_PRESENCA: | |
2369 | 2490 | |
2370 | - $promover = $ok; | |
2371 | - break; | |
2491 | + if ($situacaoBoletim->aprovado && !$situacaoBoletim->retidoFalta) | |
2492 | + $novaSituacaoMatricula = App_Model_MatriculaSituacao::APROVADO; | |
2493 | + else | |
2494 | + $novaSituacaoMatricula = App_Model_MatriculaSituacao::REPROVADO; | |
2495 | + break; | |
2496 | + | |
2497 | + case RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_AUTO_SOMENTE_MEDIA: | |
2498 | + | |
2499 | + if ($situacaoBoletim->aprovado) | |
2500 | + $novaSituacaoMatricula = App_Model_MatriculaSituacao::APROVADO; | |
2501 | + else | |
2502 | + $novaSituacaoMatricula = App_Model_MatriculaSituacao::REPROVADO; | |
2503 | + | |
2504 | + break; | |
2505 | + | |
2506 | + case RegraAvaliacao_Model_TipoProgressao::NAO_CONTINUADA_MANUAL && is_null($novaSituacaoMatricula): | |
2507 | + | |
2508 | + $tipoProgressaoInstance = RegraAvaliacao_Model_TipoProgressao::getInstance(); | |
2509 | + $exceptionMsg = sprintf('Para atualizar a matrícula em uma regra %s é ' | |
2510 | + . 'necessário passar o valor do argumento "$novaSituacaoMatricula".', | |
2511 | + $tipoProgressaoInstance->getValue($tipoProgressao)); | |
2512 | + break; | |
2513 | + } | |
2372 | 2514 | } |
2373 | 2515 | |
2374 | - return $this->_updateMatricula($this->getOption('matricula'), $this->getOption('usuario'), | |
2375 | - $promover); | |
2516 | + if($novaSituacaoMatricula == $situacaoMatricula) | |
2517 | + $exceptionMsg = "Matrícula ({$this->getOption('matricula')}) não precisou ser promovida, " . | |
2518 | + "pois a nova situação continua a mesma da anterior ($novaSituacaoMatricula)"; | |
2519 | + | |
2520 | + if ($exceptionMsg) { | |
2521 | + require_once 'CoreExt/Service/Exception.php'; | |
2522 | + throw new CoreExt_Service_Exception($exceptionMsg); | |
2523 | + } | |
2524 | + | |
2525 | + return $this->_updateMatricula($this->getOption('matricula'), $this->getOption('usuario'), $novaSituacaoMatricula); | |
2376 | 2526 | } |
2377 | 2527 | |
2528 | + | |
2378 | 2529 | /** |
2379 | 2530 | * Atualiza a média dos componentes curriculares. |
2380 | 2531 | */ |
... | ... | @@ -2441,4 +2592,46 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
2441 | 2592 | { |
2442 | 2593 | return App_Model_Matricula::atualizaMatricula($matricula, $usuario, $promover); |
2443 | 2594 | } |
2444 | -} | |
2445 | 2595 | \ No newline at end of file |
2596 | + | |
2597 | + | |
2598 | + public function deleteNota($etapa, $ComponenteCurricularId) | |
2599 | + { | |
2600 | + // zera nota antes de deletar, para que a media seja recalculada | |
2601 | + try { | |
2602 | + $nota = new Avaliacao_Model_NotaComponente(array( | |
2603 | + 'componenteCurricular' => $ComponenteCurricularId, | |
2604 | + 'nota' => 0, | |
2605 | + 'etapa' => $etapa | |
2606 | + )); | |
2607 | + $this->addNota($nota); | |
2608 | + $this->save(); | |
2609 | + } | |
2610 | + catch (Exception $e) { | |
2611 | + error_log("Excessao ignorada ao zerar nota a ser removida: " . $e->getMessage()); | |
2612 | + } | |
2613 | + | |
2614 | + $nota = $this->getNotaComponente($ComponenteCurricularId, $etapa); | |
2615 | + $this->getNotaComponenteDataMapper()->delete($nota); | |
2616 | + | |
2617 | + return $this; | |
2618 | + } | |
2619 | + | |
2620 | + | |
2621 | + public function deleteFalta($etapa, $ComponenteCurricularId) | |
2622 | + { | |
2623 | + $nota = $this->getFalta($etapa, $ComponenteCurricularId); | |
2624 | + $this->getFaltaAbstractDataMapper()->delete($nota); | |
2625 | + | |
2626 | + return $this; | |
2627 | + } | |
2628 | + | |
2629 | + | |
2630 | + public function deleteParecer($etapa, $ComponenteCurricularId) | |
2631 | + { | |
2632 | + $parecer = $this->getParecerDescritivo($etapa, $ComponenteCurricularId); | |
2633 | + $this->getParecerDescritivoAbstractDataMapper()->delete($parecer); | |
2634 | + | |
2635 | + return $this; | |
2636 | + } | |
2637 | + | |
2638 | +} | ... | ... |
ieducar/modules/Avaliacao/Views/BoletimController.php
... | ... | @@ -66,7 +66,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
66 | 66 | */ |
67 | 67 | protected $_service = NULL; |
68 | 68 | |
69 | - /** | |
69 | + /**z | |
70 | 70 | * @var stdClass |
71 | 71 | */ |
72 | 72 | protected $_situacao = NULL; |
... | ... | @@ -188,7 +188,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
188 | 188 | $this->addDetalhe(array('Média', $media)); |
189 | 189 | |
190 | 190 | // Cria um array com a quantidade de etapas de 1 a n |
191 | - $etapas = range(1, $this->_service->getOption('etapas'), 1); | |
191 | + $etapas = $this->getEtapas(); | |
192 | 192 | |
193 | 193 | // Atributos para a tabela |
194 | 194 | $attributes = array( |
... | ... | @@ -245,7 +245,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
245 | 245 | } |
246 | 246 | |
247 | 247 | // Colspan para tabela com labels e sublabels |
248 | - $colspan += $porComponente && $sit->recuperacao ? 4 : 3; | |
248 | + $colspan += $porComponente && $this->alunoPossuiNotaRec() ? 4 : 3; | |
249 | 249 | if ($nenhumaNota) { |
250 | 250 | $colspan--; |
251 | 251 | } |
... | ... | @@ -256,7 +256,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
256 | 256 | |
257 | 257 | // Inclui coluna para % de presença geral. |
258 | 258 | if (!$porComponente) { |
259 | - if ($sit->recuperacao) { | |
259 | + if ($this->alunoPossuiNotaRec()) { | |
260 | 260 | $labels[] = array('data' => 'Exame', 'attributes' => $attributes); |
261 | 261 | } |
262 | 262 | |
... | ... | @@ -285,7 +285,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
285 | 285 | $subLabels[] = array('data' => 'Média', 'attributes' => $attributes); |
286 | 286 | } |
287 | 287 | |
288 | - if ($sit->recuperacao) { | |
288 | + if ($this->alunoPossuiNotaRec()) { | |
289 | 289 | $subLabels[] = array('data' => 'Exame', 'attributes' => $attributes); |
290 | 290 | } |
291 | 291 | |
... | ... | @@ -305,8 +305,8 @@ class BoletimController extends Core_Controller_Page_ViewController |
305 | 305 | $attributes = array('style' => 'padding: 5px; text-align: center'); |
306 | 306 | |
307 | 307 | // Notas |
308 | - $componentes = $this->_service->getComponentes(); | |
309 | - $notasComponentes = $this->_service->getNotasComponentes(); | |
308 | + $componentes = $this->getComponentesCurriculares(); | |
309 | + $notasComponentes = $this->getNotasComponentesCurriculares(); | |
310 | 310 | $mediasSituacoes = $this->_situacao->nota; |
311 | 311 | $mediasComponentes = $this->_service->getMediasComponentes(); |
312 | 312 | $faltasComponentes = $this->_service->getFaltasComponentes(); |
... | ... | @@ -441,8 +441,8 @@ class BoletimController extends Core_Controller_Page_ViewController |
441 | 441 | $data[] = array('data' => $media, 'attributes' => $attributes); |
442 | 442 | } |
443 | 443 | |
444 | - // Adiciona uma coluna extra caso aluno esteja em exame em alguma componente curricular | |
445 | - if ($sit->recuperacao) { | |
444 | + // Adiciona uma coluna extra caso aluno esteja em exame em alguma componente curricular ou possua nota de exame | |
445 | + if ($sit->recuperacao || $this->alunoPossuiNotaRec()) { | |
446 | 446 | if ($mediaSituacao->situacao == App_Model_MatriculaSituacao::EM_EXAME || |
447 | 447 | $mediaSituacao->situacao == App_Model_MatriculaSituacao::APROVADO_APOS_EXAME || |
448 | 448 | $mediaSituacao->situacao == App_Model_MatriculaSituacao::REPROVADO) { |
... | ... | @@ -450,9 +450,8 @@ class BoletimController extends Core_Controller_Page_ViewController |
450 | 450 | $link['query']['componenteCurricular'] = $id; |
451 | 451 | $link['query']['etapa'] = 'Rc'; |
452 | 452 | |
453 | - $notaRec = $i; | |
454 | - if (isset($notas[$notaRec]) && $notas[$notaRec]->etapa == 'Rc') { | |
455 | - $link['text'] = $notas[$notaRec]->notaArredondada; | |
453 | + if (isset($notas[$i]) && $notas[$i]->etapa == 'Rc') { | |
454 | + $link['text'] = $notas[$i]->notaArredondada; | |
456 | 455 | } |
457 | 456 | |
458 | 457 | $recuperacaoLink = $url->l($link['text'], $link['path'], array('query' => $link['query'])); |
... | ... | @@ -547,7 +546,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
547 | 546 | $data[] = array(); |
548 | 547 | } |
549 | 548 | |
550 | - if ($sit->recuperacao) { | |
549 | + if ($this->alunoPossuiNotaRec()) { | |
551 | 550 | $data[] = array('data' => '', 'attributes' => $attributes); |
552 | 551 | } |
553 | 552 | |
... | ... | @@ -591,7 +590,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
591 | 590 | } |
592 | 591 | } |
593 | 592 | |
594 | - if ($sit->recuperacao) { | |
593 | + if ($this->alunoPossuiNotaRec()) { | |
595 | 594 | $data[] = array('data' => '', 'attributes' => $attributes); |
596 | 595 | } |
597 | 596 | |
... | ... | @@ -657,4 +656,61 @@ class BoletimController extends Core_Controller_Page_ViewController |
657 | 656 | $this->addDetalhe(array('Promover aluno?', $links)); |
658 | 657 | } |
659 | 658 | } |
660 | -} | |
661 | 659 | \ No newline at end of file |
660 | + | |
661 | + | |
662 | + protected function getComponentesCurriculares(){ | |
663 | + if(! isset($this->_componentesCurriculares)) | |
664 | + $this->_componentesCurriculares = $this->_service->getComponentes(); | |
665 | + | |
666 | + return $this->_componentesCurriculares; | |
667 | + } | |
668 | + | |
669 | + | |
670 | + protected function getNotasComponentesCurriculares(){ | |
671 | + if(! isset($this->_notasComponentesCurriculares)) | |
672 | + $this->_notasComponentesCurriculares = $this->_service->getNotasComponentes(); | |
673 | + | |
674 | + return $this->_notasComponentesCurriculares; | |
675 | + } | |
676 | + | |
677 | + | |
678 | + protected function getEtapas(){ | |
679 | + if(! isset($this->_etapas)) | |
680 | + $this->_etapas = range(1, $this->_service->getOption('etapas'), 1); | |
681 | + | |
682 | + return $this->_etapas; | |
683 | + } | |
684 | + | |
685 | + | |
686 | + /** | |
687 | + * caso algum componente curricular e alguma etapa possua nota exame lançada, então o aluno possui nota exame | |
688 | + */ | |
689 | + protected function alunoPossuiNotaRec(){ | |
690 | + | |
691 | + $notasComponentesCurriculares = $this->getNotasComponentesCurriculares(); | |
692 | + | |
693 | + if (! isset($this->_alunoPossuiNotaRec)){ | |
694 | + foreach($this->getComponentesCurriculares() as $cc){ | |
695 | + $notasCc = $notasComponentesCurriculares[$cc->get('id')]; | |
696 | + | |
697 | + foreach ($this->getEtapas() as $etapa){ | |
698 | + foreach($notasCc as $notaCc){ | |
699 | + if($notaCc->etapa == 'Rc'){ | |
700 | + $this->_alunoPossuiNotaRec = true; | |
701 | + break; | |
702 | + } | |
703 | + } | |
704 | + | |
705 | + if (isset($this->_alunoPossuiNotaRec)) | |
706 | + break; | |
707 | + } | |
708 | + | |
709 | + if (isset($this->_alunoPossuiNotaRec)) | |
710 | + break; | |
711 | + } | |
712 | + } | |
713 | + | |
714 | + return $this->_alunoPossuiNotaRec; | |
715 | + } | |
716 | + | |
717 | +} | ... | ... |
... | ... | @@ -0,0 +1,999 @@ |
1 | +<?php | |
2 | + | |
3 | +// O tempo máximo default (30) pode ser atingido ao carregar as matriculas sem selecionar componente curricular, | |
4 | +// o ideal seria fazer o caregamento assincrono das matriculas. | |
5 | +/*if (ini_get("max_execution_time") < 120) | |
6 | + ini_set("max_execution_time", 120); | |
7 | +*/ | |
8 | + | |
9 | +#error_reporting(E_ALL); | |
10 | +#ini_set("display_errors", 1); | |
11 | + | |
12 | +/** | |
13 | + * i-Educar - Sistema de gestão escolar | |
14 | + * | |
15 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
16 | + * <ctima@itajai.sc.gov.br> | |
17 | + * | |
18 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
19 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
20 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
21 | + * qualquer versão posterior. | |
22 | + * | |
23 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
24 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
25 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
26 | + * do GNU para mais detalhes. | |
27 | + * | |
28 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
29 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
30 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
31 | + * | |
32 | + * @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
33 | + * @category i-Educar | |
34 | + * @license @@license@@ | |
35 | + * @package Avaliacao | |
36 | + * @subpackage Modules | |
37 | + * @since Arquivo disponível desde a versão ? | |
38 | + * @version $Id$ | |
39 | + */ | |
40 | + | |
41 | +//require_once 'Core/Controller/Page/EditController.php'; | |
42 | + | |
43 | +require_once 'Avaliacao/Model/NotaComponenteDataMapper.php'; | |
44 | +require_once 'Avaliacao/Service/Boletim.php'; | |
45 | +require_once 'App/Model/MatriculaSituacao.php'; | |
46 | +require_once 'RegraAvaliacao/Model/TipoPresenca.php'; | |
47 | +require_once 'RegraAvaliacao/Model/TipoParecerDescritivo.php'; | |
48 | + | |
49 | +require_once 'include/pmieducar/clsPmieducarMatricula.inc.php'; | |
50 | + | |
51 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
52 | +require_once 'Portabilis/Array/Utils.php'; | |
53 | +require_once 'Portabilis/Object/Utils.php'; | |
54 | + | |
55 | +class DiarioApiController extends ApiCoreController | |
56 | +{ | |
57 | + protected $_dataMapper = 'Avaliacao_Model_NotaComponenteDataMapper'; | |
58 | + protected $_processoAp = 644; | |
59 | + | |
60 | + // validations | |
61 | + | |
62 | + // post nota validations | |
63 | + | |
64 | + protected function validatesValueOfAttValueIsInOpcoesNotas() { | |
65 | + $expectedValues = array_keys($this->getOpcoesNotas()); | |
66 | + return $this->validator->validatesValueInSetOf($this->getRequest()->att_value, $expectedValues, 'att_value'); | |
67 | + } | |
68 | + | |
69 | + | |
70 | + protected function validatesCanChangeDiarioForAno() { | |
71 | + $escola = App_Model_IedFinder::getEscola($this->getRequest()->escola_id); | |
72 | + | |
73 | + $ano = new clsPmieducarEscolaAnoLetivo(); | |
74 | + $ano->ref_cod_escola = $this->getRequest()->escola_id; | |
75 | + $ano->ano = $this->getRequest()->ano; | |
76 | + $ano = $ano->detalhe(); | |
77 | + | |
78 | + $anoLetivoEncerrado = is_array($ano) && count($ano) > 0 && | |
79 | + $ano['ativo'] == 1 && $ano['andamento'] == 2; | |
80 | + | |
81 | + if ($escola['bloquear_lancamento_diario_anos_letivos_encerrados'] == '1' && $anoLetivoEncerrado) { | |
82 | + $this->messenger->append("O ano letivo '{$this->getRequest()->ano}' está encerrado, esta escola está configurada para não permitir alterar o diário de anos letivos encerrados."); | |
83 | + return false; | |
84 | + } | |
85 | + | |
86 | + return true; | |
87 | + } | |
88 | + | |
89 | + | |
90 | + protected function validatesRegraAvaliacaoHasNota() { | |
91 | + $isValid = $this->serviceBoletim()->getRegra()->get('tipoNota') != RegraAvaliacao_Model_Nota_TipoValor::NENHUM; | |
92 | + | |
93 | + if (! $isValid) | |
94 | + $this->messenger->append("Nota não lançada, pois a regra de avaliação não utiliza nota."); | |
95 | + | |
96 | + return $isValid; | |
97 | + } | |
98 | + | |
99 | + | |
100 | + protected function validatesRegraAvaliacaoHasFormulaRecuperacao() { | |
101 | + $isValid = $this->getRequest()->etapa != 'Rc' || | |
102 | + ! is_null($this->serviceBoletim()->getRegra()->formulaRecuperacao); | |
103 | + | |
104 | + if (! $isValid) | |
105 | + $this->messenger->append("Nota de recuperação não lançada, pois a fórmula de recuperação não possui fórmula de recuperação."); | |
106 | + | |
107 | + return $isValid; | |
108 | + } | |
109 | + | |
110 | + | |
111 | + protected function validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() { | |
112 | + $isValid = $this->getRequest()->etapa != 'Rc' || | |
113 | + ($this->serviceBoletim()->getRegra()->formulaRecuperacao->get('tipoFormula') == | |
114 | + FormulaMedia_Model_TipoFormula::MEDIA_RECUPERACAO); | |
115 | + | |
116 | + if (! $isValid) | |
117 | + $this->messenger->append("Nota de recuperação não lançada, pois a fórmula de recuperação é diferente do tipo média recuperação."); | |
118 | + | |
119 | + return $isValid; | |
120 | + } | |
121 | + | |
122 | + | |
123 | + protected function validatesPreviousNotasHasBeenSet() { | |
124 | + $hasPreviousNotas = true; | |
125 | + $etapasWithoutNotas = array(); | |
126 | + | |
127 | + if($this->getRequest()->etapa == 'Rc') | |
128 | + $etapaRequest = $this->serviceBoletim()->getOption('etapas'); | |
129 | + else | |
130 | + $etapaRequest = $this->getRequest()->etapa; | |
131 | + | |
132 | + | |
133 | + for($etapa = 1; $etapa <= $etapaRequest; $etapa++) { | |
134 | + $nota = $this->getNotaAtual($etapa); | |
135 | + | |
136 | + if(($etapa != $this->getRequest()->etapa || $this->getRequest()->etapa == 'Rc') && | |
137 | + empty($nota) && ! is_numeric($nota)) { | |
138 | + $hasPreviousNotas = false; | |
139 | + $etapasWithoutNotas[] = $etapa; | |
140 | + } | |
141 | + } | |
142 | + | |
143 | + if (! $hasPreviousNotas) { | |
144 | + $this->messenger->append("Nota somente pode ser lançada após lançar notas nas etapas: " . | |
145 | + join(', ', $etapasWithoutNotas) . ' deste componente curricular.'); | |
146 | + } | |
147 | + | |
148 | + return $hasPreviousNotas; | |
149 | + } | |
150 | + | |
151 | + | |
152 | + // post falta validations | |
153 | + | |
154 | + protected function validatesPreviousFaltasHasBeenSet() { | |
155 | + $hasPreviousFaltas = true; | |
156 | + $etapasWithoutFaltas = array(); | |
157 | + | |
158 | + for($etapa = 1; $etapa <= $this->getRequest()->etapa; $etapa++) { | |
159 | + $falta = $this->getFaltaAtual($etapa); | |
160 | + | |
161 | + if($etapa != $this->getRequest()->etapa && empty($falta) && ! is_numeric($falta)) { | |
162 | + $hasPreviousFaltas = false; | |
163 | + $etapasWithoutFaltas[] = $etapa; | |
164 | + } | |
165 | + } | |
166 | + | |
167 | + if (! $hasPreviousFaltas) { | |
168 | + if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { | |
169 | + $this->messenger->append("Falta somente pode ser lançada após lançar faltas nas etapas anteriores: " . | |
170 | + join(', ', $etapasWithoutFaltas) . ' deste componente curricular.'); | |
171 | + } | |
172 | + else{ | |
173 | + $this->messenger->append("Falta somente pode ser lançada após lançar faltas nas etapas anteriores: " . | |
174 | + join(', ', $etapasWithoutFaltas) . '.'); | |
175 | + } | |
176 | + } | |
177 | + | |
178 | + return $hasPreviousFaltas; | |
179 | + } | |
180 | + | |
181 | + | |
182 | + // post/ delete parecer validations | |
183 | + | |
184 | + protected function validatesEtapaParecer() { | |
185 | + $isValid = false; | |
186 | + $etapa = $this->getRequest()->etapa; | |
187 | + | |
188 | + $tiposParecerAnual = array(RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE, | |
189 | + RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL); | |
190 | + | |
191 | + $parecerAnual = in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), | |
192 | + $tiposParecerAnual); | |
193 | + | |
194 | + if($parecerAnual && $etapa != 'An') | |
195 | + $this->messenger->append("Valor inválido para o atributo 'etapa', é esperado 'An' e foi recebido '{$etapa}'."); | |
196 | + elseif(! $parecerAnual && $etapa == 'An') | |
197 | + $this->messenger->append("Valor inválido para o atributo 'etapa', é esperado um valor diferente de 'An'."); | |
198 | + else | |
199 | + $isValid = true; | |
200 | + | |
201 | + return $isValid; | |
202 | + } | |
203 | + | |
204 | + | |
205 | + protected function validatesPresenceOfComponenteCurricularIdIfParecerComponente() { | |
206 | + $tiposParecerComponente = array(RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE, | |
207 | + RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE); | |
208 | + | |
209 | + $parecerPorComponente = in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), | |
210 | + $tiposParecerComponente); | |
211 | + | |
212 | + return (! $parecerPorComponente) || $this->validatesPresenceOf('componente_curricular_id'); | |
213 | + } | |
214 | + | |
215 | + | |
216 | + // post parecer validations | |
217 | + | |
218 | + protected function validatesRegraAvaliacaoHasParecer() { | |
219 | + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); | |
220 | + $isValid = $tpParecer != RegraAvaliacao_Model_TipoParecerDescritivo::NENHUM; | |
221 | + | |
222 | + if (! $isValid) | |
223 | + $this->messenger->append("Parecer descritivo não lançado, pois a regra de avaliação não utiliza parecer."); | |
224 | + | |
225 | + return $isValid; | |
226 | + } | |
227 | + | |
228 | + | |
229 | + | |
230 | + // delete nota validations | |
231 | + | |
232 | + protected function validatesInexistenceOfNotaExame() { | |
233 | + $isValid = true; | |
234 | + | |
235 | + if ($this->getRequest()->etapa != 'Rc') { | |
236 | + $notaExame = $this->getNotaAtual($etapa = 'Rc'); | |
237 | + $isValid = empty($notaExame); | |
238 | + | |
239 | + if(! $isValid) | |
240 | + $this->messenger->append('Nota da matrícula '. $this->getRequest()->matricula_id .' somente pode ser removida, após remover nota do exame.', 'error'); | |
241 | + } | |
242 | + | |
243 | + return $isValid; | |
244 | + } | |
245 | + | |
246 | + | |
247 | + protected function validatesInexistenceNotasInNextEtapas() { | |
248 | + $etapasComNota = array(); | |
249 | + | |
250 | + if (is_numeric($this->getRequest()->etapa)) { | |
251 | + $etapas = $this->serviceBoletim()->getOption('etapas'); | |
252 | + $etapa = $this->getRequest()->etapa + 1; | |
253 | + | |
254 | + for($etapa; $etapa <= $etapas; $etapa++) { | |
255 | + $nota = $this->getNotaAtual($etapa); | |
256 | + | |
257 | + if (! empty($nota)) | |
258 | + $etapasComNota[] = $etapa; | |
259 | + } | |
260 | + | |
261 | + if (! empty($etapasComNota)) { | |
262 | + $msg = "Nota somente pode ser removida, após remover as notas lançadas nas etapas posteriores: " . | |
263 | + join(', ', $etapasComNota) . '.'; | |
264 | + $this->messenger->append($msg, 'error'); | |
265 | + } | |
266 | + } | |
267 | + | |
268 | + return empty($etapasComNota); | |
269 | + } | |
270 | + | |
271 | + | |
272 | + // delete falta validations | |
273 | + | |
274 | + | |
275 | + protected function validatesInexistenceFaltasInNextEtapas() { | |
276 | + $etapasComFalta = array(); | |
277 | + | |
278 | + if (is_numeric($this->getRequest()->etapa)) { | |
279 | + $etapas = $this->serviceBoletim()->getOption('etapas'); | |
280 | + $etapa = $this->getRequest()->etapa + 1; | |
281 | + | |
282 | + for($etapa; $etapa <= $etapas; $etapa++) { | |
283 | + $falta = $this->getFaltaAtual($etapa); | |
284 | + | |
285 | + if(! empty($falta)) | |
286 | + $etapasComFalta[] = $etapa; | |
287 | + | |
288 | + } | |
289 | + | |
290 | + if (! empty($etapasComFalta)) | |
291 | + $this->messenger->append("Falta somente pode ser removida, após remover as faltas lançadas nas etapas posteriores: " . join(', ', $etapasComFalta) . '.', 'error'); | |
292 | + } | |
293 | + | |
294 | + return empty($etapasComFalta); | |
295 | + } | |
296 | + | |
297 | + | |
298 | + protected function validatesPresenceOfMatriculaIdOrComponenteCurricularId() { | |
299 | + if (empty($this->getRequest()->componente_curricular_id) && empty($this->getRequest()->matricula_id)) { | |
300 | + $this->messenger->append('É necessário receber matricula_id ou componente_curricular_id.', 'error'); | |
301 | + return false; | |
302 | + } | |
303 | + | |
304 | + return true; | |
305 | + } | |
306 | + | |
307 | + | |
308 | + // responders validations | |
309 | + | |
310 | + | |
311 | + protected function canGetMatriculas() { | |
312 | + return $this->validatesPresenceOf(array('instituicao_id', | |
313 | + 'escola_id', | |
314 | + 'curso_id', | |
315 | + 'curso_id', | |
316 | + 'serie_id', | |
317 | + 'turma_id', | |
318 | + 'ano', | |
319 | + 'etapa')) && | |
320 | + $this->validatesPresenceOfMatriculaIdOrComponenteCurricularId() && | |
321 | + $this->validatesCanChangeDiarioForAno(); | |
322 | + } | |
323 | + | |
324 | + | |
325 | + protected function canPost() { | |
326 | + return $this->validatesPresenceOf('etapa') && | |
327 | + $this->validatesPresenceOf('matricula_id'); | |
328 | + } | |
329 | + | |
330 | + | |
331 | + protected function canPostNota() { | |
332 | + return $this->canPost() && | |
333 | + $this->validatesIsNumeric('att_value') && | |
334 | + $this->validatesValueOfAttValueIsInOpcoesNotas(false) && | |
335 | + $this->validatesPresenceOf('componente_curricular_id') && | |
336 | + $this->validatesRegraAvaliacaoHasNota() && | |
337 | + $this->validatesRegraAvaliacaoHasFormulaRecuperacao() && | |
338 | + $this->validatesRegraAvaliacaoHasFormulaRecuperacaoWithTypeRecuperacao() && | |
339 | + $this->validatesPreviousNotasHasBeenSet(); | |
340 | + } | |
341 | + | |
342 | + | |
343 | + protected function canPostFalta() { | |
344 | + return $this->canPost() && | |
345 | + $this->validatesIsNumeric('att_value') && | |
346 | + $this->validatesPreviousFaltasHasBeenSet(); | |
347 | + } | |
348 | + | |
349 | + | |
350 | + protected function canPostParecer() { | |
351 | + | |
352 | + return $this->canPost() && | |
353 | + $this->validatesPresenceOf('att_value') && | |
354 | + $this->validatesEtapaParecer() && | |
355 | + $this->validatesRegraAvaliacaoHasParecer() && | |
356 | + $this->validatesPresenceOfComponenteCurricularIdIfParecerComponente(); | |
357 | + } | |
358 | + | |
359 | + | |
360 | + protected function canDelete() { | |
361 | + return $this->validatesPresenceOf('etapa'); | |
362 | + } | |
363 | + | |
364 | + | |
365 | + protected function canDeleteNota() { | |
366 | + return $this->canDelete() && | |
367 | + $this->validatesPresenceOf('componente_curricular_id') && | |
368 | + $this->validatesInexistenceOfNotaExame() && | |
369 | + $this->validatesInexistenceNotasInNextEtapas(); | |
370 | + } | |
371 | + | |
372 | + | |
373 | + protected function canDeleteFalta() { | |
374 | + return $this->canDelete() && | |
375 | + $this->validatesInexistenceFaltasInNextEtapas(); | |
376 | + } | |
377 | + | |
378 | + | |
379 | + protected function canDeleteParecer() { | |
380 | + return $this->canDelete() && | |
381 | + $this->validatesEtapaParecer() && | |
382 | + $this->validatesPresenceOfComponenteCurricularIdIfParecerComponente(); | |
383 | + } | |
384 | + | |
385 | + | |
386 | + // responders | |
387 | + | |
388 | + // post | |
389 | + | |
390 | + protected function postNota() { | |
391 | + if ($this->canPostNota()) { | |
392 | + | |
393 | + $nota = new Avaliacao_Model_NotaComponente(array( | |
394 | + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, | |
395 | + 'nota' => urldecode($this->getRequest()->att_value), | |
396 | + 'etapa' => $this->getRequest()->etapa)); | |
397 | + | |
398 | + $this->serviceBoletim()->addNota($nota); | |
399 | + $this->trySaveServiceBoletim(); | |
400 | + $this->messenger->append('Nota matrícula '. $this->getRequest()->matricula_id .' alterada com sucesso.', 'success'); | |
401 | + } | |
402 | + | |
403 | + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); | |
404 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
405 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
406 | + } | |
407 | + | |
408 | + | |
409 | + // TODO mover validacao para canPostFalta | |
410 | + protected function postFalta() { | |
411 | + | |
412 | + $canPost = $this->canPostFalta(); | |
413 | + if ($canPost && $this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) | |
414 | + $canPost = $this->validatesPresenceOf('componente_curricular_id'); | |
415 | + | |
416 | + if ($canPost) { | |
417 | + if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) $falta = $this->getFaltaComponente(); | |
418 | + elseif ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) | |
419 | + $falta = $this->getFaltaGeral(); | |
420 | + | |
421 | + $this->serviceBoletim()->addFalta($falta); | |
422 | + $this->trySaveServiceBoletim(); | |
423 | + $this->messenger->append('Falta matrícula '. $this->getRequest()->matricula_id .' alterada com sucesso.', 'success'); | |
424 | + } | |
425 | + | |
426 | + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); | |
427 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
428 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
429 | + } | |
430 | + | |
431 | + | |
432 | + protected function postParecer() { | |
433 | + | |
434 | + if ($this->canPostParecer()) { | |
435 | + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); | |
436 | + $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; | |
437 | + | |
438 | + if ($tpParecer == $cnsParecer::ETAPA_COMPONENTE || $tpParecer == $cnsParecer::ANUAL_COMPONENTE) | |
439 | + $parecer = $this->getParecerComponente(); | |
440 | + else | |
441 | + $parecer = $this->getParecerGeral(); | |
442 | + | |
443 | + $this->serviceBoletim()->addParecer($parecer); | |
444 | + $this->trySaveServiceBoletim(); | |
445 | + $this->messenger->append('Parecer descritivo matricula '. $this->getRequest()->matricula_id .' alterado com sucesso.', 'success'); | |
446 | + } | |
447 | + | |
448 | + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); | |
449 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
450 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
451 | + } | |
452 | + | |
453 | + | |
454 | + // delete | |
455 | + | |
456 | + protected function deleteNota() { | |
457 | + if ($this->canDeleteNota()) { | |
458 | + | |
459 | + $nota = $this->getNotaAtual(); | |
460 | + if (empty($nota) && ! is_numeric($nota)) | |
461 | + $this->messenger->append('Nota matrícula '. $this->getRequest()->matricula_id .' inexistente ou já removida.', 'notice'); | |
462 | + else | |
463 | + { | |
464 | + $this->serviceBoletim()->deleteNota($this->getRequest()->etapa, $this->getRequest()->componente_curricular_id); | |
465 | + $this->trySaveServiceBoletim(); | |
466 | + $this->messenger->append('Nota matrícula '. $this->getRequest()->matricula_id .' removida com sucesso.', 'success'); | |
467 | + } | |
468 | + } | |
469 | + | |
470 | + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); | |
471 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
472 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
473 | + } | |
474 | + | |
475 | + | |
476 | + protected function deleteFalta() { | |
477 | + $canDelete = $this->canDeleteFalta(); | |
478 | + $cnsPresenca = RegraAvaliacao_Model_TipoPresenca; | |
479 | + $tpPresenca = $this->serviceBoletim()->getRegra()->get('tipoPresenca'); | |
480 | + | |
481 | + if ($canDelete && $tpPresenca == $cnsPresenca::POR_COMPONENTE) { | |
482 | + $canDelete = $this->validatesPresenceOf('componente_curricular_id'); | |
483 | + $componenteCurricularId = $this->getRequest()->componente_curricular_id; | |
484 | + } | |
485 | + else | |
486 | + $componenteCurricularId = null; | |
487 | + | |
488 | + if ($canDelete && is_null($this->getFaltaAtual())) { | |
489 | + $this->messenger->append('Falta matrícula '. $this->getRequest()->matricula_id .' inexistente ou já removida.', 'notice'); | |
490 | + } | |
491 | + elseif ($canDelete) { | |
492 | + $this->serviceBoletim()->deleteFalta($this->getRequest()->etapa, $componenteCurricularId); | |
493 | + $this->trySaveServiceBoletim(); | |
494 | + $this->messenger->append('Falta matrícula '. $this->getRequest()->matricula_id .' removida com sucesso.', 'success'); | |
495 | + } | |
496 | + | |
497 | + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); | |
498 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
499 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
500 | + } | |
501 | + | |
502 | + | |
503 | + protected function deleteParecer() { | |
504 | + if ($this->canDeleteParecer()) { | |
505 | + $parecerAtual = $this->getParecerAtual(); | |
506 | + | |
507 | + if ((is_null($parecerAtual) || $parecerAtual == '')) { | |
508 | + $this->messenger->append('Parecer descritivo matrícula '. $this->getRequest()->matricula_id .' inexistente ou já removido.', 'notice'); | |
509 | + } | |
510 | + else{ | |
511 | + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); | |
512 | + $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; | |
513 | + | |
514 | + if ($tpParecer == $cnsParecer::ANUAL_COMPONENTE || $tpParecer == $cnsParecer::ETAPA_COMPONENTE) | |
515 | + $this->serviceBoletim()->deleteParecer($this->getRequest()->etapa, $this->getRequest()->componente_curricular_id); | |
516 | + else | |
517 | + $this->serviceBoletim()->deleteParecer($this->getRequest()->etapa); | |
518 | + | |
519 | + $this->trySaveServiceBoletim(); | |
520 | + $this->messenger->append('Parecer descritivo matrícula '. $this->getRequest()->matricula_id .' removido com sucesso.', 'success'); | |
521 | + } | |
522 | + } | |
523 | + | |
524 | + $this->appendResponse('componente_curricular_id', $this->getRequest()->componente_curricular_id); | |
525 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
526 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
527 | + } | |
528 | + | |
529 | + | |
530 | + // get | |
531 | + | |
532 | + protected function getMatriculas() { | |
533 | + $matriculas = array(); | |
534 | + | |
535 | + if ($this->canGetMatriculas()) { | |
536 | + $alunos = new clsPmieducarMatriculaTurma(); | |
537 | + $alunos->setOrderby('nome'); | |
538 | + | |
539 | + $alunos = $alunos->lista( | |
540 | + $this->getRequest()->matricula_id, | |
541 | + $this->getRequest()->turma_id, | |
542 | + NULL, | |
543 | + NULL, | |
544 | + NULL, | |
545 | + NULL, | |
546 | + NULL, | |
547 | + NULL, | |
548 | + 1, | |
549 | + $this->getRequest()->serie_id, | |
550 | + $this->getRequest()->curso_id, | |
551 | + $this->getRequest()->escola_id, | |
552 | + $this->getRequest()->instituicao_id, | |
553 | + $this->getRequest()->aluno_id, | |
554 | + NULL, | |
555 | + NULL, | |
556 | + NULL, | |
557 | + NULL, | |
558 | + $this->getRequest()->ano, | |
559 | + NULL, | |
560 | + TRUE, | |
561 | + NULL, | |
562 | + NULL, | |
563 | + TRUE, | |
564 | + NULL, | |
565 | + NULL, | |
566 | + NULL, | |
567 | + NULL, | |
568 | + NULL, | |
569 | + NULL | |
570 | + ); | |
571 | + | |
572 | + if (! is_array($alunos)) | |
573 | + $alunos = array(); | |
574 | + | |
575 | + foreach($alunos as $aluno) { | |
576 | + $matricula = array(); | |
577 | + $matriculaId = $aluno['ref_cod_matricula']; | |
578 | + | |
579 | + // seta id da matricula a ser usado pelo metodo serviceBoletim | |
580 | + $this->setCurrentMatriculaId($matriculaId); | |
581 | + | |
582 | + $matricula['componentes_curriculares'] = $this->loadComponentesCurricularesForMatricula($matriculaId); | |
583 | + $matricula['matricula_id'] = $aluno['ref_cod_matricula']; | |
584 | + $matricula['aluno_id'] = $aluno['ref_cod_aluno']; | |
585 | + $matricula['nome'] = $this->safeString($aluno['nome_aluno']); | |
586 | + | |
587 | + $matriculas[] = $matricula; | |
588 | + } | |
589 | + } | |
590 | + | |
591 | + // adiciona regras de avaliacao | |
592 | + if(! empty($matriculas)) { | |
593 | + $this->appendResponse('details', $this->getRegraAvaliacao()); | |
594 | + $this->appendResponse('situacao', $this->getSituacaoMatricula()); | |
595 | + } | |
596 | + | |
597 | + $this->appendResponse('matricula_id', $this->getRequest()->matricula_id); | |
598 | + | |
599 | + return $matriculas; | |
600 | + } | |
601 | + | |
602 | + // metodos auxiliares responders | |
603 | + | |
604 | + | |
605 | + // TODO usar esta funcao onde é verificado se parecer geral | |
606 | + protected function parecerGeral() { | |
607 | + $tiposParecerGeral = array(RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL, | |
608 | + RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_GERAL); | |
609 | + | |
610 | + return in_array($this->serviceBoletim()->getRegra()->get('parecerDescritivo'), $tiposParecerGeral); | |
611 | + } | |
612 | + | |
613 | + | |
614 | + protected function setCurrentMatriculaId($matriculaId) { | |
615 | + $this->_currentMatriculaId = $matriculaId; | |
616 | + } | |
617 | + | |
618 | + | |
619 | + protected function getCurrentMatriculaId() { | |
620 | + // caso tenha setado _currentMatriculaId, ignora matricula_id recebido nos parametros | |
621 | + if(! is_null($this->_currentMatriculaId)) | |
622 | + $matriculaId = $this->_currentMatriculaId; | |
623 | + elseif (! is_null($this->getRequest()->matricula_id)) | |
624 | + $matriculaId = $this->getRequest()->matricula_id; | |
625 | + else | |
626 | + throw new CoreExt_Exception("Não foi possivel recuperar o id da matricula atual."); | |
627 | + | |
628 | + return $matriculaId; | |
629 | + } | |
630 | + | |
631 | + | |
632 | + protected function serviceBoletim($reload = false) { | |
633 | + $matriculaId = $this->getCurrentMatriculaId(); | |
634 | + | |
635 | + if (! isset($this->_boletimServiceInstances)) | |
636 | + $this->_boletimServiceInstances = array(); | |
637 | + | |
638 | + // set service | |
639 | + if (! isset($this->_boletimServiceInstances[$matriculaId]) || $reload) { | |
640 | + try { | |
641 | + $params = array('matricula' => $matriculaId, 'usuario' => $this->getSession()->id_pessoa); | |
642 | + $this->_boletimServiceInstances[$matriculaId] = new Avaliacao_Service_Boletim($params); | |
643 | + } | |
644 | + catch (Exception $e){ | |
645 | + $this->messenger->append("Erro ao instanciar serviço boletim para matricula {$matriculaId}: " . $e->getMessage(), 'error', true); | |
646 | + } | |
647 | + } | |
648 | + | |
649 | + // validates service | |
650 | + if (is_null($this->_boletimServiceInstances[$matriculaId])) | |
651 | + throw new CoreExt_Exception("Não foi possivel instanciar o serviço boletim para a matricula $matriculaId."); | |
652 | + | |
653 | + return $this->_boletimServiceInstances[$matriculaId]; | |
654 | + } | |
655 | + | |
656 | + | |
657 | + protected function trySaveServiceBoletim() { | |
658 | + try { | |
659 | + $this->serviceBoletim()->save(); | |
660 | + } | |
661 | + catch (CoreExt_Service_Exception $e) { | |
662 | + // excecoes ignoradas :( pois servico lanca excecoes de alertas, que não são exatamente erros. | |
663 | + // error_log('CoreExt_Service_Exception ignorada: ' . $e->getMessage()); | |
664 | + } | |
665 | + } | |
666 | + | |
667 | + | |
668 | + | |
669 | + // metodos auxiliares getFalta | |
670 | + | |
671 | + protected function getQuantidadeFalta() { | |
672 | + $quantidade = (int) $this->getRequest()->att_value; | |
673 | + | |
674 | + if ($quantidade < 0) | |
675 | + $quantidade = 0; | |
676 | + | |
677 | + return $quantidade; | |
678 | + } | |
679 | + | |
680 | + | |
681 | + protected function getFaltaGeral() { | |
682 | + return new Avaliacao_Model_FaltaGeral(array( | |
683 | + 'quantidade' => $this->getQuantidadeFalta(), | |
684 | + 'etapa' => $this->getRequest()->etapa | |
685 | + )); | |
686 | + } | |
687 | + | |
688 | + | |
689 | + protected function getFaltaComponente() { | |
690 | + return new Avaliacao_Model_FaltaComponente(array( | |
691 | + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, | |
692 | + 'quantidade' => $this->getQuantidadeFalta(), | |
693 | + 'etapa' => $this->getRequest()->etapa | |
694 | + )); | |
695 | + } | |
696 | + | |
697 | + | |
698 | + // metodos auxiliares getParecer | |
699 | + | |
700 | + protected function getParecerComponente() { | |
701 | + return new Avaliacao_Model_ParecerDescritivoComponente(array( | |
702 | + 'componenteCurricular' => $this->getRequest()->componente_curricular_id, | |
703 | + 'parecer' => $this->safeStringForDb($this->getRequest()->att_value), | |
704 | + 'etapa' => $this->getRequest()->etapa | |
705 | + )); | |
706 | + } | |
707 | + | |
708 | + | |
709 | + protected function getParecerGeral() { | |
710 | + return new Avaliacao_Model_ParecerDescritivoGeral(array( | |
711 | + 'parecer' => $this->safeStringForDb($this->getRequest()->att_value), | |
712 | + 'etapa' => $this->getRequest()->etapa | |
713 | + )); | |
714 | + } | |
715 | + | |
716 | + | |
717 | + // metodos auxiliares getSituacaoMatricula | |
718 | + | |
719 | + protected function getSituacaoMatricula($ccId = null) { | |
720 | + if (is_null($ccId)) | |
721 | + $ccId = $this->getRequest()->componente_curricular_id; | |
722 | + | |
723 | + $situacao = 'Situação não recuperada'; | |
724 | + | |
725 | + try { | |
726 | + $situacaoCc = $this->serviceBoletim()->getSituacaoComponentesCurriculares()->componentesCurriculares[$ccId]; | |
727 | + $situacao = App_Model_MatriculaSituacao::getInstance()->getValue($situacaoCc->situacao); | |
728 | + } | |
729 | + catch (Exception $e) { | |
730 | + $matriculaId = $this->getRequest()->matricula_id; | |
731 | + $this->messenger->append("Erro ao recuperar situação da matrícula '$matriculaId': " . | |
732 | + $e->getMessage()); | |
733 | + } | |
734 | + | |
735 | + return $this->safeString($situacao); | |
736 | + } | |
737 | + | |
738 | + | |
739 | + // outros metodos auxiliares | |
740 | + | |
741 | + protected function loadComponentesCurricularesForMatricula($matriculaId) { | |
742 | + $componentesCurriculares = array(); | |
743 | + | |
744 | + $componenteCurricularId = $this->getRequest()->componente_curricular_id; | |
745 | + $_componentesCurriculares = App_Model_IedFinder::getComponentesPorMatricula($matriculaId, null, null, $componenteCurricularId); | |
746 | + | |
747 | + foreach($_componentesCurriculares as $_componente) { | |
748 | + $componente = array(); | |
749 | + | |
750 | + $componente['id'] = $_componente->get('id'); | |
751 | + $componente['nome'] = $this->safeString($_componente->get('nome')); | |
752 | + $componente['nota_atual'] = $this->getNotaAtual($etapa = null, $componente['id']); | |
753 | + $componente['nota_exame'] = $this->getNotaExame($componente['id']); | |
754 | + //$componente['nota_necessaria_exame'] = $this->getNotaNecessariaExame($componente['id']); | |
755 | + $componente['falta_atual'] = $this->getFaltaAtual($etapa = null, $componente['id']); | |
756 | + $componente['parecer_atual'] = $this->getParecerAtual($componente['id']); | |
757 | + $componente['situacao'] = $this->getSituacaoMatricula($componente['id']); | |
758 | + | |
759 | + $componentesCurriculares[] = $componente; | |
760 | + } | |
761 | + | |
762 | + // ordenado por id, da mesma maneira que nos boletins, | |
763 | + // obs: poderá ainda ocorrer diferença entre a ordem das areas de conhecimento? | |
764 | + return Portabilis_Array_Utils::sortByKey('id', $componentesCurriculares); | |
765 | + } | |
766 | + | |
767 | + | |
768 | + protected function getNotaAtual($etapa = null, $componenteCurricularId = null) { | |
769 | + // defaults | |
770 | + if (is_null($componenteCurricularId)) | |
771 | + $componenteCurricularId = $this->getRequest()->componente_curricular_id; | |
772 | + | |
773 | + if (is_null($etapa)) | |
774 | + $etapa = $this->getRequest()->etapa; | |
775 | + | |
776 | + // validacao | |
777 | + if (! is_numeric($componenteCurricularId)) { | |
778 | + throw new Exception('Não foi possivel obter a nota atual, pois não foi recebido o id do componente curricular.'); | |
779 | + } | |
780 | + | |
781 | + $nota = urldecode($this->serviceBoletim()->getNotaComponente($componenteCurricularId, $etapa)->nota); | |
782 | + | |
783 | + return str_replace(',', '.', $nota); | |
784 | + } | |
785 | + | |
786 | + | |
787 | + protected function getNotaExame($componenteCurricularId = null) { | |
788 | + // somente recupera nota de exame se estiver buscando as matriculas da ultima etapa | |
789 | + // se existe nota de exame, esta é recuperada mesmo que a regra de avaliação não use mais exame | |
790 | + if($this->getRequest()->etapa == $this->serviceBoletim()->getOption('etapas')) | |
791 | + $nota = $this->getNotaAtual($etapa = 'Rc', $componenteCurricularId); | |
792 | + else | |
793 | + $nota = ''; | |
794 | + | |
795 | + return $nota; | |
796 | + } | |
797 | + | |
798 | + protected function getNotaNecessariaExame($componenteCurricularId = null) { | |
799 | + if (is_null($componenteCurricularId)) | |
800 | + $componenteCurricularId = $this->getRequest()->componente_curricular_id; | |
801 | + | |
802 | + $nota = urldecode($this->serviceBoletim()->preverNotaRecuperacao($componenteCurricularId)); | |
803 | + | |
804 | + return str_replace(',', '.', $nota); | |
805 | + } | |
806 | + | |
807 | + | |
808 | + protected function getFaltaAtual($etapa = null, $componenteCurricularId = null) { | |
809 | + // defaults | |
810 | + if (is_null($componenteCurricularId)) | |
811 | + $componenteCurricularId = $this->getRequest()->componente_curricular_id; | |
812 | + | |
813 | + if (is_null($etapa)) | |
814 | + $etapa = $this->getRequest()->etapa; | |
815 | + | |
816 | + if ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { | |
817 | + if (! is_numeric($componenteCurricularId)) | |
818 | + throw new Exception('Não foi possivel obter a falta atual, pois não foi recebido o id do componente curricular.'); | |
819 | + | |
820 | + $falta = $this->serviceBoletim()->getFalta($etapa, $componenteCurricularId)->quantidade; | |
821 | + } | |
822 | + | |
823 | + elseif ($this->serviceBoletim()->getRegra()->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::GERAL) | |
824 | + $falta = $this->serviceBoletim()->getFalta($etapa)->quantidade; | |
825 | + | |
826 | + return $falta; | |
827 | + } | |
828 | + | |
829 | + | |
830 | + protected function getEtapaParecer() { | |
831 | + if($this->getRequest()->etapa != 'An' && ($this->serviceBoletim()->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE || $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_GERAL)) { | |
832 | + return 'An'; | |
833 | + } | |
834 | + else | |
835 | + return $this->getRequest()->etapa; | |
836 | + } | |
837 | + | |
838 | + | |
839 | + protected function getParecerAtual($componenteCurricularId = null) { | |
840 | + // defaults | |
841 | + if (is_null($componenteCurricularId)) | |
842 | + $componenteCurricularId = $this->getRequest()->componente_curricular_id; | |
843 | + | |
844 | + $etapaComponente = $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == | |
845 | + RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE; | |
846 | + | |
847 | + $anualComponente = $this->serviceBoletim()->getRegra()->get('parecerDescritivo') == | |
848 | + RegraAvaliacao_Model_TipoParecerDescritivo::ANUAL_COMPONENTE; | |
849 | + | |
850 | + if ($etapaComponente or $anualComponente) { | |
851 | + if (! is_numeric($componenteCurricularId)) | |
852 | + throw new Exception('Não foi possivel obter o parecer descritivo atual, pois não foi recebido o id do componente curricular.'); | |
853 | + | |
854 | + $parecer = $this->serviceBoletim()->getParecerDescritivo($this->getEtapaParecer(), $componenteCurricularId)->parecer; | |
855 | + } | |
856 | + else | |
857 | + $parecer = $this->serviceBoletim()->getParecerDescritivo($this->getEtapaParecer())->parecer; | |
858 | + | |
859 | + return $this->safeString($parecer, $transform = false); | |
860 | + } | |
861 | + | |
862 | + | |
863 | + protected function getOpcoesFaltas() { | |
864 | + $opcoes = array(); | |
865 | + | |
866 | + foreach (range(0, 100, 1) as $f) | |
867 | + $opcoes[$f] = $f; | |
868 | + | |
869 | + return $opcoes; | |
870 | + } | |
871 | + | |
872 | + | |
873 | + protected function canGetOpcoesNotas() { | |
874 | + return true; | |
875 | + } | |
876 | + | |
877 | + | |
878 | + protected function getOpcoesNotas() { | |
879 | + $opcoes = array(); | |
880 | + | |
881 | + if ($this->canGetOpcoesNotas()) { | |
882 | + $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); | |
883 | + $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; | |
884 | + | |
885 | + if ($tpNota != $cnsNota::NENHUM) { | |
886 | + $tabela = $this->serviceBoletim()->getRegra()->tabelaArredondamento->findTabelaValor(); | |
887 | + | |
888 | + foreach ($tabela as $item) { | |
889 | + if ($tpNota == $cnsNota::NUMERICA) { | |
890 | + $nota = str_replace(',', '.', (string) $item->nome); | |
891 | + $opcoes[$nota] = $nota; | |
892 | + } | |
893 | + else { | |
894 | + $nota = str_replace(',', '.', (string) $item->valorMaximo); | |
895 | + $opcoes[$nota] = $this->safeString($item->nome . ' (' . $item->descricao . ')'); | |
896 | + } | |
897 | + } | |
898 | + } | |
899 | + } | |
900 | + | |
901 | + return $opcoes; | |
902 | + } | |
903 | + | |
904 | + | |
905 | + protected function canGetRegraAvaliacao() { | |
906 | + return true; | |
907 | + } | |
908 | + | |
909 | + | |
910 | + protected function getRegraAvaliacao() { | |
911 | + $itensRegra = array(); | |
912 | + | |
913 | + if ($this->canGetRegraAvaliacao()) { | |
914 | + $regra = $this->serviceBoletim()->getRegra(); | |
915 | + $itensRegra['id'] = $regra->get('id'); | |
916 | + $itensRegra['nome'] = $this->safeString($regra->get('nome')); | |
917 | + | |
918 | + | |
919 | + // tipo presença | |
920 | + $cnsPresenca = RegraAvaliacao_Model_TipoPresenca; | |
921 | + $tpPresenca = $this->serviceBoletim()->getRegra()->get('tipoPresenca'); | |
922 | + | |
923 | + if($tpPresenca == $cnsPresenca::GERAL) | |
924 | + $itensRegra['tipo_presenca'] = 'geral'; | |
925 | + elseif($tpPresenca == $cnsPresenca::POR_COMPONENTE) | |
926 | + $itensRegra['tipo_presenca'] = 'por_componente'; | |
927 | + else | |
928 | + $itensRegra['tipo_presenca'] = $tpPresenca; | |
929 | + | |
930 | + | |
931 | + // tipo nota | |
932 | + $cnsNota = RegraAvaliacao_Model_Nota_TipoValor; | |
933 | + $tpNota = $this->serviceBoletim()->getRegra()->get('tipoNota'); | |
934 | + | |
935 | + if ($tpNota == $cnsNota::NENHUM) | |
936 | + $itensRegra['tipo_nota'] = 'nenhum'; | |
937 | + elseif ($tpNota == $cnsNota::NUMERICA) | |
938 | + $itensRegra['tipo_nota'] = 'numerica'; | |
939 | + elseif ($tpNota == $cnsNota::CONCEITUAL) { | |
940 | + $itensRegra['tipo_nota'] = 'conceitual'; | |
941 | + //incluido opcoes notas, pois notas conceituais requer isto para visualizar os nomes | |
942 | + } | |
943 | + else | |
944 | + $itensRegra['tipo_nota'] = $tpNota; | |
945 | + | |
946 | + | |
947 | + // tipo parecer | |
948 | + $cnsParecer = RegraAvaliacao_Model_TipoParecerDescritivo; | |
949 | + $tpParecer = $this->serviceBoletim()->getRegra()->get('parecerDescritivo'); | |
950 | + | |
951 | + if ($tpParecer == $cnsParecer::NENHUM) | |
952 | + $itensRegra['tipo_parecer_descritivo'] = 'nenhum'; | |
953 | + elseif ($tpParecer == $cnsParecer::ETAPA_COMPONENTE) | |
954 | + $itensRegra['tipo_parecer_descritivo'] = 'etapa_componente'; | |
955 | + elseif ($tpParecer == $cnsParecer::ETAPA_GERAL) | |
956 | + $itensRegra['tipo_parecer_descritivo'] = 'etapa_geral'; | |
957 | + elseif ($tpParecer == $cnsParecer::ANUAL_COMPONENTE) | |
958 | + $itensRegra['tipo_parecer_descritivo'] = 'anual_componente'; | |
959 | + elseif ($tpParecer == $cnsParecer::ANUAL_GERAL) | |
960 | + $itensRegra['tipo_parecer_descritivo'] = 'anual_geral'; | |
961 | + else | |
962 | + $itensRegra['tipo_parecer_descritivo'] = $tpParecer; | |
963 | + | |
964 | + // opcoes notas | |
965 | + $itensRegra['opcoes_notas'] = $this->getOpcoesNotas(); | |
966 | + | |
967 | + // etapas | |
968 | + $itensRegra['quantidade_etapas'] = $this->serviceBoletim()->getOption('etapas'); | |
969 | + } | |
970 | + | |
971 | + return $itensRegra; | |
972 | + } | |
973 | + | |
974 | + public function Gerar() { | |
975 | + if ($this->isRequestFor('get', 'matriculas')) | |
976 | + $this->appendResponse('matriculas', $this->getMatriculas()); | |
977 | + | |
978 | + elseif ($this->isRequestFor('post', 'nota') || $this->isRequestFor('post', 'nota_exame')) | |
979 | + $this->postNota(); | |
980 | + | |
981 | + elseif ($this->isRequestFor('post', 'falta')) | |
982 | + $this->postFalta(); | |
983 | + | |
984 | + elseif ($this->isRequestFor('post', 'parecer')) | |
985 | + $this->postParecer(); | |
986 | + | |
987 | + elseif ($this->isRequestFor('delete', 'nota') || $this->isRequestFor('delete', 'nota_exame')) | |
988 | + $this->deleteNota(); | |
989 | + | |
990 | + elseif ($this->isRequestFor('delete', 'falta')) | |
991 | + $this->deleteFalta(); | |
992 | + | |
993 | + elseif ($this->isRequestFor('delete', 'parecer')) | |
994 | + $this->deleteParecer(); | |
995 | + | |
996 | + else | |
997 | + $this->notImplementedOperationError(); | |
998 | + } | |
999 | +} | ... | ... |
... | ... | @@ -0,0 +1,65 @@ |
1 | +<?php | |
2 | + | |
3 | +#error_reporting(E_ALL); | |
4 | +#ini_set("display_errors", 1); | |
5 | + | |
6 | +/** | |
7 | + * i-Educar - Sistema de gestão escolar | |
8 | + * | |
9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
10 | + * <ctima@itajai.sc.gov.br> | |
11 | + * | |
12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
15 | + * qualquer versão posterior. | |
16 | + * | |
17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
20 | + * do GNU para mais detalhes. | |
21 | + * | |
22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
25 | + * | |
26 | + * @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
27 | + * @category i-Educar | |
28 | + * @license @@license@@ | |
29 | + * @package Avaliacao | |
30 | + * @subpackage Modules | |
31 | + * @since Arquivo disponível desde a versão ? | |
32 | + * @version $Id$ | |
33 | + */ | |
34 | + | |
35 | +require_once 'Portabilis/Controller/Page/ListController.php'; | |
36 | +require_once 'lib/Portabilis/View/Helper/Application.php'; | |
37 | +require_once 'Portabilis/Business/Professor.php'; | |
38 | + | |
39 | +/** | |
40 | + * DiarioController class. | |
41 | + * | |
42 | + * @author Lucas D'Avila <lucasdavila@portabilis.com.br> | |
43 | + * @category i-Educar | |
44 | + * @license @@license@@ | |
45 | + * @package Avaliacao | |
46 | + * @subpackage Modules | |
47 | + * @since Classe disponível desde a versão 1.1.0 | |
48 | + * @version @@package_version@@ | |
49 | + */ | |
50 | + | |
51 | +class DiarioController extends Portabilis_Controller_Page_ListController | |
52 | +{ | |
53 | + protected $_titulo = 'Lançamento por turma'; | |
54 | + protected $_processoAp = 644; | |
55 | + | |
56 | + public function Gerar() { | |
57 | + $this->inputsHelper()->input('ano'); | |
58 | + $this->inputsHelper()->dynamic(array('instituicao', 'escola', 'curso', 'serie', 'turma', 'etapa')); | |
59 | + $this->inputsHelper()->dynamic(array('componenteCurricular', 'matricula'), array('required' => false)); | |
60 | + | |
61 | + $this->loadResourceAssets($this->getDispatcher()); | |
62 | + } | |
63 | +} | |
64 | +?> | |
65 | + | ... | ... |
ieducar/modules/Avaliacao/Views/FaltaController.php
... | ... | @@ -173,7 +173,7 @@ class FaltaController extends Core_Controller_Page_EditController |
173 | 173 | |
174 | 174 | // Caso o parecer seja por etapa e por componente |
175 | 175 | if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { |
176 | - $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, TRUE); | |
176 | + $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, false); | |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
... | ... | @@ -202,7 +202,7 @@ class FaltaController extends Core_Controller_Page_EditController |
202 | 202 | |
203 | 203 | $this->_service->addFalta($falta); |
204 | 204 | |
205 | - if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { | |
205 | + if (trim($this->getRequest()->parecer) != '' && $this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { | |
206 | 206 | $parecer = new Avaliacao_Model_ParecerDescritivoComponente(array( |
207 | 207 | 'componenteCurricular' => $this->getRequest()->componenteCurricular, |
208 | 208 | 'parecer' => $this->getRequest()->parecer, |
... | ... | @@ -224,4 +224,4 @@ class FaltaController extends Core_Controller_Page_EditController |
224 | 224 | |
225 | 225 | return TRUE; |
226 | 226 | } |
227 | -} | |
228 | 227 | \ No newline at end of file |
228 | +} | ... | ... |
ieducar/modules/Avaliacao/Views/NotaController.php
... | ... | @@ -194,7 +194,7 @@ class NotaController extends Core_Controller_Page_EditController |
194 | 194 | |
195 | 195 | // Caso o parecer seja por etapa e por componente |
196 | 196 | if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { |
197 | - $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, TRUE); | |
197 | + $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, false); | |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
... | ... | @@ -221,7 +221,7 @@ class NotaController extends Core_Controller_Page_EditController |
221 | 221 | $this->_service->addFalta($falta); |
222 | 222 | } |
223 | 223 | |
224 | - if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { | |
224 | + if (trim($this->getRequest()->parecer) != '' && $this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { | |
225 | 225 | $parecer = new Avaliacao_Model_ParecerDescritivoComponente(array( |
226 | 226 | 'componenteCurricular' => $this->getRequest()->componenteCurricular, |
227 | 227 | 'parecer' => $this->getRequest()->parecer, |
... | ... | @@ -243,4 +243,4 @@ class NotaController extends Core_Controller_Page_EditController |
243 | 243 | |
244 | 244 | return TRUE; |
245 | 245 | } |
246 | -} | |
247 | 246 | \ No newline at end of file |
247 | +} | ... | ... |