Commit 7729594b2c65532a005fcc2d132a24cb06113739

Authored by Lucas Schmoeller da Silva
1 parent 6bf556d6
Exists in master

Adicionando checkbox 'Marcar Todos' na tela cadastro Escola, ref Issue #21

Showing 1 changed file with 37 additions and 2 deletions   Show diff stats
ieducar/intranet/educar_escola_serie_cad.php
... ... @@ -254,6 +254,11 @@ class indice extends clsCadastro
254 254 $conteudo .= ' <span style="display: block; float: left">Usar padrão do componente?</span>';
255 255 $conteudo .= '</div>';
256 256 $conteudo .= '<br style="clear: left" />';
  257 + $conteudo .= '<div style="margin-bottom: 10px; float: left">';
  258 + $conteudo .= " <label style='display: block; float: left; width: 350px;'><input type='checkbox' name='CheckTodos' onClick='marcarCheck(".'"disciplinas[]"'.");'/>Marcar Todos</label>";
  259 + $conteudo .= " <label style='display: block; float: left; width: 100px;'><input type='checkbox' name='CheckTodos2' onClick='marcarCheck(".'"usar_componente[]"'.");';/>Marcar Todos</label>";
  260 + $conteudo .= '</div>';
  261 + $conteudo .= '<br style="clear: left" />';
257 262  
258 263 foreach ($lista as $registro) {
259 264 $checked = '';
... ... @@ -276,7 +281,8 @@ class indice extends clsCadastro
276 281 $conteudo .= '<div style="margin-bottom: 10px; float: left">';
277 282 $conteudo .= " <label style='display: block; float: left; width: 250px'><input type=\"checkbox\" $checked name=\"disciplinas[$registro->id]\" id=\"disciplinas[]\" value=\"{$registro->id}\">{$registro}</label>";
278 283 $conteudo .= " <label style='display: block; float: left; width: 100px;'><input type='text' name='carga_horaria[$registro->id]' value='{$cargaHoraria}' size='5' maxlength='7'></label>";
279   - $conteudo .= " <label style='display: block; float: left'><input type='checkbox' name='usar_componente[$registro->id]' value='1' ". ($usarComponente == TRUE ? $checked : '') .">($cargaComponente h)</label>";
  284 + $conteudo .= " <label style='display: block; float: left'><input type='checkbox' id='usar_componente[]' name='usar_componente[$registro->id]' value='1' ". ($usarComponente == TRUE ? $checked : '') .">($cargaComponente h)</label>";
  285 +
280 286 $conteudo .= '</div>';
281 287 $conteudo .= '<br style="clear: left" />';
282 288  
... ... @@ -534,6 +540,11 @@ function getDisciplina(xml_disciplina)
534 540 conteudo += ' <label span="display: block; float: left">Usar padrão do componente?</span>';
535 541 conteudo += '</div>';
536 542 conteudo += '<br style="clear: left" />';
  543 + conteudo += '<div style="margin-bottom: 10px; float: left">';
  544 + conteudo += " <label style='display: block; float: left; width: 350px;'><input type='checkbox' name='CheckTodos' onClick='marcarCheck("+'"disciplinas[]"'+");'/>Marcar Todos</label>";
  545 + conteudo += " <label style='display: block; float: left; width: 100px;'><input type='checkbox' name='CheckTodos2' onClick='marcarCheck("+'"usar_componente[]"'+");';/>Marcar Todos</label>";
  546 + conteudo += '</div>';
  547 + conteudo += '<br style="clear: left" />';
537 548  
538 549 for (var i = 0; i < DOM_array.length; i++) {
539 550 id = DOM_array[i].getAttribute("cod_disciplina");
... ... @@ -541,7 +552,7 @@ function getDisciplina(xml_disciplina)
541 552 conteudo += '<div style="margin-bottom: 10px; float: left">';
542 553 conteudo += ' <label style="display: block; float: left; width: 250px;"><input type="checkbox" name="disciplinas['+ id +']" id="disciplinas[]" value="'+ id +'">'+ DOM_array[i].firstChild.data +'</label>';
543 554 conteudo += ' <label style="display: block; float: left; width: 100px;"><input type="text" name="carga_horaria['+ id +']" value="" size="5" maxlength="7"></label>';
544   - conteudo += ' <label style="display: block; float: left"><input type="checkbox" name="usar_componente['+ id +']" value="1">('+ DOM_array[i].getAttribute("carga_horaria") +' h)</label>';
  555 + conteudo += ' <label style="display: block; float: left"><input type="checkbox" id="usar_componente[]" name="usar_componente['+ id +']" value="1">('+ DOM_array[i].getAttribute("carga_horaria") +' h)</label>';
545 556 conteudo += '</div>';
546 557 conteudo += '<br style="clear: left" />';
547 558 }
... ... @@ -624,4 +635,28 @@ function atualizaLstSerie(xml)
624 635 campoSerie.disabled = true;
625 636 }
626 637 }
  638 +
  639 +function marcarCheck(idValue) {
  640 + // testar com formcadastro
  641 + var contaForm = document.formcadastro.elements.length;
  642 + var campo = document.formcadastro;
  643 + var i;
  644 + if (idValue == 'disciplinas[]'){
  645 + for (i=0; i<contaForm; i++) {
  646 + if (campo.elements[i].id == idValue) {
  647 +
  648 + campo.elements[i].checked = campo.CheckTodos.checked;
  649 + }
  650 + }
  651 + }else {
  652 + for (i=0; i<contaForm; i++) {
  653 + if (campo.elements[i].id == idValue) {
  654 +
  655 + campo.elements[i].checked = campo.CheckTodos2.checked;
  656 + }
  657 + }
  658 +
  659 + }
  660 +
  661 +}
627 662 </script>
... ...