Commit 9628e538d7012c1bbd172745eb5f67f1e082112b

Authored by Eriksen Costa
1 parent 04ea81dc
Exists in master

Atualizações diversas na interface de "Escola-série" e "Turma":

 * Detalhe de "Escola-série" exibe agora a carga horária dos componentes curriculares
 * "Turma":
  * O cadastro de turma exibe por padrão os componentes curriculares que serão usados caso não seja definida uma matriz específica para a turma
  * O horário da turma é exibido não importando se o "Curso" é "padrão ano escolar" ou não
  * Detalhe de turma exibe agora a carga horária dos componentes curriculares
ieducar/intranet/educar_disciplina_xml.php
... ... @@ -32,11 +32,14 @@ header('Content-type: text/xml; charset=ISO-8859-1');
32 32  
33 33 require_once 'include/clsBanco.inc.php';
34 34 require_once 'include/funcoes.inc.php';
35   -require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php';
36 35  
37 36 echo "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<query xmlns=\"sugestoes\">\n";
38 37  
  38 +$componentes = array();
  39 +
  40 +// Seleciona os componentes de um curso ou série
39 41 if (is_numeric($_GET['cur']) || is_numeric($_GET['ser'])) {
  42 + require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php';
40 43 $mapper = new ComponenteCurricular_Model_AnoEscolarDataMapper();
41 44  
42 45 if (is_numeric($_GET['cur'])) {
... ... @@ -45,10 +48,19 @@ if (is_numeric($_GET[&#39;cur&#39;]) || is_numeric($_GET[&#39;ser&#39;])) {
45 48 elseif(is_numeric($_GET['ser'])) {
46 49 $componentes = $mapper->findComponentePorSerie($_GET['ser']);
47 50 }
  51 +}
48 52  
49   - foreach ($componentes as $componente) {
50   - print sprintf(' <disciplina cod_disciplina="%d" carga_horaria="%d">%s</disciplina>%s',
51   - $componente->id, $componente->cargaHoraria, $componente, PHP_EOL);
52   - }
  53 +// Seleciona os componentes de uma escola-série
  54 +if (is_numeric($_GET['esc']) && is_numeric($_GET['ser'])) {
  55 + require_once 'App/Model/IedFinder.php';
  56 +
  57 + $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($_GET['ser'],
  58 + $_GET['esc']);
53 59 }
  60 +
  61 +foreach ($componentes as $componente) {
  62 + print sprintf(' <disciplina cod_disciplina="%d" carga_horaria="%d">%s</disciplina>%s',
  63 + $componente->id, $componente->cargaHoraria, $componente, PHP_EOL);
  64 +}
  65 +
54 66 echo "</query>";
55 67 \ No newline at end of file
... ...
ieducar/intranet/educar_escola_serie_det.php
... ... @@ -32,7 +32,8 @@ require_once &#39;include/clsBase.inc.php&#39;;
32 32 require_once 'include/clsDetalhe.inc.php';
33 33 require_once 'include/clsBanco.inc.php';
34 34 require_once 'include/pmieducar/geral.inc.php';
35   -require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php';
  35 +
  36 +require_once 'App/Model/IedFinder.php';
36 37  
37 38 /**
38 39 * clsIndexBase class.
... ... @@ -160,22 +161,20 @@ class indice extends clsDetalhe
160 161 $this->addDetalhe(array( 'Hora Fim Intervalo', $registro['hora_fim_intervalo']));
161 162 }
162 163  
163   - $obj = new clsPmieducarEscolaSerieDisciplina();
164   - $escolaSerieDisciplinas = $obj->lista($this->ref_cod_serie, $this->ref_cod_escola, NULL, 1);
165   -
166   - // Mapper de componente curricular
167   - $componenteMapper = new ComponenteCurricular_Model_ComponenteDataMapper();
  164 + // Componentes da escola-série
  165 + $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($this->ref_cod_serie, $this->ref_cod_escola);
168 166  
169   - if ($escolaSerieDisciplinas) {
  167 + if (0 < count($componentes)) {
170 168 $tabela = '
171 169 <table>
172 170 <tr align="center">
173 171 <td bgcolor="#A1B3BD"><b>Nome</b></td>
  172 + <td bgcolor="#A1B3BD"><b>Carga horária</b></td>
174 173 </tr>';
175 174  
176 175 $cont = 0;
177 176  
178   - foreach ($escolaSerieDisciplinas as $escolaSerieDisciplina) {
  177 + foreach ($componentes as $componente) {
179 178 if (($cont % 2) == 0) {
180 179 $color = ' bgcolor="#E4E9ED" ';
181 180 }
... ... @@ -183,12 +182,13 @@ class indice extends clsDetalhe
183 182 $color = ' bgcolor="#FFFFFF" ';
184 183 }
185 184  
186   - $componente = $componenteMapper->find($escolaSerieDisciplina['ref_cod_disciplina']);
187   -
188 185 $tabela .= sprintf('
189   - <tr>
190   - <td %s align="left">%s</td>
191   - </tr>', $color, $componente);
  186 + <tr>
  187 + <td %s align="left">%s</td>
  188 + <td %s align="center">%.0f h</td>
  189 + </tr>',
  190 + $color, $componente, $color, $componente->cargaHoraria
  191 + );
192 192  
193 193 $cont++;
194 194 }
... ...
ieducar/intranet/educar_turma_cad.php
... ... @@ -324,6 +324,8 @@ class indice extends clsCadastro
324 324  
325 325 $this->campoHora( 'hora_fim_intervalo', 'Hora Fim Intervalo', $this->hora_fim_intervalo, FALSE);
326 326  
  327 + $this->campoQuebra2();
  328 +
327 329 if ($this->ref_ref_cod_serie) {
328 330 require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
329 331 require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php';
... ... @@ -395,24 +397,40 @@ class indice extends clsCadastro
395 397 }
396 398 }
397 399  
398   - $this->campoQuebra2();
  400 + $componentes = $help = array();
  401 +
  402 + try {
  403 + $componentes = App_Model_IedFinder::getEscolaSerieDisciplina(
  404 + $this->ref_ref_cod_serie, $this->ref_cod_escola
  405 + );
  406 + }
  407 + catch (Exception $e) {
  408 + }
399 409  
400   - $help = array();
401   - $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($this->ref_ref_cod_serie, $this->ref_cod_escola);
402 410 foreach ($componentes as $componente) {
403 411 $help[] = sprintf('%s (%.0f h)', $componente->nome, $componente->cargaHoraria);
404 412 }
405   - $help = '<ul><li>' . implode('</li><li>', $help) . '</li></ul>';
  413 +
  414 + if (count($componentes)) {
  415 + $help = '<ul><li>' . implode('</li><li>', $help) . '</li></ul>';
  416 + }
  417 + else {
  418 + $help = '';
  419 + }
406 420  
407 421 $label = 'Componentes curriculares:<br />'
408 422 . '<strong>Observação:</strong> caso não defina os componentes<br />'
409 423 . 'curriculares para a turma, esta usará a definição<br />'
410   - . 'da série/ano escolar da escola'
411   - . $help;
  424 + . 'da série/ano escolar da escola:'
  425 + . '<span id="_escola_serie_componentes">%s</span>';
  426 +
  427 + $label = sprintf($label, $help);
412 428  
413 429 $this->campoRotulo('disciplinas_', $label,
414 430 "<div id='disciplinas'>$disciplinas</div>");
415 431  
  432 + $this->campoQuebra2();
  433 +
416 434 if ($_POST['turma_modulo']) {
417 435 $this->turma_modulo = unserialize(urldecode($_POST['turma_modulo']));
418 436 }
... ... @@ -518,10 +536,7 @@ class indice extends clsCadastro
518 536 "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>"
519 537 );
520 538  
521   - $this->campoQuebra();
522   -
523   - // Inclui dia da semana
524   - $this->campoQuebra();
  539 + $this->campoQuebra2();
525 540  
526 541 if ($_POST['turma_dia_semana']) {
527 542 $this->turma_dia_semana = unserialize(urldecode($_POST['turma_dia_semana']));
... ... @@ -611,8 +626,6 @@ class indice extends clsCadastro
611 626 "<a href='#' onclick=\"document.getElementById('incluir_dia_semana').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>"
612 627 );
613 628  
614   - $this->campoQuebra();
615   -
616 629 $this->campoOculto('padrao_ano_escolar', $this->padrao_ano_escolar);
617 630  
618 631 $this->acao_enviar = 'valida()';
... ... @@ -1101,14 +1114,13 @@ var evtOnLoad = function()
1101 1114 setVisibility(hr_tag[ct].parentNode.parentNode, false);
1102 1115 }
1103 1116  
  1117 + setVisibility('tr_hora_inicial', true);
  1118 + setVisibility('tr_hora_final', true);
  1119 + setVisibility('tr_hora_inicio_intervalo', true);
  1120 + setVisibility('tr_hora_fim_intervalo', true);
  1121 +
1104 1122 if (document.getElementById('ref_cod_curso').value) {
1105   - if (document.getElementById('padrao_ano_escolar').value == 1) {
1106   - setVisibility('tr_hora_inicial', true);
1107   - setVisibility('tr_hora_final', true);
1108   - setVisibility('tr_hora_inicio_intervalo', true);
1109   - setVisibility('tr_hora_fim_intervalo', true);
1110   - }
1111   - else if (document.getElementById('padrao_ano_escolar').value == 0) {
  1123 + if (document.getElementById('padrao_ano_escolar').value == 0) {
1112 1124 setVisibility('tr_ref_cod_modulo', true);
1113 1125 setVisibility('ref_cod_modulo', true);
1114 1126 setVisibility('tr_data_inicio', true);
... ... @@ -1255,8 +1267,11 @@ document.getElementById(&#39;multiseriada&#39;).onclick = function()
1255 1267 document.getElementById('ref_ref_cod_serie').onchange = function()
1256 1268 {
1257 1269 if (this.value) {
  1270 + codEscola = document.getElementById('ref_cod_escola').value;
  1271 +
1258 1272 getHoraEscolaSerie();
1259 1273 getComponentesCurriculares(this.value);
  1274 + getComponentesEscolaSerie(codEscola, this.value);
1260 1275 }
1261 1276  
1262 1277 if (document.getElementById('multiseriada').checked == true) {
... ... @@ -1272,6 +1287,12 @@ function getComponentesCurriculares(campoSerie)
1272 1287 xml_disciplina.envia("educar_disciplina_xml.php?ser=" + campoSerie);
1273 1288 }
1274 1289  
  1290 +function getComponentesEscolaSerie(codEscola, codSerie)
  1291 +{
  1292 + var xml_disciplina = new ajax(parseComponentesCurricularesEscolaSerie);
  1293 + xml_disciplina.envia("educar_disciplina_xml.php?esc=" + codEscola + "&ser=" + codSerie);
  1294 +}
  1295 +
1275 1296 function parseComponentesCurriculares(xml_disciplina)
1276 1297 {
1277 1298 var campoDisciplinas = document.getElementById('disciplinas');
... ... @@ -1309,6 +1330,29 @@ function parseComponentesCurriculares(xml_disciplina)
1309 1330 }
1310 1331 }
1311 1332  
  1333 +function parseComponentesCurricularesEscolaSerie(xml)
  1334 +{
  1335 + var helpSpan = document.getElementById('_escola_serie_componentes');
  1336 + var elements = xml.getElementsByTagName('disciplina');
  1337 +
  1338 + ret = '';
  1339 +
  1340 + if (elements.length) {
  1341 + ret = '<ul>';
  1342 +
  1343 + for (var i = 0; i < elements.length; i++) {
  1344 + carga = elements[i].getAttribute('carga_horaria');
  1345 + name = elements[i].firstChild.data;
  1346 +
  1347 + ret += '<li>' + name + ' (' + carga + ' h)</li>';
  1348 + }
  1349 +
  1350 + ret += '</ul>';
  1351 + }
  1352 +
  1353 + helpSpan.innerHTML = ret;
  1354 +}
  1355 +
1312 1356 function hideMultiSerie()
1313 1357 {
1314 1358 setVisibility('tr_multiseriada', document.getElementById('ref_ref_cod_serie').value != '' ? true : false);
... ... @@ -1382,24 +1426,18 @@ function PadraoAnoEscolar(xml)
1382 1426 setVisibility('tr_dia_semana_7', false);
1383 1427 }
1384 1428  
1385   - setVisibility('tr_hora_inicial',false);
1386   - setVisibility('tr_hora_final',false);
1387   - setVisibility('tr_hora_inicio_intervalo',false);
1388   - setVisibility('tr_hora_fim_intervalo',false);
  1429 + setVisibility('tr_hora_inicial', true);
  1430 + setVisibility('tr_hora_final', true);
  1431 + setVisibility('tr_hora_inicio_intervalo', true);
  1432 + setVisibility('tr_hora_fim_intervalo', true);
1389 1433  
1390   - if (campoCurso == ''){
  1434 + if (campoCurso == '') {
1391 1435 return;
1392 1436 }
1393 1437  
1394 1438 var campoCurso = document.getElementById('ref_cod_curso').value;
1395 1439  
1396   - if (document.getElementById('padrao_ano_escolar').value == 1) {
1397   - setVisibility('tr_hora_inicial', true);
1398   - setVisibility('tr_hora_final', true);
1399   - setVisibility('tr_hora_inicio_intervalo', true);
1400   - setVisibility('tr_hora_fim_intervalo', true);
1401   - }
1402   - else if (document.getElementById('padrao_ano_escolar').value == 0) {
  1440 + if (document.getElementById('padrao_ano_escolar').value == 0) {
1403 1441 setVisibility('tr_ref_cod_modulo', true);
1404 1442 setVisibility('ref_cod_modulo', true);
1405 1443 setVisibility('tr_data_inicio', true);
... ...
ieducar/intranet/educar_turma_det.php
... ... @@ -395,6 +395,7 @@ class indice extends clsDetalhe
395 395 <table>
396 396 <tr align="center">
397 397 <td bgcolor="#A1B3BD"><b>Nome</b></td>
  398 + <td bgcolor="#A1B3BD"><b>Carga horária</b></td>
398 399 </tr>';
399 400  
400 401 $cont = 0;
... ... @@ -403,9 +404,10 @@ class indice extends clsDetalhe
403 404  
404 405 $tabela3 .= sprintf('
405 406 <tr>
406   - <td %s align=left>%s</td>
  407 + <td %s align="left">%s</td>
  408 + <td %s align="center">%.0f h</td>
407 409 </tr>',
408   - $color, $componente
  410 + $color, $componente, $color, $componente->cargaHoraria
409 411 );
410 412 }
411 413  
... ...