Commit 16e95954308e276dfebbd17295102292e7cc379e
1 parent
6b88aed5
Exists in
master
Adicionado opção para desenturmar em enturmações em lote
portabilis/ieducar#433
Showing
4 changed files
with
72 additions
and
9 deletions
Show diff stats
ieducar/intranet/educar_matriculas_turma_cad.php
| @@ -86,6 +86,8 @@ class indice extends clsCadastro | @@ -86,6 +86,8 @@ class indice extends clsCadastro | ||
| 86 | var $incluir_matricula; | 86 | var $incluir_matricula; |
| 87 | var $data_enturmacao; | 87 | var $data_enturmacao; |
| 88 | 88 | ||
| 89 | + var $check_desenturma; | ||
| 90 | + | ||
| 89 | function Inicializar() | 91 | function Inicializar() |
| 90 | { | 92 | { |
| 91 | @session_start(); | 93 | @session_start(); |
| @@ -229,6 +231,7 @@ class indice extends clsCadastro | @@ -229,6 +231,7 @@ class indice extends clsCadastro | ||
| 229 | } | 231 | } |
| 230 | 232 | ||
| 231 | if ($this->matriculas_turma) { | 233 | if ($this->matriculas_turma) { |
| 234 | + $this->campoRotulo('titulo', 'Matrículas', "<b> Alunos matriculados Marque alunos para desenturmar</b><label style='display: block; width: 350px; margin-left: 196px;'><input type='checkbox' name='CheckTodos' onClick='marcarCheck(".'"check_desenturma[]"'.");'/>Marcar Todos</label>"); | ||
| 232 | foreach ($this->matriculas_turma as $matricula => $campo) { | 235 | foreach ($this->matriculas_turma as $matricula => $campo) { |
| 233 | $obj_matricula = new clsPmieducarMatricula($matricula); | 236 | $obj_matricula = new clsPmieducarMatricula($matricula); |
| 234 | $det_matricula = $obj_matricula->detalhe(); | 237 | $det_matricula = $obj_matricula->detalhe(); |
| @@ -239,7 +242,9 @@ class indice extends clsCadastro | @@ -239,7 +242,9 @@ class indice extends clsCadastro | ||
| 239 | $nm_aluno = $det_aluno['nome_aluno']; | 242 | $nm_aluno = $det_aluno['nome_aluno']; |
| 240 | 243 | ||
| 241 | $this->campoTextoInv('ref_cod_matricula_' . $matricula, '', $nm_aluno, | 244 | $this->campoTextoInv('ref_cod_matricula_' . $matricula, '', $nm_aluno, |
| 242 | - 30, 255, FALSE, FALSE, FALSE, '', '', '', '', 'ref_cod_matricula'); | 245 | + 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_matricula'); |
| 246 | + | ||
| 247 | + $this->campoCheck('check_desenturma['.$matricula.']','',$matricula); | ||
| 243 | } | 248 | } |
| 244 | } | 249 | } |
| 245 | 250 | ||
| @@ -292,6 +297,11 @@ class indice extends clsCadastro | @@ -292,6 +297,11 @@ class indice extends clsCadastro | ||
| 292 | $this->data_enturmacao = Portabilis_Date_Utils::brToPgSQL($this->data_enturmacao); | 297 | $this->data_enturmacao = Portabilis_Date_Utils::brToPgSQL($this->data_enturmacao); |
| 293 | @session_write_close(); | 298 | @session_write_close(); |
| 294 | 299 | ||
| 300 | + // realiza desenturmações | ||
| 301 | + foreach ($this->check_desenturma as $matricula) { | ||
| 302 | + $this->removerEnturmacao($matricula,$this->ref_cod_turma); | ||
| 303 | + } | ||
| 304 | + | ||
| 295 | if ($this->matriculas_turma) { | 305 | if ($this->matriculas_turma) { |
| 296 | foreach ($this->ref_cod_matricula as $matricula => $campo) { | 306 | foreach ($this->ref_cod_matricula as $matricula => $campo) { |
| 297 | $obj = new clsPmieducarMatriculaTurma($matricula, $this->ref_cod_turma, | 307 | $obj = new clsPmieducarMatriculaTurma($matricula, $this->ref_cod_turma, |
| @@ -322,6 +332,34 @@ class indice extends clsCadastro | @@ -322,6 +332,34 @@ class indice extends clsCadastro | ||
| 322 | function Excluir() | 332 | function Excluir() |
| 323 | { | 333 | { |
| 324 | } | 334 | } |
| 335 | + | ||
| 336 | + function removerEnturmacao($matriculaId, $turmaId) { | ||
| 337 | + $sequencialEnturmacao = $this->getSequencialEnturmacaoByTurmaId($matriculaId, $turmaId); | ||
| 338 | + $enturmacao = new clsPmieducarMatriculaTurma($matriculaId, | ||
| 339 | + $turmaId, | ||
| 340 | + $this->pessoa_logada, | ||
| 341 | + NULL, | ||
| 342 | + NULL, | ||
| 343 | + NULL, | ||
| 344 | + 0, | ||
| 345 | + NULL, | ||
| 346 | + $sequencialEnturmacao); | ||
| 347 | + | ||
| 348 | + return $enturmacao->edita(); | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + | ||
| 352 | + function getSequencialEnturmacaoByTurmaId($matriculaId, $turmaId) { | ||
| 353 | + $db = new clsBanco(); | ||
| 354 | + $sql = 'select coalesce(max(sequencial), 1) from pmieducar.matricula_turma where ativo = 1 and ref_cod_matricula = $1 and ref_cod_turma = $2'; | ||
| 355 | + | ||
| 356 | + if ($db->execPreparedQuery($sql, array($matriculaId, $turmaId)) != false) { | ||
| 357 | + $db->ProximoRegistro(); | ||
| 358 | + $sequencial = $db->Tupla(); | ||
| 359 | + return $sequencial[0]; | ||
| 360 | + } | ||
| 361 | + return 1; | ||
| 362 | + } | ||
| 325 | } | 363 | } |
| 326 | 364 | ||
| 327 | // Instancia objeto de página | 365 | // Instancia objeto de página |
| @@ -334,4 +372,31 @@ $miolo = new indice(); | @@ -334,4 +372,31 @@ $miolo = new indice(); | ||
| 334 | $pagina->addForm($miolo); | 372 | $pagina->addForm($miolo); |
| 335 | 373 | ||
| 336 | // Gera o código HTML | 374 | // Gera o código HTML |
| 337 | -$pagina->MakeAll(); | ||
| 338 | \ No newline at end of file | 375 | \ No newline at end of file |
| 376 | +$pagina->MakeAll(); | ||
| 377 | + | ||
| 378 | +?> | ||
| 379 | + | ||
| 380 | +<script type="text/javascript"> | ||
| 381 | + | ||
| 382 | + function fixUpCheckBoxes(){ | ||
| 383 | + $j('input[name^=check_desenturma]').each(function(index, element){ | ||
| 384 | + element.id = 'check_desenturma[]'; | ||
| 385 | + element.checked = false; | ||
| 386 | + }); | ||
| 387 | + } | ||
| 388 | + | ||
| 389 | + fixUpCheckBoxes(); | ||
| 390 | + | ||
| 391 | + function marcarCheck(idValue) { | ||
| 392 | + // testar com formcadastro | ||
| 393 | + var contaForm = document.formcadastro.elements.length; | ||
| 394 | + var campo = document.formcadastro; | ||
| 395 | + var i; | ||
| 396 | + for (i=0; i<contaForm; i++) { | ||
| 397 | + if (campo.elements[i].id == idValue) { | ||
| 398 | + | ||
| 399 | + campo.elements[i].checked = campo.CheckTodos.checked; | ||
| 400 | + } | ||
| 401 | + } | ||
| 402 | + } | ||
| 403 | +</script> |
ieducar/intranet/educar_matriculas_turma_lst.php
| @@ -89,6 +89,7 @@ class indice extends clsListagem | @@ -89,6 +89,7 @@ class indice extends clsListagem | ||
| 89 | $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | 89 | $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); |
| 90 | 90 | ||
| 91 | $lista_busca = array( | 91 | $lista_busca = array( |
| 92 | + "Ano", | ||
| 92 | "Turma", | 93 | "Turma", |
| 93 | "Série", | 94 | "Série", |
| 94 | "Curso" | 95 | "Curso" |
| @@ -221,6 +222,7 @@ class indice extends clsListagem | @@ -221,6 +222,7 @@ class indice extends clsListagem | ||
| 221 | } | 222 | } |
| 222 | 223 | ||
| 223 | $lista_busca = array( | 224 | $lista_busca = array( |
| 225 | + "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["ano"]}</a>", | ||
| 224 | "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_turma"]}</a>" | 226 | "<a href=\"educar_matriculas_turma_cad.php?ref_cod_turma={$registro["cod_turma"]}\">{$registro["nm_turma"]}</a>" |
| 225 | ); | 227 | ); |
| 226 | 228 |
ieducar/intranet/educar_turma_xml.php
| @@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
| 39 | { | 39 | { |
| 40 | $db = new clsBanco(); | 40 | $db = new clsBanco(); |
| 41 | // $db->Consulta( "SELECT cod_turma, nm_turma FROM pmieducar.turma WHERE ref_ref_cod_escola = {$_GET["esc"]} AND ref_ref_cod_serie = {$_GET["ser"]} AND ativo = 1 ORDER BY nm_turma ASC" ); | 41 | // $db->Consulta( "SELECT cod_turma, nm_turma FROM pmieducar.turma WHERE ref_ref_cod_escola = {$_GET["esc"]} AND ref_ref_cod_serie = {$_GET["ser"]} AND ativo = 1 ORDER BY nm_turma ASC" ); |
| 42 | - $db->Consulta( "SELECT cod_turma, nm_turma FROM pmieducar.turma WHERE ref_ref_cod_escola = {$_GET["esc"]} AND (ref_ref_cod_serie = {$_GET["ser"]} OR ref_ref_cod_serie_mult = {$_GET["ser"]}) AND ativo = 1 ORDER BY nm_turma ASC" ); | 42 | + $db->Consulta( "SELECT cod_turma, nm_turma FROM pmieducar.turma WHERE ref_ref_cod_escola = {$_GET["esc"]} AND (ref_ref_cod_serie = {$_GET["ser"]} OR ref_ref_cod_serie_mult = {$_GET["ser"]}) AND ativo = 1 AND turma.ano = ( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = turma.ref_ref_cod_escola AND andamento = 1) ORDER BY nm_turma ASC" ); |
| 43 | while ( $db->ProximoRegistro() ) | 43 | while ( $db->ProximoRegistro() ) |
| 44 | { | 44 | { |
| 45 | list( $cod, $nome ) = $db->Tupla(); | 45 | list( $cod, $nome ) = $db->Tupla(); |
ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php
| @@ -1919,12 +1919,8 @@ and e.cod_escola = t.ref_ref_cod_escola | @@ -1919,12 +1919,8 @@ and e.cod_escola = t.ref_ref_cod_escola | ||
| 1919 | $whereAnd = " AND "; | 1919 | $whereAnd = " AND "; |
| 1920 | } | 1920 | } |
| 1921 | 1921 | ||
| 1922 | - $filtros .= "{$whereAnd} (ano = (SELECT max(ano) | ||
| 1923 | - FROM pmieducar.escola_ano_letivo mat | ||
| 1924 | - WHERE ativo = 1 and mat.andamento = 1) or ((t.ano is null) AND (select 1 from pmieducar.matricula_turma | ||
| 1925 | - where ativo = 1 and date_part('year',data_cadastro) = (SELECT max(ano) | ||
| 1926 | - FROM pmieducar.escola_ano_letivo | ||
| 1927 | - WHERE ativo = 1 and andamento = 1) and t.cod_turma = ref_cod_turma limit 1) is not null))"; | 1922 | + // Retirar OR quando todas turmas tiverem a coluna ANO definido. |
| 1923 | + $filtros .= "{$whereAnd} t.ano = ( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = t.ref_ref_cod_escola AND andamento = 1)"; | ||
| 1928 | 1924 | ||
| 1929 | $db = new clsBanco(); | 1925 | $db = new clsBanco(); |
| 1930 | $countCampos = count( explode( ",", $this->_campos_lista ) ); | 1926 | $countCampos = count( explode( ",", $this->_campos_lista ) ); |