Commit 3fd4d88c71f20ad53a2de0f6a1328898182ce219
1 parent
868d8082
Exists in
master
Removida a obrigatoriedade de lançamento de notas em Regra de Avaliação:
* Controller de Regra de Avaliação ({{{EditController.php}}}) atualizado, com inclusão de chamada Ajax para a definição da tabela de arredondamento; * {{{Avaliacao_Service_Boletim}}} atualizado para sempre retornar o ''status'' "Aprovado" quando a Regra de Avaliação não usar notas; * Controllers relacionados a {{{Avaliacao_Service_Boletim}}} atualizados para prover o novo cenário de Regra de Avaliação sem notas: * {{{Falta|Nota|ParecerController}}} atualizados para exibirem a etapa ao qual a nota será lançada; * {{{BoletimController}}} atualizado para exibir corretamente o lançamento de faltas por componentes quando a Regra de Avaliação não impõe notas; * Atualizada tabela {{{modules.regra_avaliacao}}}, campo {{{formula_media_id}}} não é mais obrigatório. Ver delta 33.
Showing
12 changed files
with
408 additions
and
64 deletions
Show diff stats
ieducar/misc/database/deltas/33_atualiza_regra_avaliacao_nota_nao_mais_obrigatoria.sql
0 → 100644
... | ... | @@ -0,0 +1,34 @@ |
1 | +-- // | |
2 | + | |
3 | +-- | |
4 | +-- Remove a obrigatoriedade de Fórmula de Média para uma Regra de Avaliação, | |
5 | +-- possibilitando que o campo contenha o valor NULL. | |
6 | +-- | |
7 | +-- @author Eriksen Costa <eriksencosta@gmail.com> | |
8 | +-- @license @@license@@ | |
9 | +-- @version $Id$ | |
10 | +-- | |
11 | + | |
12 | +ALTER TABLE modules.regra_avaliacao | |
13 | + ALTER COLUMN formula_media_id SET DEFAULT NULL; | |
14 | +ALTER TABLE modules.regra_avaliacao | |
15 | + ALTER COLUMN formula_media_id DROP NOT NULL; | |
16 | + | |
17 | +-- //@UNDO | |
18 | + | |
19 | +-- Não é o ideal, já que esse pode ser de uma instituição diferente. Mas como a | |
20 | +-- necessidade de um rollback é muito remota e precisamos satisfazer uma | |
21 | +-- foreign key, pegamos o primeiro id disponível. | |
22 | +UPDATE | |
23 | + modules.regra_avaliacao | |
24 | +SET | |
25 | + formula_media_id = (SELECT id FROM modules.formula_media OFFSET 0 LIMIT 1) | |
26 | +WHERE | |
27 | + formula_media_id IS NULL; | |
28 | + | |
29 | +ALTER TABLE modules.regra_avaliacao | |
30 | + ALTER COLUMN formula_media_id DROP DEFAULT; | |
31 | +ALTER TABLE modules.regra_avaliacao | |
32 | + ALTER COLUMN formula_media_id SET NOT NULL; | |
33 | + | |
34 | +-- // | |
0 | 35 | \ No newline at end of file | ... | ... |
ieducar/misc/database/ieducar.sql
... | ... | @@ -10867,7 +10867,7 @@ SELECT pg_catalog.setval('parecer_geral_id_seq', 1, false); |
10867 | 10867 | CREATE TABLE regra_avaliacao ( |
10868 | 10868 | id integer NOT NULL, |
10869 | 10869 | instituicao_id integer NOT NULL, |
10870 | - formula_media_id integer NOT NULL, | |
10870 | + formula_media_id integer, | |
10871 | 10871 | formula_recuperacao_id integer DEFAULT 0, |
10872 | 10872 | tabela_arredondamento_id integer, |
10873 | 10873 | nome character varying(50) NOT NULL, |
... | ... | @@ -25794,6 +25794,7 @@ INSERT INTO changelog VALUES (29, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '29_cria |
25794 | 25794 | INSERT INTO changelog VALUES (30, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '30_cria_indices_otimizacao_queries_quadro_horarios.sql'); |
25795 | 25795 | INSERT INTO changelog VALUES (31, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '31_remove_constraint_desnecessaria_pmieducar_quadro_horario_horarios.sql'); |
25796 | 25796 | INSERT INTO changelog VALUES (32, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '32_corrige_comentario_em_indices.sql'); |
25797 | +INSERT INTO changelog VALUES (33, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '33_atualiza_regra_avaliacao_nota_nao_mais_obrigatoria.sql'); | |
25797 | 25798 | |
25798 | 25799 | |
25799 | 25800 | -- | ... | ... |
ieducar/modules/Avaliacao/Service/Boletim.php
... | ... | @@ -1163,11 +1163,6 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1163 | 1163 | */ |
1164 | 1164 | public function getSituacaoComponentesCurriculares() |
1165 | 1165 | { |
1166 | - // Carrega as médias pois este método pode ser chamado após a chamada a | |
1167 | - // saveNotas(). | |
1168 | - $mediasComponentes = $this->_loadNotaComponenteCurricularMedia() | |
1169 | - ->getMediasComponentes(); | |
1170 | - | |
1171 | 1166 | $situacao = new stdClass(); |
1172 | 1167 | $situacao->situacao = 0; |
1173 | 1168 | $situacao->componentesCurriculares = array(); |
... | ... | @@ -1175,6 +1170,15 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
1175 | 1170 | // A situação é "aprovado" por padrão |
1176 | 1171 | $situacaoGeral = App_Model_MatriculaSituacao::APROVADO; |
1177 | 1172 | |
1173 | + if ($this->getRegra()->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NENHUM) { | |
1174 | + return $situacao; | |
1175 | + } | |
1176 | + | |
1177 | + // Carrega as médias pois este método pode ser chamado após a chamada a | |
1178 | + // saveNotas(). | |
1179 | + $mediasComponentes = $this->_loadNotaComponenteCurricularMedia() | |
1180 | + ->getMediasComponentes(); | |
1181 | + | |
1178 | 1182 | // Se não tiver nenhuma média ou a quantidade for diferente dos componentes |
1179 | 1183 | // curriculares da matrícula, ainda está em andamento |
1180 | 1184 | if (0 == count($mediasComponentes) || |
... | ... | @@ -2261,6 +2265,10 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable |
2261 | 2265 | */ |
2262 | 2266 | public function saveNotas() |
2263 | 2267 | { |
2268 | + if ($this->getRegra()->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NENHUM) { | |
2269 | + return $this; | |
2270 | + } | |
2271 | + | |
2264 | 2272 | $notaAluno = $this->_getNotaAluno(); |
2265 | 2273 | $notas = $this->getNotas(); |
2266 | 2274 | ... | ... |
ieducar/modules/Avaliacao/Views/BoletimController.php
... | ... | @@ -165,12 +165,27 @@ class BoletimController extends Core_Controller_Page_ViewController |
165 | 165 | $this->addDetalhe(array('Série/Turma', $serie . ' / ' . $turma)); |
166 | 166 | $this->addDetalhe(array('Situação', $situacao)); |
167 | 167 | |
168 | + // Booleano para saber se o tipo de nota é nenhum. | |
169 | + $nenhumaNota = ($this->_service->getRegra()->get('tipoNota') == | |
170 | + RegraAvaliacao_Model_Nota_TipoValor::NENHUM); | |
171 | + | |
172 | + // Booleano para saber o tipo de presença em que ocorre apuração | |
173 | + $porComponente = ($this->_service->getRegra()->get('tipoPresenca') == | |
174 | + RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE); | |
175 | + | |
168 | 176 | // Dados da regra de avaliação |
169 | 177 | $this->addDetalhe(array('Regra avaliação', $this->_service->getRegra())); |
170 | 178 | $this->addDetalhe(array('Apuração de falta', $this->_service->getRegra()->tipoPresenca)); |
171 | 179 | $this->addDetalhe(array('Parecer descritivo', $this->_service->getRegra()->parecerDescritivo)); |
172 | 180 | $this->addDetalhe(array('Progressão', $this->_service->getRegra()->tipoProgressao)); |
173 | - $this->addDetalhe(array('Média', $this->_service->getRegra()->media)); | |
181 | + | |
182 | + if ($nenhumaNota) { | |
183 | + $media = 'Não usa nota'; | |
184 | + } | |
185 | + else { | |
186 | + $media = $this->_service->getRegra()->media; | |
187 | + } | |
188 | + $this->addDetalhe(array('Média', $media)); | |
174 | 189 | |
175 | 190 | // Cria um array com a quantidade de etapas de 1 a n |
176 | 191 | $etapas = range(1, $this->_service->getOption('etapas'), 1); |
... | ... | @@ -186,10 +201,6 @@ class BoletimController extends Core_Controller_Page_ViewController |
186 | 201 | 1 => array('style' => 'background-color: #FFFFFF') |
187 | 202 | ); |
188 | 203 | |
189 | - // Booleano para saber o tipo de presença em que ocorre apuração | |
190 | - $porComponente = ($this->_service->getRegra()->get('tipoPresenca') == | |
191 | - RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE); | |
192 | - | |
193 | 204 | // Helper para criar links e urls |
194 | 205 | $url = CoreExt_View_Helper_UrlHelper::getInstance(); |
195 | 206 | |
... | ... | @@ -208,7 +219,15 @@ class BoletimController extends Core_Controller_Page_ViewController |
208 | 219 | |
209 | 220 | foreach ($etapas as $etapa) { |
210 | 221 | $data = array('data' => sprintf('Etapa %d', $etapa)); |
211 | - $data['colspan'] = $porComponente ? 2 : 1; | |
222 | + | |
223 | + if ($nenhumaNota) { | |
224 | + $data['colspan'] = 1; | |
225 | + } | |
226 | + else { | |
227 | + $data['colspan'] = $porComponente ? 2 : 1; | |
228 | + } | |
229 | + | |
230 | + | |
212 | 231 | $data['attributes'] = $attributes; |
213 | 232 | $labels[] = $data; |
214 | 233 | } |
... | ... | @@ -227,9 +246,15 @@ class BoletimController extends Core_Controller_Page_ViewController |
227 | 246 | |
228 | 247 | // Colspan para tabela com labels e sublabels |
229 | 248 | $colspan += $porComponente && $sit->recuperacao ? 4 : 3; |
230 | - $labels[] = array('data' => $porComponente ? '' : 'Média final', 'attributes' => $attributes, 'colspan' => $porComponente ? $colspan : 1); | |
249 | + if ($nenhumaNota) { | |
250 | + $colspan--; | |
251 | + } | |
252 | + | |
253 | + if (! $nenhumaNota) { | |
254 | + $labels[] = array('data' => $porComponente ? '' : 'Média', 'attributes' => $attributes, 'colspan' => $porComponente ? $colspan : 1); | |
255 | + } | |
231 | 256 | |
232 | - // Inclui coluna para % de presença geral | |
257 | + // Inclui coluna para % de presença geral. | |
233 | 258 | if (!$porComponente) { |
234 | 259 | if ($sit->recuperacao) { |
235 | 260 | $labels[] = array('data' => 'Exame', 'attributes' => $attributes); |
... | ... | @@ -250,11 +275,15 @@ class BoletimController extends Core_Controller_Page_ViewController |
250 | 275 | $subLabels = array(); |
251 | 276 | $subLabels[] = array('attributes' => $attributes); |
252 | 277 | for ($i = 0, $loop = count($etapas); $i < $loop; $i++) { |
253 | - $subLabels[] = array('data' => 'Nota', 'attributes' => $attributes); | |
278 | + if (! $nenhumaNota) { | |
279 | + $subLabels[] = array('data' => 'Nota', 'attributes' => $attributes); | |
280 | + } | |
254 | 281 | $subLabels[] = array('data' => 'Falta', 'attributes' => $attributes); |
255 | 282 | } |
256 | 283 | |
257 | - $subLabels[] = array('data' => 'Média', 'attributes' => $attributes); | |
284 | + if (! $nenhumaNota) { | |
285 | + $subLabels[] = array('data' => 'Média', 'attributes' => $attributes); | |
286 | + } | |
258 | 287 | |
259 | 288 | if ($sit->recuperacao) { |
260 | 289 | $subLabels[] = array('data' => 'Exame', 'attributes' => $attributes); |
... | ... | @@ -286,13 +315,23 @@ class BoletimController extends Core_Controller_Page_ViewController |
286 | 315 | $faltasStats = $this->_service->getSituacaoFaltas(); |
287 | 316 | |
288 | 317 | // Texto do link |
289 | - $linkText = ($porComponente ? 'nota/falta' : 'nota'); | |
318 | + if ($nenhumaNota) { | |
319 | + $linkText = 'falta'; | |
320 | + $linkPath = 'falta'; | |
321 | + } | |
322 | + else { | |
323 | + $linkText = ($porComponente ? 'nota/falta' : 'nota'); | |
324 | + $linkPath = 'nota'; | |
325 | + } | |
290 | 326 | |
291 | 327 | // Parâmetros para o link de nota/falta nova |
292 | 328 | $newLink = array( |
293 | 329 | 'text' => 'Lançar ' . $linkText, |
294 | - 'path' => 'nota', | |
295 | - 'query' => array('matricula' => $matricula['cod_matricula'], 'componenteCurricular' => 0) | |
330 | + 'path' => $linkPath, | |
331 | + 'query' => array( | |
332 | + 'matricula' => $matricula['cod_matricula'], | |
333 | + 'componenteCurricular' => 0 | |
334 | + ) | |
296 | 335 | ); |
297 | 336 | |
298 | 337 | $iteration = 0; |
... | ... | @@ -302,12 +341,12 @@ class BoletimController extends Core_Controller_Page_ViewController |
302 | 341 | // Nome do componente curricular |
303 | 342 | $data[] = array('data' => $componente, 'attributes' => array('style' => 'padding: 5px; text-align: left')); |
304 | 343 | |
305 | - $notas = $notasComponentes[$id]; | |
306 | - $mediaSituacao = $mediasSituacoes->componentesCurriculares[$id]; | |
307 | - $medias = $mediasComponentes[$id]; | |
308 | - $faltas = $faltasComponentes[$id]; | |
309 | - $faltaStats = $faltasStats->componentesCurriculares[$id]; | |
310 | - $parecer = NULL; | |
344 | + $notas = $notasComponentes[$id]; | |
345 | + $mediaSituacao = $mediasSituacoes->componentesCurriculares[$id]; | |
346 | + $medias = $mediasComponentes[$id]; | |
347 | + $faltas = $faltasComponentes[$id]; | |
348 | + $faltaStats = $faltasStats->componentesCurriculares[$id]; | |
349 | + $parecer = NULL; | |
311 | 350 | |
312 | 351 | // Caso os pareceres sejam por componente e anuais, recupera a instância |
313 | 352 | if ($parecerComponenteAnual) { |
... | ... | @@ -343,36 +382,64 @@ class BoletimController extends Core_Controller_Page_ViewController |
343 | 382 | |
344 | 383 | if (isset($faltas[$i])) { |
345 | 384 | $update['query']['etapa'] = $faltas[$i]->etapa; |
346 | - $falta = $url->l($faltas[$i]->quantidade, 'nota', $update); | |
385 | + $linkPath = $nenhumaNota ? 'falta' : 'nota'; | |
386 | + $falta = $url->l($faltas[$i]->quantidade, $linkPath, $update); | |
347 | 387 | } |
348 | 388 | |
349 | - if (is_null($nota)) { | |
350 | - if ($porComponente) { | |
351 | - if (is_null($falta)) { | |
352 | - $colspan = 2; | |
353 | - } | |
354 | - else { | |
355 | - $colspan = 1; | |
389 | + /* | |
390 | + * Exibição muito dinâmica. Em resumo, os casos são: | |
391 | + * | |
392 | + * 1. nota & falta componente | |
393 | + * 2. nota | |
394 | + * 3. falta componente | |
395 | + * 4. falta geral | |
396 | + */ | |
397 | + if ($nenhumaNota) { | |
398 | + $colspan = 1; | |
399 | + } | |
400 | + elseif (! $nenhumaNota && $porComponente && is_null($falta)) { | |
401 | + $colspan = 2; | |
402 | + } | |
403 | + else { | |
404 | + $colspan = 1; | |
405 | + } | |
406 | + | |
407 | + // Caso 1. | |
408 | + if (! $nenhumaNota) { | |
409 | + if ($nota) { | |
410 | + // Caso 2: resolvido com colspan. | |
411 | + $data[] = array('data' => $nota, 'attributes' => $attributes, 'colspan' => $colspan); | |
412 | + | |
413 | + if ($porComponente) { | |
414 | + $data[] = array('data' => $falta, 'attributes' => $attributes); | |
356 | 415 | } |
357 | 416 | } |
358 | 417 | else { |
359 | - $colspan = NULL; | |
418 | + $data[] = array('data' => $new, 'attributes' => $attributes, 'colspan' => $colspan); | |
419 | + $new = ''; | |
360 | 420 | } |
361 | - $data[] = array('data' => $new, 'attributes' => $attributes, 'colspan' => $colspan); | |
362 | - $new = ''; | |
363 | 421 | } |
364 | - else { | |
365 | - $data[] = array('data' => $nota, 'attributes' => $attributes); | |
366 | - | |
367 | - if ($porComponente) { | |
368 | - $data[] = array('data' => $falta, 'attributes' => $attributes); | |
422 | + // Caso 3. | |
423 | + elseif ($nenhumaNota && $porComponente) { | |
424 | + if ($falta) { | |
425 | + $data[] = array('data' => $falta, 'attributes' => $attributes, 'colspan' => $colspan); | |
426 | + } | |
427 | + else { | |
428 | + $data[] = array('data' => $new, 'attributes' => $attributes, 'colspan' => $colspan); | |
429 | + $new = ''; | |
369 | 430 | } |
370 | 431 | } |
432 | + // Caso 4. | |
433 | + else { | |
434 | + $data[] = array('data' => '', 'attributes' => $attributes); | |
435 | + } | |
371 | 436 | } |
372 | 437 | |
373 | 438 | // Média no componente curricular |
374 | - $media = $medias[0]->mediaArredondada . ($medias[0]->etapa == 'Rc' ? ' (Rc)' : ''); | |
375 | - $data[] = array('data' => $media, 'attributes' => $attributes); | |
439 | + if (! $nenhumaNota) { | |
440 | + $media = $medias[0]->mediaArredondada . ($medias[0]->etapa == 'Rc' ? ' (Rc)' : ''); | |
441 | + $data[] = array('data' => $media, 'attributes' => $attributes); | |
442 | + } | |
376 | 443 | |
377 | 444 | // Adiciona uma coluna extra caso aluno esteja em exame em alguma componente curricular |
378 | 445 | if ($sit->recuperacao) { |
... | ... | @@ -470,14 +537,15 @@ class BoletimController extends Core_Controller_Page_ViewController |
470 | 537 | $data[] = array('data' => $new, 'attributes' => $attributes); |
471 | 538 | $new = ''; |
472 | 539 | |
473 | - if ($porComponente) { | |
540 | + if ($porComponente && ! $nenhumaNota) { | |
474 | 541 | $data[] = array('data' => '', 'attributes' => $attributes); |
475 | 542 | } |
476 | 543 | } |
477 | 544 | } |
478 | 545 | |
479 | - // Porcentagem presença | |
480 | - $data[] = array(); | |
546 | + if (! $nenhumaNota) { | |
547 | + $data[] = array(); | |
548 | + } | |
481 | 549 | |
482 | 550 | if ($sit->recuperacao) { |
483 | 551 | $data[] = array('data' => '', 'attributes' => $attributes); |
... | ... | @@ -487,6 +555,7 @@ class BoletimController extends Core_Controller_Page_ViewController |
487 | 555 | $data[] = array('data' => '', 'attributes' => $attributes); |
488 | 556 | } |
489 | 557 | |
558 | + // Porcentagem presença | |
490 | 559 | $data[] = array('data' => sprintf('%.2f%%', $faltasStats->porcentagemPresenca), 'attributes' => $attributes); |
491 | 560 | $data[] = array('data' => $situacao->getValue($sit->falta->situacao), 'attributes' => $attributes); |
492 | 561 | ... | ... |
ieducar/modules/Avaliacao/Views/FaltaController.php
... | ... | @@ -74,9 +74,9 @@ class FaltaController extends Core_Controller_Page_EditController |
74 | 74 | protected $_etapa = NULL; |
75 | 75 | |
76 | 76 | /** |
77 | - * @var Avaliacao_Model_NotaComponente | |
77 | + * @var int | |
78 | 78 | */ |
79 | - protected $_nota = NULL; | |
79 | + protected $_componenteCurricular = NULL; | |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @var Avaliacao_Model_FaltaAbstract |
... | ... | @@ -93,7 +93,7 @@ class FaltaController extends Core_Controller_Page_EditController |
93 | 93 | |
94 | 94 | $this->_options = array( |
95 | 95 | 'new_success' => 'boletim', |
96 | - 'new_success_params' => array('matricula' => $this->getRequest()->matricula), | |
96 | + 'new_success_params' => array('matricula' => $this->getRequest()->matricula), | |
97 | 97 | 'edit_success' => 'boletim', |
98 | 98 | 'edit_success_params' => array('matricula' => $this->getRequest()->matricula), |
99 | 99 | ); |
... | ... | @@ -113,11 +113,23 @@ class FaltaController extends Core_Controller_Page_EditController |
113 | 113 | { |
114 | 114 | $this->_etapa = $this->getRequest()->etapa; |
115 | 115 | $this->_matricula = $this->getRequest()->matricula; |
116 | + $this->_componenteCurricular = $this->getRequest()->componenteCurricular; | |
116 | 117 | |
117 | 118 | if (isset($this->_etapa) && isset($this->_matricula)) { |
118 | 119 | return FALSE; |
119 | 120 | } |
120 | 121 | |
122 | + if ($this->_regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { | |
123 | + $faltas = $this->_service->getFaltasComponentes(); | |
124 | + $faltas = isset($faltas[$this->_componenteCurricular]) ? | |
125 | + $faltas[$this->_componenteCurricular] : array(); | |
126 | + } | |
127 | + else { | |
128 | + $faltas = $this->_service->getFaltasGerais(); | |
129 | + } | |
130 | + | |
131 | + $this->_etapa = count($faltas) + 1; | |
132 | + | |
121 | 133 | return TRUE; |
122 | 134 | } |
123 | 135 | |
... | ... | @@ -127,6 +139,7 @@ class FaltaController extends Core_Controller_Page_EditController |
127 | 139 | protected function _initEditar() |
128 | 140 | { |
129 | 141 | $this->_falta = $this->_service->getFalta($this->_etapa); |
142 | + $this->_parecer = $this->_service->getParecerDescritivo($this->_etapa, $this->_componenteCurricular); | |
130 | 143 | return TRUE; |
131 | 144 | } |
132 | 145 | |
... | ... | @@ -137,16 +150,31 @@ class FaltaController extends Core_Controller_Page_EditController |
137 | 150 | { |
138 | 151 | $this->campoOculto('matricula', $this->_matricula); |
139 | 152 | $this->campoOculto('etapa', $this->_etapa); |
153 | + $this->campoOculto('componenteCurricular', $this->_componenteCurricular); | |
140 | 154 | |
141 | 155 | $matricula = $this->_service->getOption('matriculaData'); |
142 | 156 | |
157 | + if (! isset($this->_etapa)) { | |
158 | + $this->_etapa = 1; | |
159 | + } | |
160 | + | |
143 | 161 | $this->campoRotulo('1nome', 'Nome', $matricula['nome']); |
144 | 162 | $this->campoRotulo('2curso', 'Curso', $matricula['curso_nome']); |
145 | 163 | $this->campoRotulo('3serie', 'Série', $matricula['serie_nome']); |
146 | 164 | $this->campoRotulo('4turma', 'Turma', $matricula['turma_nome']); |
147 | 165 | $this->campoRotulo('5etapa', 'Etapa', $this->_etapa == 'Rc' ? 'Recuperação' : $this->_etapa); |
148 | 166 | |
167 | + if ($this->_regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { | |
168 | + $componentes = $this->_service->getComponentes(); | |
169 | + $this->campoRotulo('6componente_curricular', 'Componente curricular', $componentes[$this->getRequest()->componenteCurricular]); | |
170 | + } | |
171 | + | |
149 | 172 | $this->campoLista('falta', 'Falta', range(0, 100, 1), $this->_falta->quantidade); |
173 | + | |
174 | + // Caso o parecer seja por etapa e por componente | |
175 | + if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { | |
176 | + $this->campoMemo('parecer', 'Parecer', $this->_parecer, 40, 10, TRUE); | |
177 | + } | |
150 | 178 | } |
151 | 179 | |
152 | 180 | /** |
... | ... | @@ -157,13 +185,32 @@ class FaltaController extends Core_Controller_Page_EditController |
157 | 185 | $quantidade = 0 < $this->getRequest()->falta ? |
158 | 186 | (int) $this->getRequest()->falta : 0; |
159 | 187 | |
160 | - $falta = new Avaliacao_Model_FaltaGeral(array( | |
161 | - 'quantidade' => $quantidade, | |
162 | - 'etapa' => $this->getRequest()->etapa | |
163 | - )); | |
188 | + if ($this->_regra->get('tipoPresenca') == RegraAvaliacao_Model_TipoPresenca::POR_COMPONENTE) { | |
189 | + $falta = new Avaliacao_Model_FaltaComponente(array( | |
190 | + 'componenteCurricular' => $this->getRequest()->componenteCurricular, | |
191 | + 'quantidade' => $quantidade, | |
192 | + 'etapa' => $this->getRequest()->etapa | |
193 | + )); | |
194 | + $this->_service->addFalta($falta); | |
195 | + } | |
196 | + else { | |
197 | + $falta = new Avaliacao_Model_FaltaGeral(array( | |
198 | + 'quantidade' => $quantidade, | |
199 | + 'etapa' => $this->getRequest()->etapa | |
200 | + )); | |
201 | + } | |
164 | 202 | |
165 | 203 | $this->_service->addFalta($falta); |
166 | 204 | |
205 | + if ($this->_regra->get('parecerDescritivo') == RegraAvaliacao_Model_TipoParecerDescritivo::ETAPA_COMPONENTE) { | |
206 | + $parecer = new Avaliacao_Model_ParecerDescritivoComponente(array( | |
207 | + 'componenteCurricular' => $this->getRequest()->componenteCurricular, | |
208 | + 'parecer' => $this->getRequest()->parecer, | |
209 | + 'etapa' => $this->getRequest()->etapa | |
210 | + )); | |
211 | + $this->_service->addParecer($parecer); | |
212 | + } | |
213 | + | |
167 | 214 | try { |
168 | 215 | $this->_service->save(); |
169 | 216 | } | ... | ... |
ieducar/modules/Avaliacao/Views/NotaController.php
... | ... | @@ -105,7 +105,7 @@ class NotaController extends Core_Controller_Page_EditController |
105 | 105 | |
106 | 106 | $this->_options = array( |
107 | 107 | 'new_success' => 'boletim', |
108 | - 'new_success_params' => array('matricula' => $this->getRequest()->matricula), | |
108 | + 'new_success_params' => array('matricula' => $this->getRequest()->matricula), | |
109 | 109 | 'edit_success' => 'boletim', |
110 | 110 | 'edit_success_params' => array('matricula' => $this->getRequest()->matricula), |
111 | 111 | ); |
... | ... | @@ -131,6 +131,13 @@ class NotaController extends Core_Controller_Page_EditController |
131 | 131 | return FALSE; |
132 | 132 | } |
133 | 133 | |
134 | + // Determina a etapa atual. | |
135 | + $this->_etapa = 1; | |
136 | + $notas = $this->_service->getNotasComponentes(); | |
137 | + if (isset($notas[$this->_componenteCurricular])) { | |
138 | + $this->_etapa = count($notas[$this->_componenteCurricular]) + 1; | |
139 | + } | |
140 | + | |
134 | 141 | return TRUE; |
135 | 142 | } |
136 | 143 | ... | ... |
ieducar/modules/RegraAvaliacao/Model/Nota/TipoValor.php
... | ... | @@ -44,10 +44,12 @@ require_once 'CoreExt/Enum.php'; |
44 | 44 | */ |
45 | 45 | class RegraAvaliacao_Model_Nota_TipoValor extends CoreExt_Enum |
46 | 46 | { |
47 | + const NENHUM = 0; | |
47 | 48 | const NUMERICA = 1; |
48 | 49 | const CONCEITUAL = 2; |
49 | 50 | |
50 | 51 | protected $_data = array( |
52 | + self::NENHUM => 'Não usar nota', | |
51 | 53 | self::NUMERICA => 'Nota numérica', |
52 | 54 | self::CONCEITUAL => 'Nota conceitual' |
53 | 55 | ); | ... | ... |
ieducar/modules/RegraAvaliacao/Model/Regra.php
... | ... | @@ -76,7 +76,8 @@ class RegraAvaliacao_Model_Regra extends CoreExt_Entity |
76 | 76 | 'tabelaArredondamento' => array( |
77 | 77 | 'value' => 1, |
78 | 78 | 'class' => 'TabelaArredondamento_Model_TabelaDataMapper', |
79 | - 'file' => 'TabelaArredondamento/Model/TabelaDataMapper.php' | |
79 | + 'file' => 'TabelaArredondamento/Model/TabelaDataMapper.php', | |
80 | + 'null' => TRUE | |
80 | 81 | ), |
81 | 82 | 'tipoProgressao' => array( |
82 | 83 | 'value' => 1, |
... | ... | @@ -97,7 +98,8 @@ class RegraAvaliacao_Model_Regra extends CoreExt_Entity |
97 | 98 | 'formulaMedia' => array( |
98 | 99 | 'value' => NULL, |
99 | 100 | 'class' => 'FormulaMedia_Model_FormulaDataMapper', |
100 | - 'file' => 'FormulaMedia/Model/FormulaDataMapper.php' | |
101 | + 'file' => 'FormulaMedia/Model/FormulaDataMapper.php', | |
102 | + 'null' => TRUE | |
101 | 103 | ), |
102 | 104 | 'formulaRecuperacao' => array( |
103 | 105 | 'value' => NULL, |
... | ... | @@ -146,6 +148,20 @@ class RegraAvaliacao_Model_Regra extends CoreExt_Entity |
146 | 148 | // Instituições |
147 | 149 | $instituicoes = array_keys(App_Model_IedFinder::getInstituicoes()); |
148 | 150 | |
151 | + // Fórmula de média é obrigatória? | |
152 | + $isFormulaMediaRequired = TRUE; | |
153 | + | |
154 | + // Média é obrigatória? | |
155 | + $isMediaRequired = TRUE; | |
156 | + | |
157 | + if ($this->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NENHUM) { | |
158 | + $isFormulaMediaRequired = FALSE; | |
159 | + $isMediaRequired = FALSE; | |
160 | + | |
161 | + // Aceita somente o valor NULL quando o tipo de nota é Nenhum. | |
162 | + $formulaMedia = $formulaMedia + array(NULL); | |
163 | + } | |
164 | + | |
149 | 165 | return array( |
150 | 166 | 'instituicao' => new CoreExt_Validate_Choice(array( |
151 | 167 | 'choices' => $instituicoes |
... | ... | @@ -154,7 +170,8 @@ class RegraAvaliacao_Model_Regra extends CoreExt_Entity |
154 | 170 | 'min' => 5, 'max' => 50 |
155 | 171 | )), |
156 | 172 | 'formulaMedia' => new CoreExt_Validate_Choice(array( |
157 | - 'choices' => $formulaMedia | |
173 | + 'choices' => $formulaMedia, | |
174 | + 'required' => $isFormulaMediaRequired | |
158 | 175 | )), |
159 | 176 | 'formulaRecuperacao' => new CoreExt_Validate_Choice(array( |
160 | 177 | 'choices' => $formulaRecuperacao, |
... | ... | @@ -179,8 +196,9 @@ class RegraAvaliacao_Model_Regra extends CoreExt_Entity |
179 | 196 | )), |
180 | 197 | 'media' => $this->validateIfEquals( |
181 | 198 | 'tipoProgressao', RegraAvaliacao_Model_TipoProgressao::CONTINUADA, |
182 | - 'CoreExt_Validate_Numeric', array('min' => 1, 'max' => 10), | |
183 | - array('required' => FALSE, 'min' => 0, 'max' => 10) | |
199 | + 'CoreExt_Validate_Numeric', | |
200 | + array('required' => $isMediaRequired, 'min' => 1, 'max' => 10), | |
201 | + array('required' => $isMediaRequired, 'min' => 0, 'max' => 10) | |
184 | 202 | ), |
185 | 203 | 'porcentagemPresenca' => new CoreExt_Validate_Numeric(array( |
186 | 204 | 'min' => 1, 'max' => 100 | ... | ... |
ieducar/modules/RegraAvaliacao/Views/EditController.php
... | ... | @@ -111,6 +111,102 @@ class EditController extends Core_Controller_Page_EditController |
111 | 111 | ) |
112 | 112 | ); |
113 | 113 | |
114 | + private $_tipoNotaJs = ' | |
115 | +var tipo_nota = new function() { | |
116 | + this.isNenhum = function(docObj, formId, fieldsName) { | |
117 | + var regex = new RegExp(fieldsName); | |
118 | + var form = docObj.getElementById(formId); | |
119 | + | |
120 | + for (var i = 0; i < form.elements.length; i++) { | |
121 | + var elementName = form.elements[i].name; | |
122 | + if (null !== elementName.match(regex)) { | |
123 | + if (form.elements[i].checked == false) { | |
124 | + continue; | |
125 | + } | |
126 | + | |
127 | + docObj.getElementById(\'tabelaArredondamento\').disabled = false; | |
128 | + docObj.getElementById(\'media\').disabled = false; | |
129 | + docObj.getElementById(\'formulaMedia\').disabled = false; | |
130 | + docObj.getElementById(\'formulaRecuperacao\').disabled = false; | |
131 | + | |
132 | + if (form.elements[i].value == 0) { | |
133 | + docObj.getElementById(\'tabelaArredondamento\').disabled = true; | |
134 | + docObj.getElementById(\'media\').disabled = true; | |
135 | + docObj.getElementById(\'formulaMedia\').disabled = true; | |
136 | + docObj.getElementById(\'formulaRecuperacao\').disabled = true; | |
137 | + } | |
138 | + | |
139 | + break; | |
140 | + } | |
141 | + } | |
142 | + }; | |
143 | +}; | |
144 | + | |
145 | +var tabela_arredondamento = new function() { | |
146 | + this.docObj = null; | |
147 | + | |
148 | + this.getTabelasArredondamento = function(docObj, tipoNota) { | |
149 | + tabela_arredondamento.docObj = docObj; | |
150 | + var xml = new ajax(tabela_arredondamento.parseResponse); | |
151 | + xml.envia("/modules/TabelaArredondamento/Views/TabelaTipoNotaAjax.php?tipoNota=" + tipoNota); | |
152 | + }; | |
153 | + | |
154 | + this.parseResponse = function() { | |
155 | + if (arguments[0] === null) { | |
156 | + return; | |
157 | + } | |
158 | + | |
159 | + docObj = tabela_arredondamento.docObj; | |
160 | + | |
161 | + tabelas = arguments[0].getElementsByTagName(\'tabela\'); | |
162 | + docObj.options.length = 0; | |
163 | + for (var i = 0; i < tabelas.length; i++) { | |
164 | + docObj[docObj.options.length] = new Option( | |
165 | + tabelas[i].firstChild.nodeValue, tabelas[i].getAttribute(\'id\'), false, false | |
166 | + ); | |
167 | + } | |
168 | + | |
169 | + if (tabelas.length == 0) { | |
170 | + docObj.options[0] = new Option( | |
171 | + \'O tipo de nota não possui tabela de arredondamento.\', \'\', false, false | |
172 | + ); | |
173 | + } | |
174 | + } | |
175 | +} | |
176 | +'; | |
177 | + | |
178 | + protected function _preRender() | |
179 | + { | |
180 | + parent::_preRender(); | |
181 | + | |
182 | + // Adiciona o código Javascript de controle do formulário. | |
183 | + $js = sprintf(' | |
184 | + <script type="text/javascript"> | |
185 | + %s | |
186 | + | |
187 | + window.onload = function() { | |
188 | + // Desabilita os campos relacionados caso o tipo de nota seja "nenhum". | |
189 | + new tipo_nota.isNenhum(document, \'formcadastro\', \'tipoNota\'); | |
190 | + | |
191 | + // Faz o binding dos eventos isNenhum e getTabelasArredondamento nos | |
192 | + // campos radio de tipo de nota. | |
193 | + var events = function() { | |
194 | + new tipo_nota.isNenhum(document, \'formcadastro\', \'tipoNota\'); | |
195 | + new tabela_arredondamento.getTabelasArredondamento( | |
196 | + document.getElementById(\'tabelaArredondamento\'), | |
197 | + this.value | |
198 | + ); | |
199 | + } | |
200 | + | |
201 | + new ied_forms.bind(document, \'formcadastro\', \'tipoNota\', \'click\', events); | |
202 | + } | |
203 | + </script>', | |
204 | + $this->_tipoNotaJs | |
205 | + ); | |
206 | + | |
207 | + $this->prependOutput($js); | |
208 | + } | |
209 | + | |
114 | 210 | /** |
115 | 211 | * @see clsCadastro#Gerar() |
116 | 212 | */ |
... | ... | @@ -135,9 +231,14 @@ class EditController extends Core_Controller_Page_EditController |
135 | 231 | // Tabela de arredondamento |
136 | 232 | $tabelaArredondamento = $this->getDataMapper()->findTabelaArredondamento($this->getEntity()); |
137 | 233 | $tabelaArredondamento = CoreExt_Entity::entityFilterAttr($tabelaArredondamento, 'id', 'nome'); |
234 | + | |
235 | + if (empty($tabelaArredondamento)) { | |
236 | + $tabelaArredondamento = array(0 => 'O tipo de nota não possui tabela de arredondamento.'); | |
237 | + } | |
238 | + | |
138 | 239 | $this->campoLista('tabelaArredondamento', $this->_getLabel('tabelaArredondamento'), |
139 | 240 | $tabelaArredondamento, $this->getEntity()->get('tabelaArredondamento'), '', |
140 | - FALSE, $this->_getHelp('tabelaArredondamento')); | |
241 | + FALSE, $this->_getHelp('tabelaArredondamento'), '', FALSE, FALSE); | |
141 | 242 | |
142 | 243 | // Tipo progressão |
143 | 244 | $tipoProgressao = RegraAvaliacao_Model_TipoProgressao::getInstance(); |
... | ... | @@ -147,14 +248,14 @@ class EditController extends Core_Controller_Page_EditController |
147 | 248 | |
148 | 249 | // Média |
149 | 250 | $this->campoTexto('media', $this->_getLabel('media'), $this->getEntity()->media, |
150 | - 5, 50, TRUE, FALSE, FALSE, $this->_getHelp('media')); | |
251 | + 5, 50, FALSE, FALSE, FALSE, $this->_getHelp('media')); | |
151 | 252 | |
152 | 253 | // Cálculo média |
153 | 254 | $formulas = $this->getDataMapper()->findFormulaMediaFinal(); |
154 | 255 | $formulas = CoreExt_Entity::entityFilterAttr($formulas, 'id', 'nome'); |
155 | 256 | $this->campoLista('formulaMedia', $this->_getLabel('formulaMedia'), |
156 | 257 | $formulas, $this->getEntity()->get('formulaMedia'), '', FALSE, |
157 | - $this->_getHelp('formulaMedia')); | |
258 | + $this->_getHelp('formulaMedia'), '', FALSE, FALSE); | |
158 | 259 | |
159 | 260 | // Cálculo média recuperação |
160 | 261 | $formulas = $this->getDataMapper()->findFormulaMediaRecuperacao(); | ... | ... |
ieducar/modules/TabelaArredondamento/Model/Tabela.php
... | ... | @@ -91,11 +91,15 @@ class TabelaArredondamento_Model_Tabela extends CoreExt_Entity |
91 | 91 | |
92 | 92 | // Tipo nota |
93 | 93 | $tipoNota = RegraAvaliacao_Model_Nota_TipoValor::getInstance(); |
94 | + $tipoNotas = $tipoNota->getKeys(); | |
95 | + | |
96 | + // Remove "nenhum" das opções. | |
97 | + unset($tipoNotas[RegraAvaliacao_Model_Nota_TipoValor::NENHUM]); | |
94 | 98 | |
95 | 99 | return array( |
96 | 100 | 'instituicao' => new CoreExt_Validate_Choice(array('choices' => $instituicoes)), |
97 | 101 | 'nome' => new CoreExt_Validate_String(array('min' => 5, 'max' => 50)), |
98 | - 'tipoNota' => new CoreExt_Validate_Choice(array('choices' => $tipoNota->getKeys())) | |
102 | + 'tipoNota' => new CoreExt_Validate_Choice(array('choices' => $tipoNotas)) | |
99 | 103 | ); |
100 | 104 | } |
101 | 105 | ... | ... |
ieducar/modules/TabelaArredondamento/Views/EditController.php
... | ... | @@ -154,7 +154,9 @@ class EditController extends Core_Controller_Page_EditController |
154 | 154 | |
155 | 155 | // Tipo de nota |
156 | 156 | $notaTipoValor = RegraAvaliacao_Model_Nota_TipoValor::getInstance(); |
157 | - $this->campoRadio('tipoNota', $this->_getLabel('tipoNota'), $notaTipoValor->getEnums(), | |
157 | + $notaTipos = $notaTipoValor->getEnums(); | |
158 | + unset($notaTipos[RegraAvaliacao_Model_Nota_TipoValor::NENHUM]); | |
159 | + $this->campoRadio('tipoNota', $this->_getLabel('tipoNota'), $notaTipos, | |
158 | 160 | $this->getEntity()->get('tipoNota'), '', $this->_getHelp('tipoNota')); |
159 | 161 | |
160 | 162 | // Parte condicional | ... | ... |
ieducar/modules/TabelaArredondamento/Views/TabelaTipoNotaAjax.php
0 → 100644
... | ... | @@ -0,0 +1,51 @@ |
1 | +<?php | |
2 | + | |
3 | +/** | |
4 | + * i-Educar - Sistema de gestão escolar | |
5 | + * | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | + * | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
13 | + * | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
18 | + * | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
22 | + * | |
23 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package TabelaArredondamento | |
27 | + * @subpackage Modules | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once dirname(__FILE__) . '/../../../includes/bootstrap.php'; | |
33 | +require_once 'include/clsBanco.inc.php'; | |
34 | +require_once 'TabelaArredondamento/Model/TabelaDataMapper.php'; | |
35 | + | |
36 | +$tabelas = array(); | |
37 | + | |
38 | +if (isset($_GET['tipoNota'])) { | |
39 | + $tabela = new TabelaArredondamento_Model_TabelaDataMapper(); | |
40 | + $tabelas = $tabela->findAll(array(), array('tipoNota' => (int) $_GET['tipoNota'])); | |
41 | +} | |
42 | + | |
43 | +header('Content-type: text/xml'); | |
44 | + | |
45 | +echo "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<query xmlns=\"sugestoes\">\n"; | |
46 | + | |
47 | +foreach ($tabelas as $tabela) { | |
48 | + echo sprintf('<tabela id="%d">%s</tabela>', $tabela->id, $tabela->nome); | |
49 | +} | |
50 | + | |
51 | +echo '</query>'; | ... | ... |