Commit 38191908cd5f9c568554a568e620e41aed0832c9
1 parent
b528f7bc
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
146 additions
and
141 deletions
Show diff stats
ieducar/intranet/educar_avancar_mod_cad.php
| 1 | 1 | <?php |
| 2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 3 | - * * | |
| 4 | - * @author Prefeitura Municipal de Itajaí * | |
| 5 | - * @updated 29/03/2007 * | |
| 6 | - * Pacote: i-PLB Software Público Livre e Brasileiro * | |
| 7 | - * * | |
| 8 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
| 9 | - * ctima@itajai.sc.gov.br * | |
| 10 | - * * | |
| 11 | - * Este programa é software livre, você pode redistribuí-lo e/ou * | |
| 12 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
| 13 | - * publicada pela Free Software Foundation, tanto a versão 2 da * | |
| 14 | - * Licença como (a seu critério) qualquer versão mais nova. * | |
| 15 | - * * | |
| 16 | - * Este programa é distribuído na expectativa de ser útil, mas SEM * | |
| 17 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
| 18 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
| 19 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
| 20 | - * * | |
| 21 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
| 22 | - * junto com este programa. Se não, escreva para a Free Software * | |
| 23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
| 24 | - * 02111-1307, USA. * | |
| 25 | - * * | |
| 26 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 27 | -require_once ("include/clsBase.inc.php"); | |
| 28 | -require_once ("include/clsCadastro.inc.php"); | |
| 29 | -require_once ("include/clsBanco.inc.php"); | |
| 30 | -require_once( "include/pmieducar/geral.inc.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 Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 24 | + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL | |
| 25 | + * @package Core | |
| 26 | + * @subpackage pmieducar | |
| 27 | + * @subpackage Matricula | |
| 28 | + * @subpackage Rematricula | |
| 29 | + * @since Arquivo disponível desde a versão 1.0.0 | |
| 30 | + * @version $Id$ | |
| 31 | + */ | |
| 32 | + | |
| 33 | +require_once 'include/clsBase.inc.php'; | |
| 34 | +require_once 'include/clsCadastro.inc.php'; | |
| 35 | +require_once 'include/clsBanco.inc.php'; | |
| 36 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 31 | 37 | |
| 32 | 38 | class clsIndexBase extends clsBase |
| 33 | 39 | { |
| 34 | - function Formular() | |
| 35 | - { | |
| 36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar" ); | |
| 37 | - $this->processoAp = "561"; | |
| 38 | - } | |
| 40 | + function Formular() | |
| 41 | + { | |
| 42 | + $this->SetTitulo($this->_instituicao . ' i-Educar'); | |
| 43 | + $this->processoAp = '561'; | |
| 44 | + } | |
| 39 | 45 | } |
| 40 | 46 | |
| 41 | 47 | class indice extends clsCadastro |
| 42 | 48 | { |
| 49 | + var $pessoa_logada; | |
| 50 | + | |
| 51 | + function Inicializar() | |
| 52 | + { | |
| 53 | + $retorno = 'Novo'; | |
| 54 | + session_start(); | |
| 55 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 56 | + session_write_close(); | |
| 57 | + | |
| 58 | + return $retorno; | |
| 59 | + } | |
| 60 | + | |
| 61 | + function Gerar() | |
| 62 | + { | |
| 63 | + $instituicao_obrigatorio = true; | |
| 64 | + $escola_obrigatorio = true; | |
| 65 | + $curso_obrigatorio = true; | |
| 66 | + $escola_curso_serie_obrigatorio = true; | |
| 67 | + $turma_obrigatorio = true; | |
| 68 | + $get_escola = true; | |
| 69 | + $get_curso = true; | |
| 70 | + $get_escola_curso_serie = true; | |
| 71 | + $get_turma = true; | |
| 72 | + $get_cursos_nao_padrao = true; | |
| 73 | + | |
| 74 | + include 'include/pmieducar/educar_campo_lista.php'; | |
| 75 | + } | |
| 76 | + | |
| 77 | + function Novo() | |
| 78 | + { | |
| 79 | + session_start(); | |
| 80 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 81 | + session_write_close(); | |
| 82 | + | |
| 83 | + $db = new clsBanco(); | |
| 84 | + $db2 = new clsBanco(); | |
| 85 | + | |
| 86 | + $ano = $db2->CampoUnico("SELECT MAX(ano) FROM pmieducar.escola_ano_letivo | |
| 87 | + WHERE ref_cod_escola = {$this->ref_cod_escola} AND andamento = 1"); | |
| 88 | + | |
| 89 | + if (! is_numeric($ano)) { | |
| 90 | + $ano = date("Y"); | |
| 91 | + } | |
| 92 | + | |
| 93 | + // Aprovados | |
| 94 | + $db->Consulta("SELECT cod_matricula, ref_cod_aluno | |
| 95 | + FROM pmieducar.matricula m, pmieducar.matricula_turma | |
| 96 | + WHERE aprovado = '1' AND m.ativo = '1' AND ref_ref_cod_escola = '{$this->ref_cod_escola}' AND ref_ref_cod_serie='{$this->ref_ref_cod_serie}' AND ref_cod_curso = '$this->ref_cod_curso' AND cod_matricula = ref_cod_matricula AND ref_cod_turma = '$this->ref_cod_turma' "); | |
| 97 | + | |
| 98 | + while ($db->ProximoRegistro()) { | |
| 99 | + list($cod_matricula, $ref_cod_aluno) = $db->Tupla(); | |
| 100 | + $prox_mod = $db2->campoUnico("SELECT ref_serie_destino FROM pmieducar.sequencia_serie WHERE ref_serie_origem = '{$this->ref_ref_cod_serie}' AND ativo = '1' "); | |
| 101 | + | |
| 102 | + if (is_numeric($prox_mod)) { | |
| 103 | + // Aqui localizar o próximo curso | |
| 104 | + $ref_cod_curso = $db2->CampoUnico("SELECT ref_cod_curso FROM pmieducar.serie WHERE cod_serie = {$prox_mod}"); | |
| 105 | + $db2->Consulta("UPDATE pmieducar.matricula SET ultima_matricula = '0' WHERE cod_matricula = '$cod_matricula'"); | |
| 106 | + | |
| 107 | + $db2->Consulta(" | |
| 108 | + INSERT INTO pmieducar.matricula | |
| 109 | + (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula) | |
| 110 | + VALUES | |
| 111 | + ('{$this->ref_cod_escola}', '$prox_mod', '{$this->pessoa_logada}', '$ref_cod_aluno', '3', 'NOW()', '$ano', '{$ref_cod_curso}', '1') | |
| 112 | + "); | |
| 113 | + } | |
| 114 | + } | |
| 43 | 115 | |
| 44 | - var $pessoa_logada; | |
| 45 | - | |
| 46 | - function Inicializar() | |
| 47 | - { | |
| 48 | - $retorno = "Novo"; | |
| 49 | - @session_start(); | |
| 50 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 51 | - @session_write_close(); | |
| 52 | - return $retorno; | |
| 53 | - } | |
| 54 | - | |
| 55 | - function Gerar() | |
| 56 | - { | |
| 57 | - $instituicao_obrigatorio = true; | |
| 58 | - $escola_obrigatorio = true; | |
| 59 | - $curso_obrigatorio = true; | |
| 60 | - $escola_curso_serie_obrigatorio = true; | |
| 61 | - $turma_obrigatorio = true; | |
| 62 | - $get_escola = true; | |
| 63 | - $get_curso = true; | |
| 64 | - $get_escola_curso_serie = true; | |
| 65 | - $get_turma = true; | |
| 66 | - $get_cursos_nao_padrao = true; | |
| 67 | - include("include/pmieducar/educar_campo_lista.php"); | |
| 68 | - } | |
| 69 | - | |
| 70 | - function Novo() | |
| 71 | - { | |
| 72 | - | |
| 73 | - @session_start(); | |
| 74 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 75 | - @session_write_close(); | |
| 76 | - | |
| 77 | - | |
| 78 | - $db = new clsBanco(); | |
| 79 | - $db2 = new clsBanco(); | |
| 80 | - | |
| 81 | - $ano = $db2->CampoUnico("SELECT MAX(ano) FROM pmieducar.escola_ano_letivo WHERE ref_cod_escola = {$this->ref_cod_escola} AND andamento=1"); | |
| 82 | - if (!is_numeric($ano)) | |
| 83 | - $ano = date("Y"); | |
| 84 | - //aprovados | |
| 85 | - $db->Consulta("SELECT cod_matricula, ref_cod_aluno FROM pmieducar.matricula m, pmieducar.matricula_turma WHERE aprovado = '1' AND m.ativo = '1' AND ref_ref_cod_escola = '{$this->ref_cod_escola}' AND ref_ref_cod_serie='{$this->ref_ref_cod_serie}' AND ref_cod_curso = '$this->ref_cod_curso' AND cod_matricula = ref_cod_matricula AND ref_cod_turma = '$this->ref_cod_turma' "); | |
| 86 | - while ($db->ProximoRegistro()) | |
| 87 | - { | |
| 88 | - list($cod_matricula, $ref_cod_aluno) = $db->Tupla(); | |
| 89 | - | |
| 90 | - $prox_mod = $db2->campoUnico("SELECT ref_serie_destino FROM pmieducar.sequencia_serie WHERE ref_serie_origem = '{$this->ref_ref_cod_serie}' AND ativo = '1' "); | |
| 91 | - | |
| 92 | - | |
| 93 | - if(is_numeric($prox_mod)) | |
| 94 | - { | |
| 95 | - //aqui localizar o proximo curso | |
| 96 | - $ref_cod_curso = $db2->CampoUnico("SELECT ref_cod_curso FROM pmieducar.serie WHERE cod_serie = {$prox_mod}"); | |
| 97 | - $db2->Consulta("UPDATE pmieducar.matricula SET ultima_matricula = '0' WHERE cod_matricula = '$cod_matricula'"); | |
| 98 | -// $ano = date("Y"); | |
| 99 | - | |
| 100 | - $db2->Consulta("INSERT INTO | |
| 101 | - pmieducar.matricula | |
| 102 | - (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula) | |
| 103 | - VALUES | |
| 104 | - ('{$this->ref_cod_escola}', '$prox_mod', '{$this->pessoa_logada}', '$ref_cod_aluno', '3', 'NOW()', '$ano', '{$ref_cod_curso}', '1' ) | |
| 105 | - "); | |
| 106 | - } | |
| 107 | - | |
| 108 | - } | |
| 109 | - | |
| 110 | - //reprovados | |
| 111 | - $db->Consulta("SELECT cod_matricula, ref_cod_aluno, ref_ref_cod_serie FROM pmieducar.matricula, pmieducar.matricula_turma WHERE aprovado = '2' AND ref_ref_cod_escola = '{$this->ref_cod_escola}' AND ref_ref_cod_serie='{$this->ref_ref_cod_serie}' AND cod_matricula = ref_cod_matricula AND ref_cod_turma = '$this->ref_cod_turma'"); | |
| 112 | - while ($db->ProximoRegistro()) | |
| 113 | - { | |
| 114 | - list($cod_matricula, $ref_cod_aluno, $ref_cod_serie) = $db->Tupla(); | |
| 115 | - $db2->Consulta("UPDATE pmieducar.matricula SET ultima_matricula = '0' WHERE cod_matricula = '$cod_matricula'"); | |
| 116 | -// $ano = date("Y"); | |
| 117 | - $db2->Consulta("INSERT INTO | |
| 118 | - pmieducar.matricula | |
| 119 | - (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula) | |
| 120 | - VALUES | |
| 121 | - ('{$this->ref_cod_escola}', '$ref_cod_serie', '{$this->pessoa_logada}', '$ref_cod_aluno', '3', 'NOW()', '$ano', '{$this->ref_cod_curso}', '1' ) | |
| 122 | - "); | |
| 123 | - } | |
| 124 | - $this->mensagem = "Rematrícula efetuada com sucesso!"; | |
| 125 | - return true; | |
| 126 | - } | |
| 127 | - | |
| 128 | - function Editar() | |
| 129 | - { | |
| 130 | - | |
| 131 | - | |
| 132 | - } | |
| 116 | + // Reprovados | |
| 117 | + $db->Consulta("SELECT cod_matricula, ref_cod_aluno, ref_ref_cod_serie FROM pmieducar.matricula, pmieducar.matricula_turma WHERE aprovado = '2' AND ref_ref_cod_escola = '{$this->ref_cod_escola}' AND ref_ref_cod_serie='{$this->ref_ref_cod_serie}' AND cod_matricula = ref_cod_matricula AND ref_cod_turma = '$this->ref_cod_turma'"); | |
| 118 | + | |
| 119 | + while ($db->ProximoRegistro()) { | |
| 120 | + list($cod_matricula, $ref_cod_aluno, $ref_cod_serie) = $db->Tupla(); | |
| 121 | + | |
| 122 | + $db2->Consulta("UPDATE pmieducar.matricula SET ultima_matricula = '0' | |
| 123 | + WHERE cod_matricula = '$cod_matricula'"); | |
| 124 | + | |
| 125 | + $db2->Consulta(" | |
| 126 | + INSERT INTO pmieducar.matricula | |
| 127 | + (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula) | |
| 128 | + VALUES | |
| 129 | + ('{$this->ref_cod_escola}', '$ref_cod_serie', '{$this->pessoa_logada}', '$ref_cod_aluno', '3', 'NOW()', '$ano', '{$this->ref_cod_curso}', '1') | |
| 130 | + "); | |
| 131 | + } | |
| 132 | + | |
| 133 | + $this->mensagem = "Rematrícula efetuada com sucesso!"; | |
| 134 | + return TRUE; | |
| 135 | + } | |
| 136 | + | |
| 137 | + function Editar() { | |
| 138 | + return TRUE; | |
| 139 | + } | |
| 133 | 140 | } |
| 134 | 141 | |
| 135 | -// cria uma extensao da classe base | |
| 142 | +// Instancia objeto de página | |
| 136 | 143 | $pagina = new clsIndexBase(); |
| 137 | -// cria o conteudo | |
| 144 | + | |
| 145 | +// Instancia objeto de conteúdo | |
| 138 | 146 | $miolo = new indice(); |
| 139 | -// adiciona o conteudo na clsBase | |
| 140 | -$pagina->addForm( $miolo ); | |
| 141 | -// gera o html | |
| 147 | + | |
| 148 | +// Atribui o conteúdo à página | |
| 149 | +$pagina->addForm($miolo); | |
| 150 | + | |
| 151 | +// Gera o código HTML | |
| 142 | 152 | $pagina->MakeAll(); |
| 143 | 153 | ?> |
| 144 | -<script> | |
| 145 | - | |
| 146 | -document.getElementById('ref_cod_escola').onchange = function() | |
| 147 | -{ | |
| 148 | - getEscolaCurso(); | |
| 154 | +<script type="text/javascript"> | |
| 155 | +document.getElementById('ref_cod_escola').onchange = function() { | |
| 156 | + getEscolaCurso(); | |
| 149 | 157 | } |
| 150 | 158 | |
| 151 | -document.getElementById('ref_cod_curso').onchange = function() | |
| 152 | -{ | |
| 153 | - getEscolaCursoSerie(); | |
| 159 | +document.getElementById('ref_cod_curso').onchange = function() { | |
| 160 | + getEscolaCursoSerie(); | |
| 154 | 161 | } |
| 155 | 162 | |
| 156 | -document.getElementById('ref_ref_cod_serie').onchange = function() | |
| 157 | -{ | |
| 158 | - getTurma(); | |
| 163 | +document.getElementById('ref_ref_cod_serie').onchange = function() { | |
| 164 | + getTurma(); | |
| 159 | 165 | } |
| 160 | - | |
| 161 | -</script> | |
| 166 | +</script> | |
| 162 | 167 | \ No newline at end of file | ... | ... |