Commit 6555e8f72ecb4c33b0e405b95a2ccadc57f9d817
1 parent
787d0d45
Exists in
master
Adicionado configuração ao cadastro de escolas para bloquear ou não o lançamento…
… de notas, para anos letivos encerrados
Showing
3 changed files
with
83 additions
and
25 deletions
Show diff stats
ieducar/intranet/educar_escola_cad.php
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 2 | 6 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 3 | 7 | * * |
| 4 | 8 | * @author Prefeitura Municipal de Itajaí * |
| ... | ... | @@ -28,6 +32,7 @@ require_once ("include/clsBase.inc.php"); |
| 28 | 32 | require_once ("include/clsCadastro.inc.php"); |
| 29 | 33 | require_once ("include/clsBanco.inc.php"); |
| 30 | 34 | require_once( "include/pmieducar/geral.inc.php" ); |
| 35 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 31 | 36 | |
| 32 | 37 | class clsIndexBase extends clsBase |
| 33 | 38 | { |
| ... | ... | @@ -353,14 +358,25 @@ class indice extends clsCadastro |
| 353 | 358 | $this->url_cancelar = ($retorno == "Editar") ? "educar_escola_det.php?cod_escola={$registro["cod_escola"]}" : "educar_escola_lst.php"; |
| 354 | 359 | $this->nome_url_cancelar = "Cancelar"; |
| 355 | 360 | |
| 356 | - return $retorno; | |
| 361 | + return $retorno; | |
| 357 | 362 | } |
| 358 | 363 | |
| 359 | 364 | function Gerar() |
| 360 | 365 | { |
| 361 | 366 | |
| 362 | - $obj_permissoes = new clsPermissoes(); | |
| 367 | + // js | |
| 368 | + Portabilis_View_Helper_Application::loadJQueryLib($this); | |
| 369 | + | |
| 370 | + $scripts = array( | |
| 371 | + '/modules/Portabilis/Assets/Javascripts/Utils.js', | |
| 372 | + '/modules/Portabilis/Assets/Javascripts/ClientApi.js', | |
| 373 | + '/modules/Cadastro/Assets/Javascripts/Escola.js' | |
| 374 | + ); | |
| 375 | + | |
| 376 | + Portabilis_View_Helper_Application::loadJavascript($this, $scripts); | |
| 377 | + | |
| 363 | 378 | |
| 379 | + $obj_permissoes = new clsPermissoes(); | |
| 364 | 380 | // echo "<pre>";print_r($_POST);die; |
| 365 | 381 | |
| 366 | 382 | if( !$this->sem_cnpj && !$this->com_cnpj) |
| ... | ... | @@ -386,6 +402,7 @@ class indice extends clsCadastro |
| 386 | 402 | } |
| 387 | 403 | else |
| 388 | 404 | { |
| 405 | + $this->inputsHelper()->numeric('escola_inep_id', array('label' => 'Código inep', 'required' => false)); | |
| 389 | 406 | |
| 390 | 407 | if( $_POST ) |
| 391 | 408 | foreach( $_POST AS $campo => $val ) |
| ... | ... | @@ -477,7 +494,7 @@ class indice extends clsCadastro |
| 477 | 494 | } |
| 478 | 495 | $script = "<img id='img_rede_ensino' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 479 | 496 | } |
| 480 | - else | |
| 497 | + else | |
| 481 | 498 | { |
| 482 | 499 | $script = "<img id='img_rede_ensino' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 483 | 500 | } |
| ... | ... | @@ -518,7 +535,7 @@ class indice extends clsCadastro |
| 518 | 535 | } |
| 519 | 536 | $script = "<img id='img_localizacao' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 520 | 537 | } |
| 521 | - else | |
| 538 | + else | |
| 522 | 539 | { |
| 523 | 540 | $script = "<img id='img_localizacao' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 524 | 541 | } |
| ... | ... | @@ -550,6 +567,7 @@ class indice extends clsCadastro |
| 550 | 567 | |
| 551 | 568 | $this->campoTexto( "p_email", "E-mail", $this->p_email, "50", "255", false ); |
| 552 | 569 | } |
| 570 | + | |
| 553 | 571 | if ($this->com_cnpj) |
| 554 | 572 | { |
| 555 | 573 | $this->campoOculto( "com_cnpj", $this->com_cnpj ); |
| ... | ... | @@ -662,7 +680,7 @@ class indice extends clsCadastro |
| 662 | 680 | } |
| 663 | 681 | $script = "<img id='img_rede_ensino' style='display:\'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 664 | 682 | } |
| 665 | - else | |
| 683 | + else | |
| 666 | 684 | { |
| 667 | 685 | $script = "<img id='img_rede_ensino' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 668 | 686 | } |
| ... | ... | @@ -704,7 +722,7 @@ class indice extends clsCadastro |
| 704 | 722 | } |
| 705 | 723 | $script = "<img id='img_localizacao' style='display:\'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 706 | 724 | } |
| 707 | - else | |
| 725 | + else | |
| 708 | 726 | { |
| 709 | 727 | $script = "<img id='img_localizacao' style='display: none;' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">"; |
| 710 | 728 | } |
| ... | ... | @@ -867,6 +885,8 @@ if(!$this->isEnderecoExterno){ |
| 867 | 885 | // |
| 868 | 886 | // } |
| 869 | 887 | |
| 888 | + $this->campoCheck("bloquear_lancamento_diario_anos_letivos_encerrados", "Bloquear lançamento no diário para anos letivos encerrados", $this->bloquear_lancamento_diario_anos_letivos_encerrados); | |
| 889 | + | |
| 870 | 890 | if ( $_POST["escola_curso"] ) |
| 871 | 891 | $this->escola_curso = unserialize( urldecode( $_POST["escola_curso"] ) ); |
| 872 | 892 | if( is_numeric( $this->cod_escola ) && !$_POST ) |
| ... | ... | @@ -974,6 +994,8 @@ if(!$this->isEnderecoExterno){ |
| 974 | 994 | $obj_permissoes = new clsPermissoes(); |
| 975 | 995 | $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 3, "educar_escola_lst.php" ); |
| 976 | 996 | |
| 997 | + $this->bloquear_lancamento_diario_anos_letivos_encerrados = is_null($this->bloquear_lancamento_diario_anos_letivos_encerrados) ? 0 : 1; | |
| 998 | + | |
| 977 | 999 | if ($this->com_cnpj) |
| 978 | 1000 | { |
| 979 | 1001 | // echo "clsPessoa_( false, $this->fantasia, $this->pessoa_logada, $this->p_http, "J", false, false, $this->p_email )"; |
| ... | ... | @@ -987,8 +1009,9 @@ if(!$this->isEnderecoExterno){ |
| 987 | 1009 | |
| 988 | 1010 | if ($cadastrou) |
| 989 | 1011 | { |
| 990 | - $obj = new clsPmieducarEscola( null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1 ); | |
| 1012 | + $obj = new clsPmieducarEscola( null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1, NULL, $this->bloquear_lancamento_diario_anos_letivos_encerrados); | |
| 991 | 1013 | $cadastrou1 = $obj->cadastra(); |
| 1014 | + | |
| 992 | 1015 | if( $cadastrou1 ) |
| 993 | 1016 | { |
| 994 | 1017 | $objTelefone = new clsPessoaTelefone( $this->ref_idpes); |
| ... | ... | @@ -1081,8 +1104,11 @@ if(!$this->isEnderecoExterno){ |
| 1081 | 1104 | } |
| 1082 | 1105 | else if( $this->sem_cnpj ) |
| 1083 | 1106 | { |
| 1084 | - $obj = new clsPmieducarEscola( null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, null, $this->sigla, null, null, 1 ); | |
| 1107 | + $obj = new clsPmieducarEscola( null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, null, $this->sigla, null, null, 1, null, $this->bloquear_lancamento_diario_anos_letivos_encerrados ); | |
| 1085 | 1108 | $cadastrou = $obj->cadastra(); |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1086 | 1112 | if ($cadastrou) |
| 1087 | 1113 | { |
| 1088 | 1114 | $obj2 = new clsPmieducarEscolaComplemento( $cadastrou, null, $this->pessoa_logada, idFederal2int( $this->cep ),$this->numero,$this->complemento,$this->p_email,$this->fantasia,$this->cidade,$this->bairro,$this->logradouro,$this->p_ddd_telefone_1, $this->p_telefone_1,$this->p_ddd_telefone_fax, $this->p_telefone_fax,null,null,1); |
| ... | ... | @@ -1136,19 +1162,24 @@ if(!$this->isEnderecoExterno){ |
| 1136 | 1162 | |
| 1137 | 1163 | $obj_permissoes = new clsPermissoes(); |
| 1138 | 1164 | $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 3, "educar_escola_lst.php" ); |
| 1165 | + | |
| 1166 | + $this->bloquear_lancamento_diario_anos_letivos_encerrados = is_null($this->bloquear_lancamento_diario_anos_letivos_encerrados) ? 0 : 1; | |
| 1167 | + | |
| 1139 | 1168 | // |
| 1140 | 1169 | // echo "<br>cep: ".$this->cep; |
| 1141 | 1170 | // echo "<br>cep_: ".$this->cep_;die; |
| 1142 | 1171 | if ($this->cod_escola) |
| 1143 | 1172 | { |
| 1144 | - $obj = new clsPmieducarEscola($this->cod_escola, null, $this->pessoa_logada, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1); | |
| 1173 | + $obj = new clsPmieducarEscola($this->cod_escola, null, $this->pessoa_logada, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1, $this->bloquear_lancamento_diario_anos_letivos_encerrados); | |
| 1145 | 1174 | $editou = $obj->edita(); |
| 1175 | + | |
| 1146 | 1176 | } |
| 1147 | 1177 | else |
| 1148 | 1178 | { |
| 1149 | - $obj = new clsPmieducarEscola(null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1); | |
| 1179 | + $obj = new clsPmieducarEscola(null, $this->pessoa_logada, null, $this->ref_cod_instituicao, $this->ref_cod_escola_localizacao, $this->ref_cod_escola_rede_ensino, $this->ref_idpes, $this->sigla, null, null, 1, $this->bloquear_lancamento_diario_anos_letivos_encerrados); | |
| 1150 | 1180 | $editou = $obj->cadastra(); |
| 1151 | 1181 | $this->cod_escola = $editou; |
| 1182 | + | |
| 1152 | 1183 | } |
| 1153 | 1184 | if( $editou ) |
| 1154 | 1185 | { |
| ... | ... | @@ -1536,7 +1567,7 @@ if ( document.getElementById('ref_cod_instituicao') ) |
| 1536 | 1567 | |
| 1537 | 1568 | var xml_curso = new ajax( getCurso ); |
| 1538 | 1569 | xml_curso.envia( "educar_curso_xml2.php?ins="+campoInstituicao ); |
| 1539 | - | |
| 1570 | + | |
| 1540 | 1571 | if (this.value == '') |
| 1541 | 1572 | { |
| 1542 | 1573 | $('img_rede_ensino').style.display = 'none;'; |
| ... | ... | @@ -1547,7 +1578,7 @@ if ( document.getElementById('ref_cod_instituicao') ) |
| 1547 | 1578 | $('img_rede_ensino').style.display = ''; |
| 1548 | 1579 | $('img_localizacao').style.display = ''; |
| 1549 | 1580 | } |
| 1550 | - | |
| 1581 | + | |
| 1551 | 1582 | } |
| 1552 | 1583 | } |
| 1553 | 1584 | ... | ... |
ieducar/intranet/educar_escola_lst.php
| ... | ... | @@ -97,7 +97,7 @@ class indice extends clsListagem |
| 97 | 97 | |
| 98 | 98 | $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); |
| 99 | 99 | |
| 100 | - $cabecalhos = array( "Escola" ); | |
| 100 | + $cabecalhos = array("Escola"); | |
| 101 | 101 | $nivel = $obj_permissoes->nivel_acesso($this->pessoa_logada); |
| 102 | 102 | if( $nivel == 1 ) |
| 103 | 103 | { |
| ... | ... | @@ -138,7 +138,7 @@ class indice extends clsListagem |
| 138 | 138 | $obj_escola->setLimite( $this->limite, ( $this->pagina_formulario - 1 ) * $this->limite ); |
| 139 | 139 | |
| 140 | 140 | $cod_escola = $obj_permissoes->getEscola($this->pessoa_logada); |
| 141 | - | |
| 141 | + | |
| 142 | 142 | $lista = $obj_escola->lista( |
| 143 | 143 | $cod_escola, |
| 144 | 144 | null, |
| ... | ... | @@ -160,7 +160,10 @@ class indice extends clsListagem |
| 160 | 160 | { |
| 161 | 161 | foreach ( $lista AS $registro ) |
| 162 | 162 | { |
| 163 | - $linha = array( "<a href=\"educar_escola_det.php?cod_escola={$registro["cod_escola"]}\">{$registro["nome"]}</a>" ); | |
| 163 | + | |
| 164 | + $linha = array(); | |
| 165 | + | |
| 166 | + $linha[] = "<a href=\"educar_escola_det.php?cod_escola={$registro["cod_escola"]}\">{$registro["nome"]}</a>"; | |
| 164 | 167 | if( $nivel == 1 ) |
| 165 | 168 | { |
| 166 | 169 | $objInstituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] ); |
| ... | ... | @@ -188,4 +191,4 @@ $miolo = new indice(); |
| 188 | 191 | $pagina->addForm( $miolo ); |
| 189 | 192 | // gera o html |
| 190 | 193 | $pagina->MakeAll(); |
| 191 | -?> | |
| 192 | 194 | \ No newline at end of file |
| 195 | +?> | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarEscola.inc.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 3 | 6 | /** |
| 4 | 7 | * i-Educar - Sistema de gestão escolar |
| 5 | 8 | * |
| ... | ... | @@ -107,17 +110,23 @@ class clsPmieducarEscola |
| 107 | 110 | /** |
| 108 | 111 | * Construtor. |
| 109 | 112 | */ |
| 110 | - function clsPmieducarEscola($cod_escola = NULL, $ref_usuario_cad = NULL, | |
| 111 | - $ref_usuario_exc = NULL, $ref_cod_instituicao = NULL, | |
| 112 | - $ref_cod_escola_localizacao = NULL, $ref_cod_escola_rede_ensino = NULL, | |
| 113 | - $ref_idpes = NULL, $sigla = NULL, $data_cadastro = NULL, $data_exclusao = NULL, | |
| 114 | - $ativo = NULL | |
| 115 | - ) { | |
| 113 | + function clsPmieducarEscola($cod_escola = NULL, | |
| 114 | + $ref_usuario_cad = NULL, | |
| 115 | + $ref_usuario_exc = NULL, | |
| 116 | + $ref_cod_instituicao = NULL, | |
| 117 | + $ref_cod_escola_localizacao = NULL, | |
| 118 | + $ref_cod_escola_rede_ensino = NULL, | |
| 119 | + $ref_idpes = NULL, | |
| 120 | + $sigla = NULL, | |
| 121 | + $data_cadastro = NULL, | |
| 122 | + $data_exclusao = NULL, | |
| 123 | + $ativo = NULL, | |
| 124 | + $bloquear_lancamento_diario_anos_letivos_encerrados = NULL) { | |
| 116 | 125 | $db = new clsBanco(); |
| 117 | 126 | $this->_schema = 'pmieducar.'; |
| 118 | 127 | $this->_tabela = $this->_schema . 'escola'; |
| 119 | 128 | |
| 120 | - $this->_campos_lista = $this->_todos_campos = 'e.cod_escola, e.ref_usuario_cad, e.ref_usuario_exc, e.ref_cod_instituicao, e.ref_cod_escola_localizacao, e.ref_cod_escola_rede_ensino, e.ref_idpes, e.sigla, e.data_cadastro, e.data_exclusao, e.ativo'; | |
| 129 | + $this->_campos_lista = $this->_todos_campos = 'e.cod_escola, e.ref_usuario_cad, e.ref_usuario_exc, e.ref_cod_instituicao, e.ref_cod_escola_localizacao, e.ref_cod_escola_rede_ensino, e.ref_idpes, e.sigla, e.data_cadastro, e.data_exclusao, e.ativo, e.bloquear_lancamento_diario_anos_letivos_encerrados'; | |
| 121 | 130 | |
| 122 | 131 | if (is_numeric($ref_usuario_cad)) { |
| 123 | 132 | if (class_exists("clsPmieducarUsuario")) { |
| ... | ... | @@ -265,6 +274,8 @@ class clsPmieducarEscola |
| 265 | 274 | if (is_numeric($ativo)) { |
| 266 | 275 | $this->ativo = $ativo; |
| 267 | 276 | } |
| 277 | + | |
| 278 | + $this->bloquear_lancamento_diario_anos_letivos_encerrados = $bloquear_lancamento_diario_anos_letivos_encerrados; | |
| 268 | 279 | } |
| 269 | 280 | |
| 270 | 281 | /** |
| ... | ... | @@ -325,6 +336,12 @@ class clsPmieducarEscola |
| 325 | 336 | $gruda = ", "; |
| 326 | 337 | } |
| 327 | 338 | |
| 339 | + if (is_numeric($this->bloquear_lancamento_diario_anos_letivos_encerrados)) { | |
| 340 | + $campos .= "{$gruda}bloquear_lancamento_diario_anos_letivos_encerrados"; | |
| 341 | + $valores .= "{$gruda}'{$this->bloquear_lancamento_diario_anos_letivos_encerrados}'"; | |
| 342 | + $gruda = ", "; | |
| 343 | + } | |
| 344 | + | |
| 328 | 345 | $campos .= "{$gruda}data_cadastro"; |
| 329 | 346 | $valores .= "{$gruda}NOW()"; |
| 330 | 347 | $gruda = ", "; |
| ... | ... | @@ -333,7 +350,9 @@ class clsPmieducarEscola |
| 333 | 350 | $valores .= "{$gruda}'1'"; |
| 334 | 351 | |
| 335 | 352 | $db->Consulta("INSERT INTO {$this->_tabela} ($campos) VALUES ($valores)"); |
| 336 | - return $db->InsertId("{$this->_tabela}_cod_escola_seq"); | |
| 353 | + $recordId = $db->InsertId("{$this->_tabela}_cod_escola_seq"); | |
| 354 | + | |
| 355 | + return $recordId; | |
| 337 | 356 | } |
| 338 | 357 | else { |
| 339 | 358 | echo "<br><br>is_numeric($this->ref_usuario_cad) && is_numeric($this->ref_cod_instituicao) && is_numeric($this->ref_cod_escola_localizacao) && is_numeric($this->ref_cod_escola_rede_ensino) && is_string($this->sigla )"; |
| ... | ... | @@ -400,6 +419,11 @@ class clsPmieducarEscola |
| 400 | 419 | $gruda = ", "; |
| 401 | 420 | } |
| 402 | 421 | |
| 422 | + if (is_numeric($this->bloquear_lancamento_diario_anos_letivos_encerrados)) { | |
| 423 | + $set .= "{$gruda}bloquear_lancamento_diario_anos_letivos_encerrados = '{$this->bloquear_lancamento_diario_anos_letivos_encerrados}'"; | |
| 424 | + $gruda = ", "; | |
| 425 | + } | |
| 426 | + | |
| 403 | 427 | if ($set) { |
| 404 | 428 | $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_escola = '{$this->cod_escola}'"); |
| 405 | 429 | return TRUE; |
| ... | ... | @@ -692,4 +716,4 @@ class clsPmieducarEscola |
| 692 | 716 | } |
| 693 | 717 | return ''; |
| 694 | 718 | } |
| 695 | -} | |
| 696 | 719 | \ No newline at end of file |
| 720 | +} | ... | ... |