Commit e94353e5630a1b871321da5db45e6921aa3a8757
1 parent
9dfe4a96
Exists in
master
Refactoring para coding standards
Showing
1 changed file
with
289 additions
and
264 deletions
Show diff stats
ieducar/intranet/educar_calendario_dia_cad.php
| 1 | <?php | 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" ); | ||
| 31 | 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 | + * @category i-Educar | ||
| 25 | + * @license @@license@@ | ||
| 26 | + * @package iEd_Pmieducar | ||
| 27 | + * @since Arquivo disponível desde a versão 1.0.0 | ||
| 28 | + * @version $Id$ | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | +require_once 'include/clsBase.inc.php'; | ||
| 32 | +require_once 'include/clsCadastro.inc.php'; | ||
| 33 | +require_once 'include/clsBanco.inc.php'; | ||
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * clsIndexBase class. | ||
| 38 | + * | ||
| 39 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
| 40 | + * @category i-Educar | ||
| 41 | + * @license @@license@@ | ||
| 42 | + * @package iEd_Pmieducar | ||
| 43 | + * @since Classe disponível desde a versão 1.0.0 | ||
| 44 | + * @version @@package_version@@ | ||
| 45 | + */ | ||
| 32 | class clsIndexBase extends clsBase | 46 | class clsIndexBase extends clsBase |
| 33 | { | 47 | { |
| 34 | - function Formular() | ||
| 35 | - { | ||
| 36 | - $this->SetTitulo( "{$this->_instituicao} i-Educar - Calendario Dia" ); | ||
| 37 | - $this->processoAp = "620"; | ||
| 38 | - } | 48 | + function Formular() |
| 49 | + { | ||
| 50 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Calendário Dia'); | ||
| 51 | + $this->processoAp = 620; | ||
| 52 | + } | ||
| 39 | } | 53 | } |
| 40 | 54 | ||
| 55 | +/** | ||
| 56 | + * indice class. | ||
| 57 | + * | ||
| 58 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | ||
| 59 | + * @category i-Educar | ||
| 60 | + * @license @@license@@ | ||
| 61 | + * @package iEd_Pmieducar | ||
| 62 | + * @since Classe disponível desde a versão 1.0.0 | ||
| 63 | + * @version @@package_version@@ | ||
| 64 | + */ | ||
| 41 | class indice extends clsCadastro | 65 | class indice extends clsCadastro |
| 42 | { | 66 | { |
| 43 | - /** | ||
| 44 | - * Referencia pega da session para o idpes do usuario atual | ||
| 45 | - * | ||
| 46 | - * @var int | ||
| 47 | - */ | ||
| 48 | - var $pessoa_logada; | ||
| 49 | - | ||
| 50 | - var $ref_cod_calendario_ano_letivo; | ||
| 51 | - var $mes; | ||
| 52 | - var $dia; | ||
| 53 | - var $ref_usuario_exc; | ||
| 54 | - var $ref_usuario_cad; | ||
| 55 | - var $ref_cod_calendario_dia_motivo; | ||
| 56 | - //var $ref_cod_calendario_atividade; | ||
| 57 | - var $descricao; | ||
| 58 | - var $data_cadastro; | ||
| 59 | - var $data_exclusao; | ||
| 60 | - var $ativo; | ||
| 61 | - var $ano; | ||
| 62 | - var $ref_cod_escola; | ||
| 63 | - | ||
| 64 | - function Inicializar() | ||
| 65 | - { | ||
| 66 | - $retorno = "Novo"; | ||
| 67 | - @session_start(); | ||
| 68 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 69 | - @session_write_close(); | ||
| 70 | - | ||
| 71 | - $this->dia=$_GET["dia"]; | ||
| 72 | - $this->mes=$_GET["mes"]; | ||
| 73 | - $this->ref_cod_calendario_ano_letivo = $_GET["ref_cod_calendario_ano_letivo"]; | ||
| 74 | - | ||
| 75 | - $obj_permissoes = new clsPermissoes(); | ||
| 76 | - $obj_permissoes->permissao_cadastra( 620, $this->pessoa_logada, 7, "educar_calendario_dia_lst.php" ); | ||
| 77 | - | ||
| 78 | - if( is_numeric( $this->ref_cod_calendario_ano_letivo ) && is_numeric( $this->mes ) && is_numeric( $this->dia ) ) | ||
| 79 | - { | ||
| 80 | - | ||
| 81 | - $obj = new clsPmieducarCalendarioDia( $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia ); | ||
| 82 | - $registro = $obj->detalhe(); | ||
| 83 | - if( $registro ) | ||
| 84 | - { | ||
| 85 | - foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto | ||
| 86 | - $this->$campo = $val; | ||
| 87 | - | ||
| 88 | - | ||
| 89 | - $obj_permissoes = new clsPermissoes(); | ||
| 90 | - if( $obj_permissoes->permissao_excluir( 620, $this->pessoa_logada, 7 ) ) | ||
| 91 | - { | ||
| 92 | - if($this->descricao) | ||
| 93 | - $this->fexcluir = true; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - $retorno = "Editar"; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - if( class_exists( "clsPmieducarCalendarioAnoLetivo" ) ) | ||
| 100 | - { | ||
| 101 | - $objTemp = new clsPmieducarCalendarioAnoLetivo($this->ref_cod_calendario_ano_letivo); | ||
| 102 | - | ||
| 103 | - $det = $objTemp->detalhe(); | ||
| 104 | - $this->ano = $det["ano"]; | ||
| 105 | - | ||
| 106 | - } | ||
| 107 | - else | ||
| 108 | - { | ||
| 109 | - header("location:educar_calendario_dia_lst.php?ref_cod_calendario_ano_letivo={$registro["ref_cod_calendario_ano_letivo"]}&mes={$registro["mes"]}&dia={$registro["dia"]}"); | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - } | ||
| 113 | - $this->url_cancelar = "educar_calendario_anotacao_lst.php?ref_cod_calendario_ano_letivo={$registro["ref_cod_calendario_ano_letivo"]}&ano={$this->ano}&mes={$registro["mes"]}&dia={$registro["dia"]}"; | ||
| 114 | - $this->nome_url_cancelar = "Cancelar"; | ||
| 115 | - return $retorno; | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - function Gerar() | ||
| 119 | - { | ||
| 120 | - | ||
| 121 | - // primary keys | ||
| 122 | - $this->campoRotulo( "dia_","Dia", "<b>{$this->dia}/{$this->mes}/{$this->ano}</b> "); | ||
| 123 | - $this->campoOculto( "ref_cod_calendario_ano_letivo", $this->ref_cod_calendario_ano_letivo ); | ||
| 124 | - | ||
| 125 | - $obj_calendario_ano_letivo = new clsPmieducarCalendarioAnoLetivo( $this->ref_cod_calendario_ano_letivo ); | ||
| 126 | - $det_calendario_ano_letivo = $obj_calendario_ano_letivo->detalhe(); | ||
| 127 | - $ref_cod_escola = $det_calendario_ano_letivo["ref_cod_escola"]; | ||
| 128 | - | ||
| 129 | - //$opcoes = array( "" => "Selecione" ); | ||
| 130 | - | ||
| 131 | - //$this->campoLista( "ref_cod_calendario_ano_letivo", "Calendario Ano Letivo", $opcoes, $this->ref_cod_calendario_ano_letivo,"","","","",true ); | ||
| 132 | - | ||
| 133 | - | ||
| 134 | - $this->campoRotulo( "ano", "Ano Letivo",$this->ano ); | ||
| 135 | - | ||
| 136 | - $this->campoOculto( "mes", $this->mes ); | ||
| 137 | - $this->campoOculto( "dia", $this->dia ); | ||
| 138 | - //$this->campoOculto( "ano", $this->ano ); | ||
| 139 | - | ||
| 140 | - // foreign keys | ||
| 141 | - $opcoes = array( "" => "Selecione" ); | ||
| 142 | - if( class_exists( "clsPmieducarCalendarioDiaMotivo" ) ) | ||
| 143 | - { | ||
| 144 | - $objTemp = new clsPmieducarCalendarioDiaMotivo(); | ||
| 145 | - $lista = $objTemp->lista( null,$ref_cod_escola,null,null,null,null,null,null,null,null,null,1 ); | ||
| 146 | - if ( is_array( $lista ) && count( $lista ) ) | ||
| 147 | - { | ||
| 148 | - foreach ( $lista as $registro ) | ||
| 149 | - { | ||
| 150 | - $opcoes["{$registro['cod_calendario_dia_motivo']}"] = "{$registro['nm_motivo']}"; | ||
| 151 | - } | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | - else | ||
| 155 | - { | ||
| 156 | - echo "<!--\nErro\nClasse clsPmieducarCalendarioDiaMotivo nao encontrada\n-->"; | ||
| 157 | - $opcoes = array( "" => "Erro na geracao" ); | ||
| 158 | - } | ||
| 159 | - $this->campoLista( "ref_cod_calendario_dia_motivo", "Calendario Dia Motivo", $opcoes, $this->ref_cod_calendario_dia_motivo,"",false,"","",false,false ); | ||
| 160 | - | ||
| 161 | - /* $opcoes = array( "" => "Selecione" ); | ||
| 162 | - if( class_exists( "clsPmieducarCalendarioAtividade" ) ) | ||
| 163 | - { | ||
| 164 | - $objTemp = new clsPmieducarCalendarioAtividade(); | ||
| 165 | - $lista = $objTemp->lista(); | ||
| 166 | - if ( is_array( $lista ) && count( $lista ) ) | ||
| 167 | - { | ||
| 168 | - foreach ( $lista as $registro ) | ||
| 169 | - { | ||
| 170 | - $opcoes["{$registro['cod_calendario_atividade']}"] = "{$registro['nm_atividade']}"; | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - else | ||
| 175 | - { | ||
| 176 | - echo "<!--\nErro\nClasse clsPmieducarCalendarioAtividade nao encontrada\n-->"; | ||
| 177 | - $opcoes = array( "" => "Erro na geracao" ); | ||
| 178 | - } | ||
| 179 | - $this->campoLista( "ref_cod_calendario_atividade", "Calendario Atividade", $opcoes, $this->ref_cod_calendario_atividade,"",false,"","",false,false ); | ||
| 180 | -*/ | ||
| 181 | - $this->campoMemo( "descricao", "Descricão", $this->descricao, 30,10,true ); | ||
| 182 | - | ||
| 183 | -// $this->array_botao = array('Adicionar Anotação'); | ||
| 184 | - // $this->array_botao_url = array("educar_calendario_anotacao_cad.php?ref_ref_cod_calendario_ano_letivo={$this->ref_cod_calendario_ano_letivo}&dia={$this->dia}&mes={$this->mes}"); | ||
| 185 | - | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - function Novo() | ||
| 189 | - { | ||
| 190 | - @session_start(); | ||
| 191 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 192 | - @session_write_close(); | ||
| 193 | - | ||
| 194 | - $obj_permissoes = new clsPermissoes(); | ||
| 195 | - $obj_permissoes->permissao_cadastra( 620, $this->pessoa_logada, 7, "educar_calendario_dia_lst.php" ); | ||
| 196 | - | ||
| 197 | - | ||
| 198 | - $obj = new clsPmieducarCalendarioDia( $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, $this->pessoa_logada, $this->pessoa_logada, $this->ref_cod_calendario_dia_motivo, /*$this->ref_cod_calendario_atividade, */$this->descricao, $this->data_cadastro, $this->data_exclusao, $this->ativo ); | ||
| 199 | - $cadastrou = $obj->cadastra(); | ||
| 200 | - if( $cadastrou ) | ||
| 201 | - { | ||
| 202 | - $this->mensagem .= "Cadastro efetuado com sucesso.<br>"; | ||
| 203 | - //header( "Location: educar_calendario_dia_lst.php" ); | ||
| 204 | -// header( "Location: educar_calendario_ano_letivo_lst.php" ); | ||
| 205 | - header( "Location: educar_calendario_anotacao_lst.php?dia={$this->dia}&mes={$this->mes}&ano={$this->ano}&ref_cod_calendario_ano_letivo={$this->ref_cod_calendario_ano_letivo}" ); | ||
| 206 | - die(); | ||
| 207 | - return true; | ||
| 208 | - } | ||
| 209 | - | ||
| 210 | - $this->mensagem = "Cadastro não realizado.<br>"; | ||
| 211 | - echo "<!--\nErro ao cadastrar clsPmieducarCalendarioDia\nvalores obrigatorios\nis_numeric( $this->ref_cod_calendario_ano_letivo ) && is_numeric( $this->mes ) && is_numeric( $this->dia ) && is_numeric( $this->ref_usuario_cad ) && is_numeric( $this->ref_cod_calendario_dia_motivo ) && is_string( $this->descricao )\n-->"; | ||
| 212 | - return false; | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - function Editar() | ||
| 216 | - { | ||
| 217 | - @session_start(); | ||
| 218 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 219 | - @session_write_close(); | ||
| 220 | - | ||
| 221 | - $obj_permissoes = new clsPermissoes(); | ||
| 222 | - $obj_permissoes->permissao_cadastra( 620, $this->pessoa_logada, 7, "educar_calendario_dia_lst.php" ); | ||
| 223 | - | ||
| 224 | - | ||
| 225 | - $obj = new clsPmieducarCalendarioDia($this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, $this->pessoa_logada, $this->pessoa_logada, $this->ref_cod_calendario_dia_motivo/*, $this->ref_cod_calendario_atividade*/, $this->descricao, $this->data_cadastro, $this->data_exclusao, $this->ativo); | ||
| 226 | - $editou = $obj->edita(); | ||
| 227 | - if( $editou ) | ||
| 228 | - { | ||
| 229 | - $this->mensagem .= "Edição efetuada com sucesso.<br>"; | ||
| 230 | -// header( "Location: educar_calendario_dia_lst.php" ); | ||
| 231 | - //header( "Location: educar_calendario_ano_letivo_lst.php" ); | ||
| 232 | - header( "Location: educar_calendario_anotacao_lst.php?dia={$this->dia}&mes={$this->mes}&ano={$this->ano}&ref_cod_calendario_ano_letivo={$this->ref_cod_calendario_ano_letivo}" ); | ||
| 233 | - die(); | ||
| 234 | - return true; | ||
| 235 | - } | ||
| 236 | - | ||
| 237 | - $this->mensagem = "Edição não realizada.<br>"; | ||
| 238 | - echo "<!--\nErro ao editar clsPmieducarCalendarioDia\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_calendario_ano_letivo ) && is_numeric( $this->mes ) && is_numeric( $this->dia ) && is_numeric( $this->ref_usuario_exc ) )\n-->"; | ||
| 239 | - return false; | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - function Excluir() | ||
| 243 | - { | ||
| 244 | - @session_start(); | ||
| 245 | - $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 246 | - @session_write_close(); | ||
| 247 | - | ||
| 248 | - $obj_permissoes = new clsPermissoes(); | ||
| 249 | - $obj_permissoes->permissao_excluir( 620, $this->pessoa_logada, 7, "educar_calendario_dia_lst.php" ); | ||
| 250 | - | ||
| 251 | - | ||
| 252 | - $obj = new clsPmieducarCalendarioDia($this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, $this->pessoa_logada, $this->pessoa_logada, "NULL", /*$this->ref_cod_calendario_atividade,*/ "NULL", $this->data_cadastro, $this->data_exclusao, 1); | ||
| 253 | - $excluiu = $obj->edita(); | ||
| 254 | - if( $excluiu ) | ||
| 255 | - { | ||
| 256 | - $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; | ||
| 257 | - header( "Location: educar_calendario_anotacao_lst.php?dia={$this->dia}&mes={$this->mes}&ano={$this->ano}&ref_cod_calendario_ano_letivo={$this->ref_cod_calendario_ano_letivo}" ); | ||
| 258 | - die(); | ||
| 259 | - return true; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - $this->mensagem = "Exclusão não realizada.<br>"; | ||
| 263 | - echo "<!--\nErro ao excluir clsPmieducarCalendarioDia\nvalores obrigatorios\nif( is_numeric( $this->ref_cod_calendario_ano_letivo ) && is_numeric( $this->mes ) && is_numeric( $this->dia ) && is_numeric( $this->ref_usuario_exc ) )\n-->"; | ||
| 264 | - return false; | ||
| 265 | - } | 67 | + var $pessoa_logada; |
| 68 | + | ||
| 69 | + var $ref_cod_calendario_ano_letivo; | ||
| 70 | + var $mes; | ||
| 71 | + var $dia; | ||
| 72 | + var $ref_usuario_exc; | ||
| 73 | + var $ref_usuario_cad; | ||
| 74 | + var $ref_cod_calendario_dia_motivo; | ||
| 75 | + var $descricao; | ||
| 76 | + var $data_cadastro; | ||
| 77 | + var $data_exclusao; | ||
| 78 | + var $ativo; | ||
| 79 | + var $ano; | ||
| 80 | + var $ref_cod_escola; | ||
| 81 | + | ||
| 82 | + function Inicializar() | ||
| 83 | + { | ||
| 84 | + $retorno = 'Novo'; | ||
| 85 | + | ||
| 86 | + @session_start(); | ||
| 87 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 88 | + @session_write_close(); | ||
| 89 | + | ||
| 90 | + $this->dia = $_GET['dia']; | ||
| 91 | + $this->mes = $_GET['mes']; | ||
| 92 | + $this->ref_cod_calendario_ano_letivo = $_GET['ref_cod_calendario_ano_letivo']; | ||
| 93 | + | ||
| 94 | + $obj_permissoes = new clsPermissoes(); | ||
| 95 | + $obj_permissoes->permissao_cadastra(620, $this->pessoa_logada, 7, | ||
| 96 | + 'educar_calendario_dia_lst.php'); | ||
| 97 | + | ||
| 98 | + if (is_numeric($this->ref_cod_calendario_ano_letivo) && | ||
| 99 | + is_numeric($this->mes) && is_numeric($this->dia) | ||
| 100 | + ) { | ||
| 101 | + $obj = new clsPmieducarCalendarioDia($this->ref_cod_calendario_ano_letivo, | ||
| 102 | + $this->mes, $this->dia); | ||
| 103 | + | ||
| 104 | + $registro = $obj->detalhe(); | ||
| 105 | + | ||
| 106 | + if ($registro) { | ||
| 107 | + // passa todos os valores obtidos no registro para atributos do objeto | ||
| 108 | + foreach ($registro as $campo => $val) { | ||
| 109 | + $this->$campo = $val; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + $obj_permissoes = new clsPermissoes(); | ||
| 113 | + | ||
| 114 | + if ($obj_permissoes->permissao_excluir(620, $this->pessoa_logada, 7)) { | ||
| 115 | + if ($this->descricao) { | ||
| 116 | + $this->fexcluir = TRUE; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + $retorno = 'Editar'; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + if (class_exists('clsPmieducarCalendarioAnoLetivo')) { | ||
| 124 | + $objTemp = new clsPmieducarCalendarioAnoLetivo($this->ref_cod_calendario_ano_letivo); | ||
| 125 | + $det = $objTemp->detalhe(); | ||
| 126 | + $this->ano = $det['ano']; | ||
| 127 | + } | ||
| 128 | + else { | ||
| 129 | + $url = sprintf( | ||
| 130 | + 'educar_calendario_dia_lst.php?ref_cod_calendario_ano_letivo=%d&mes=%d&dia=%d', | ||
| 131 | + $registro['ref_cod_calendario_ano_letivo'], $registro['mes'], $registro['dia'] | ||
| 132 | + ); | ||
| 133 | + header('Location: ' . $url); | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + $this->url_cancelar = sprintf( | ||
| 138 | + 'educar_calendario_anotacao_lst.php?ref_cod_calendario_ano_letivo=%d&ano=%d&mes=%d&dia=%d', | ||
| 139 | + $registro['ref_cod_calendario_ano_letivo'], $this->ano, $registro['mes'], $registro['dia'] | ||
| 140 | + ); | ||
| 141 | + $this->nome_url_cancelar = 'Cancelar'; | ||
| 142 | + | ||
| 143 | + return $retorno; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + function Gerar() | ||
| 147 | + { | ||
| 148 | + // Primary keys | ||
| 149 | + $this->campoRotulo( | ||
| 150 | + 'dia_', 'Dia', sprintf('<b>%d/%d/%d</b>', $this->dia, $this->mes, $this->ano) | ||
| 151 | + ); | ||
| 152 | + | ||
| 153 | + $this->campoOculto( | ||
| 154 | + 'ref_cod_calendario_ano_letivo', $this->ref_cod_calendario_ano_letivo | ||
| 155 | + ); | ||
| 156 | + | ||
| 157 | + $obj_calendario_ano_letivo = new clsPmieducarCalendarioAnoLetivo( | ||
| 158 | + $this->ref_cod_calendario_ano_letivo | ||
| 159 | + ); | ||
| 160 | + | ||
| 161 | + $det_calendario_ano_letivo = $obj_calendario_ano_letivo->detalhe(); | ||
| 162 | + $ref_cod_escola = $det_calendario_ano_letivo['ref_cod_escola']; | ||
| 163 | + | ||
| 164 | + $this->campoRotulo('ano', 'Ano Letivo', $this->ano); | ||
| 165 | + | ||
| 166 | + $this->campoOculto('mes', $this->mes); | ||
| 167 | + $this->campoOculto('dia', $this->dia); | ||
| 168 | + | ||
| 169 | + // Foreign keys | ||
| 170 | + $opcoes = array('' => 'Selecione'); | ||
| 171 | + if (class_exists('clsPmieducarCalendarioDiaMotivo')) { | ||
| 172 | + $objTemp = new clsPmieducarCalendarioDiaMotivo(); | ||
| 173 | + $lista = $objTemp->lista(NULL, $ref_cod_escola, NULL, NULL, NULL, NULL, | ||
| 174 | + NULL, NULL, NULL, NULL, NULL, 1 | ||
| 175 | + ); | ||
| 176 | + | ||
| 177 | + if (is_array($lista) && count($lista)) { | ||
| 178 | + foreach ($lista as $registro) { | ||
| 179 | + $opcoes[$registro['cod_calendario_dia_motivo']] = $registro['nm_motivo']; | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + else { | ||
| 184 | + $opcoes = array('' => 'Erro na geracao'); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + $this->campoLista( | ||
| 188 | + 'ref_cod_calendario_dia_motivo', 'Calendário Dia Motivo', $opcoes, | ||
| 189 | + $this->ref_cod_calendario_dia_motivo, '', FALSE, '', '', FALSE, FALSE | ||
| 190 | + ); | ||
| 191 | + | ||
| 192 | + $this->campoMemo('descricao', 'Descrição', $this->descricao, 30, 10, TRUE); | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + function Novo() | ||
| 196 | + { | ||
| 197 | + @session_start(); | ||
| 198 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 199 | + @session_write_close(); | ||
| 200 | + | ||
| 201 | + $obj_permissoes = new clsPermissoes(); | ||
| 202 | + $obj_permissoes->permissao_cadastra(620, $this->pessoa_logada, 7, | ||
| 203 | + 'educar_calendario_dia_lst.php'); | ||
| 204 | + | ||
| 205 | + $obj = new clsPmieducarCalendarioDia( | ||
| 206 | + $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, | ||
| 207 | + $this->pessoa_logada, $this->pessoa_logada, $this->ref_cod_calendario_dia_motivo, | ||
| 208 | + $this->descricao, $this->data_cadastro, $this->data_exclusao, $this->ativo | ||
| 209 | + ); | ||
| 210 | + | ||
| 211 | + $cadastrou = $obj->cadastra(); | ||
| 212 | + | ||
| 213 | + if ($cadastrou) { | ||
| 214 | + $this->mensagem .= 'Cadastro efetuado com sucesso. <br />'; | ||
| 215 | + $url = sprintf( | ||
| 216 | + 'educar_calendario_anotacao_lst.php?dia=%d&mes=%d&ano=%d&ref_cod_calendario_ano_letivo=%d', | ||
| 217 | + $this->dia, $this->mes, $this->ano, $this->ref_cod_calendario_ano_letivo | ||
| 218 | + ); | ||
| 219 | + header('Location: ' . $url); | ||
| 220 | + die(); | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + $this->mensagem = 'Cadastro não realizado. <br />'; | ||
| 224 | + return FALSE; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + function Editar() | ||
| 228 | + { | ||
| 229 | + @session_start(); | ||
| 230 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 231 | + @session_write_close(); | ||
| 232 | + | ||
| 233 | + $obj_permissoes = new clsPermissoes(); | ||
| 234 | + $obj_permissoes->permissao_cadastra(620, $this->pessoa_logada, 7, | ||
| 235 | + 'educar_calendario_dia_lst.php'); | ||
| 236 | + | ||
| 237 | + $obj = new clsPmieducarCalendarioDia( | ||
| 238 | + $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, | ||
| 239 | + $this->pessoa_logada, $this->pessoa_logada, $this->ref_cod_calendario_dia_motivo, | ||
| 240 | + $this->descricao, $this->data_cadastro, $this->data_exclusao, $this->ativo | ||
| 241 | + ); | ||
| 242 | + | ||
| 243 | + $editou = $obj->edita(); | ||
| 244 | + | ||
| 245 | + if ($editou) { | ||
| 246 | + $this->mensagem .= 'Edição efetuada com sucesso. <br />'; | ||
| 247 | + $url = sprintf( | ||
| 248 | + 'educar_calendario_anotacao_lst.php?dia=%d&mes=%d&ano=%d&ref_cod_calendario_ano_letivo=%d', | ||
| 249 | + $this->dia, $this->mes, $this->ano, $this->ref_cod_calendario_ano_letivo | ||
| 250 | + ); | ||
| 251 | + header('Location: ' . $url); | ||
| 252 | + die(); | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + $this->mensagem = 'Edição não realizada. <br />'; | ||
| 256 | + return FALSE; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + function Excluir() | ||
| 260 | + { | ||
| 261 | + @session_start(); | ||
| 262 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | ||
| 263 | + @session_write_close(); | ||
| 264 | + | ||
| 265 | + $obj_permissoes = new clsPermissoes(); | ||
| 266 | + $obj_permissoes->permissao_excluir(620, $this->pessoa_logada, 7, | ||
| 267 | + 'educar_calendario_dia_lst.php'); | ||
| 268 | + | ||
| 269 | + $obj = new clsPmieducarCalendarioDia( | ||
| 270 | + $this->ref_cod_calendario_ano_letivo, $this->mes, $this->dia, | ||
| 271 | + $this->pessoa_logada, $this->pessoa_logada, NULL, NULL, | ||
| 272 | + $this->data_cadastro, $this->data_exclusao, 1 | ||
| 273 | + ); | ||
| 274 | + | ||
| 275 | + $excluiu = $obj->edita(); | ||
| 276 | + if ($excluiu) { | ||
| 277 | + $this->mensagem .= 'Exclusão efetuada com sucesso. <br />'; | ||
| 278 | + $url = sprintf( | ||
| 279 | + 'educar_calendario_anotacao_lst.php?dia=%d&mes=%d&ano=%d&ref_cod_calendario_ano_letivo=%d', | ||
| 280 | + $this->dia, $this->mes, $this->ano, $this->ref_cod_calendario_ano_letivo | ||
| 281 | + ); | ||
| 282 | + header('Location: ' . $url); | ||
| 283 | + die(); | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + $this->mensagem = 'Exclusão não realizada. <br />'; | ||
| 287 | + return FALSE; | ||
| 288 | + } | ||
| 266 | } | 289 | } |
| 267 | 290 | ||
| 268 | -// cria uma extensao da classe base | 291 | +// Instancia objeto de página |
| 269 | $pagina = new clsIndexBase(); | 292 | $pagina = new clsIndexBase(); |
| 270 | -// cria o conteudo | 293 | + |
| 294 | +// Instancia objeto de conteúdo | ||
| 271 | $miolo = new indice(); | 295 | $miolo = new indice(); |
| 272 | -// adiciona o conteudo na clsBase | ||
| 273 | -$pagina->addForm( $miolo ); | ||
| 274 | -// gera o html | ||
| 275 | -$pagina->MakeAll(); | ||
| 276 | -?> | ||
| 277 | \ No newline at end of file | 296 | \ No newline at end of file |
| 297 | + | ||
| 298 | +// Atribui o conteúdo à página | ||
| 299 | +$pagina->addForm($miolo); | ||
| 300 | + | ||
| 301 | +// Gera o código HTML | ||
| 302 | +$pagina->MakeAll(); | ||
| 278 | \ No newline at end of file | 303 | \ No newline at end of file |