From 9ab15c8ed63e8b97df4ed5b47a56f132c30a9fed Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Thu, 30 Jul 2009 21:44:18 +0000 Subject: [PATCH] Refactoring para coding standards --- ieducar/intranet/public_bairro_cad.php | 576 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/public_logradouro_cad.php | 628 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/public_municipio_cad.php | 445 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ieducar/intranet/urbano_cep_logradouro_cad.php | 1084 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4 files changed, 1333 insertions(+), 1400 deletions(-) diff --git a/ieducar/intranet/public_bairro_cad.php b/ieducar/intranet/public_bairro_cad.php index 24ed96e..5a815ec 100755 --- a/ieducar/intranet/public_bairro_cad.php +++ b/ieducar/intranet/public_bairro_cad.php @@ -1,320 +1,312 @@ + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Prefeitura Municipal de Itajaí + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage Enderecamento + * @subpackage Bairro + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsCadastro.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/public/geral.inc.php'; class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} Bairro" ); - $this->processoAp = "756"; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' Bairro'); + $this->processoAp = '756'; + } } class indice extends clsCadastro { - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - var $idmun; - var $geom; - var $idbai; - var $nome; - var $idpes_rev; - var $data_rev; - var $origem_gravacao; - var $idpes_cad; - var $data_cad; - var $operacao; - var $idsis_rev; - var $idsis_cad; - - var $idpais; - var $sigla_uf; - - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $this->idbai=$_GET["idbai"]; - - if( is_numeric( $this->idbai ) ) - { - $obj_bairro = new clsPublicBairro(); - $lst_bairro = $obj_bairro->lista( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $this->idbai ); - if( $lst_bairro ) - { - $registro = $lst_bairro[0]; - } - if( $registro ) - { - foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto - $this->$campo = $val; - - -// $this->fexcluir = true; - - $retorno = "Editar"; - } - } - $this->url_cancelar = ($retorno == "Editar") ? "public_bairro_det.php?idbai={$registro["idbai"]}" : "public_bairro_lst.php"; - $this->nome_url_cancelar = "Cancelar"; - return $retorno; - } - - function Gerar() - { - // primary keys - $this->campoOculto( "idbai", $this->idbai ); - - // foreign keys - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsPais" ) ) - { - $objTemp = new clsPais(); - $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['idpais']}"] = "{$registro['nome']}"; - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "idpais", "Pais", $opcoes, $this->idpais ); - - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsUf" ) ) - { - if( $this->idpais ) - { - $objTemp = new clsUf(); - $lista = $objTemp->lista( false, false, $this->idpais, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['sigla_uf']}"] = "{$registro['nome']}"; - } - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "sigla_uf", "Estado", $opcoes, $this->sigla_uf ); - - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsMunicipio" ) ) - { - if( $this->sigla_uf ) - { - $objTemp = new clsMunicipio(); - $lista = $objTemp->lista( false, $this->sigla_uf, false, false, false, false, false, false, false, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['idmun']}"] = "{$registro['nome']}"; - } - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "idmun", "Município", $opcoes, $this->idmun ); - - // text - $this->campoTexto( "nome", "Nome", $this->nome, 30, 255, true ); - } - - function Novo() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicBairro( $this->idmun, null, null, $this->nome, null, null, 'U', $this->pessoa_logada, null, 'I', null, 9 ); - $cadastrou = $obj->cadastra(); - if( $cadastrou ) - { - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: public_bairro_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Cadastro não realizado.
"; - echo ""; - return false; - } - - function Editar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicBairro( $this->idmun, null, $this->idbai, $this->nome, $this->pessoa_logada, null, 'U', null, null, 'I', null, 9 ); - $editou = $obj->edita(); - if( $editou ) - { - $this->mensagem .= "Edição efetuada com sucesso.
"; - header( "Location: public_bairro_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Edição não realizada.
"; - echo ""; - return false; - } - - function Excluir() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicBairro( null, null, $this->idbai, null, $this->pessoa_logada ); - $excluiu = $obj->excluir(); - if( $excluiu ) - { - $this->mensagem .= "Exclusão efetuada com sucesso.
"; - header( "Location: public_bairro_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Exclusão não realizada.
"; - echo ""; - return false; - } + /** + * Referência a usuário da sessão. + * @var int + */ + var $pessoa_logada; + + var $idmun; + var $geom; + var $idbai; + var $nome; + var $idpes_rev; + var $data_rev; + var $origem_gravacao; + var $idpes_cad; + var $data_cad; + var $operacao; + var $idsis_rev; + var $idsis_cad; + + var $idpais; + var $sigla_uf; + + function Inicializar() + { + $retorno = 'Novo'; + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $this->idbai = $_GET['idbai']; + + if (is_numeric($this->idbai)) { + $obj_bairro = new clsPublicBairro(); + $lst_bairro = $obj_bairro->lista( NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->idbai); + if ($lst_bairro) { + $registro = $lst_bairro[0]; + } + + if ($registro) { + foreach ($registro as $campo => $val) { + $this->$campo = $val; + } + + $retorno = 'Editar'; + } + } + + $this->url_cancelar = ($retorno == 'Editar') ? + 'public_bairro_det.php?idbai=' . $registro['idbai'] : + 'public_bairro_lst.php'; + + $this->nome_url_cancelar = 'Cancelar'; + + return $retorno; + } + + function Gerar() + { + // primary keys + $this->campoOculto('idbai', $this->idbai); + + // foreign keys + $opcoes = array('' => 'Selecione'); + if (class_exists('clsPais')) { + $objTemp = new clsPais(); + $lista = $objTemp->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['idpais']] = $registro['nome']; + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('idpais', 'Pais', $opcoes, $this->idpais); + + $opcoes = array('' => 'Selecione'); + if (class_exists('clsUf')) { + if ($this->idpais) { + $objTemp = new clsUf(); + + $lista = $objTemp->lista(FALSE, FALSE, $this->idpais, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['sigla_uf']] = $registro['nome']; + } + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + + $this->campoLista('sigla_uf', 'Estado', $opcoes, $this->sigla_uf); + + $opcoes = array('' => 'Selecione'); + if (class_exists('clsMunicipio')) { + if ($this->sigla_uf) { + $objTemp = new clsMunicipio(); + $lista = $objTemp->lista(FALSE, $this->sigla_uf, FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['idmun']] = $registro['nome']; + } + } + } + } + else { + echo ''; + $opcoes = array("" => "Erro na geracao"); + } + $this->campoLista('idmun', 'Município', $opcoes, $this->idmun); + + $this->campoTexto('nome', 'Nome', $this->nome, 30, 255, TRUE); + } + + function Novo() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicBairro( $this->idmun, NULL, NULL, $this->nome, NULL, + NULL, 'U', $this->pessoa_logada, NULL, 'I', NULL, 9); + + $cadastrou = $obj->cadastra(); + if ($cadastrou) { + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: public_bairro_lst.php'); + die(); + } + + $this->mensagem = 'Cadastro não realizado.
'; + echo ""; + + return FALSE; + } + + function Editar() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicBairro($this->idmun, NULL, $this->idbai, $this->nome, + $this->pessoa_logada, NULL, 'U', NULL, NULL, 'I', NULL, 9); + $editou = $obj->edita(); + if ($editou) { + $this->mensagem .= "Edição efetuada com sucesso.
"; + header('Location: public_bairro_lst.php'); + die(); + } + + $this->mensagem = 'Edição não realizada.
'; + echo ""; + + return FALSE; + } + + function Excluir() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicBairro(NULL, NULL, $this->idbai, NULL, $this->pessoa_logada); + $excluiu = $obj->excluir(); + if ($excluiu) { + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + header('Location: public_bairro_lst.php'); + die(); + } + + $this->mensagem = 'Exclusão não realizada.
'; + echo ""; + + return FALSE; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html + +// Atribui o conteúdo à  página +$pagina->addForm($miolo); + +// Gera o código HTML $pagina->MakeAll(); ?> - \ No newline at end of file diff --git a/ieducar/intranet/public_logradouro_cad.php b/ieducar/intranet/public_logradouro_cad.php index bee08ed..bda1ed3 100755 --- a/ieducar/intranet/public_logradouro_cad.php +++ b/ieducar/intranet/public_logradouro_cad.php @@ -1,346 +1,336 @@ + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Prefeitura Municipal de Itajaí + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage Enderecamento + * @subpackage Logradouro + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsCadastro.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/public/geral.inc.php'; +require_once 'include/urbano/clsUrbanoTipoLogradouro.inc.php'; class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} Logradouro" ); - $this->processoAp = "757"; - } + function Formular() + { + $this->SetTitulo( "{$this->_instituicao} Logradouro" ); + $this->processoAp = "757"; + } } class indice extends clsCadastro { - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - var $idlog; - var $idtlog; - var $nome; - var $idmun; - var $geom; - var $ident_oficial; - var $idpes_rev; - var $data_rev; - var $origem_gravacao; - var $idpes_cad; - var $data_cad; - var $operacao; - var $idsis_rev; - var $idsis_cad; - - var $idpais; - var $sigla_uf; - - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $this->idlog=$_GET["idlog"]; - - - if( is_numeric( $this->idlog ) ) - { - $obj_logradouro = new clsPublicLogradouro(); - $lst_logradouro = $obj_logradouro->lista( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $this->idlog ); - if( $lst_logradouro ) - { - $registro = $lst_logradouro[0]; - } - - if( $registro ) - { - foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto - $this->$campo = $val; - - -// $this->fexcluir = true; - - $retorno = "Editar"; - } - } - $this->url_cancelar = ($retorno == "Editar") ? "public_logradouro_det.php?idlog={$registro["idlog"]}" : "public_logradouro_lst.php"; - $this->nome_url_cancelar = "Cancelar"; - return $retorno; - } - - function Gerar() - { - // primary keys - $this->campoOculto( "idlog", $this->idlog ); - - // foreign keys - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsPais" ) ) - { - $objTemp = new clsPais(); - $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['idpais']}"] = "{$registro['nome']}"; - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "idpais", "Pais", $opcoes, $this->idpais ); - - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsUf" ) ) - { - if( $this->idpais ) - { - $objTemp = new clsUf(); - $lista = $objTemp->lista( false, false, $this->idpais, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['sigla_uf']}"] = "{$registro['nome']}"; - } - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "sigla_uf", "Estado", $opcoes, $this->sigla_uf ); - - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsMunicipio" ) ) - { - if( $this->sigla_uf ) - { - $objTemp = new clsMunicipio(); - $lista = $objTemp->lista( false, $this->sigla_uf, false, false, false, false, false, false, false, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['idmun']}"] = "{$registro['nome']}"; - } - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "idmun", "Município", $opcoes, $this->idmun ); - - - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsUrbanoTipoLogradouro" ) ) - { - $objTemp = new clsUrbanoTipoLogradouro(); - $objTemp->setOrderby( "descricao ASC" ); - $lista = $objTemp->lista(); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['idtlog']}"] = "{$registro['descricao']}"; - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "idtlog", "Tipo de Logradouro", $opcoes, $this->idtlog ); - - $this->campoTexto( "nome", "Nome", $this->nome, 30, 150, true ); - } - - function Novo() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicLogradouro( null, $this->idtlog, $this->nome, $this->idmun, null, 'S', null, null, 'U', $this->pessoa_logada, null, 'I', null, 9 ); - $cadastrou = $obj->cadastra(); - if( $cadastrou ) - { - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: public_logradouro_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Cadastro não realizado.
"; - echo ""; - return false; - } - - function Editar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicLogradouro( $this->idlog, $this->idtlog, $this->nome, $this->idmun, null, 'S', $this->pessoa_logada, null, 'U', null, null, 'I', null, 9 ); - $editou = $obj->edita(); - if( $editou ) - { - $this->mensagem .= "Edição efetuada com sucesso.
"; - header( "Location: public_logradouro_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Edição não realizada.
"; - echo ""; - return false; - } - - function Excluir() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicLogradouro( $this->idlog, $this->idtlog, $this->nome, $this->idmun, null, 'S', $this->pessoa_logada ); - $excluiu = $obj->excluir(); - if( $excluiu ) - { - $this->mensagem .= "Exclusão efetuada com sucesso.
"; - header( "Location: public_logradouro_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Exclusão não realizada.
"; - echo ""; - return false; - } + /** + * Referência a usuário da sessão. + * @var int + */ + var $pessoa_logada; + + var $idlog; + var $idtlog; + var $nome; + var $idmun; + var $geom; + var $ident_oficial; + var $idpes_rev; + var $data_rev; + var $origem_gravacao; + var $idpes_cad; + var $data_cad; + var $operacao; + var $idsis_rev; + var $idsis_cad; + + var $idpais; + var $sigla_uf; + + function Inicializar() + { + $retorno = 'Novo'; + @session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + @session_write_close(); + + $this->idlog = $_GET['idlog']; + + + if (is_numeric($this->idlog)) { + $obj_logradouro = new clsPublicLogradouro(); + $lst_logradouro = $obj_logradouro->lista(NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + $this->idlog); + + if ($lst_logradouro) { + $registro = $lst_logradouro[0]; + } + + if ($registro) { + foreach($registro as $campo => $val) { + $this->$campo = $val; + } + + $retorno = 'Editar'; + } + } + + $this->url_cancelar = ($retorno == 'Editar') ? + 'public_logradouro_det.php?idlog=' . $registro['idlog'] : + 'public_logradouro_lst.php'; + + $this->nome_url_cancelar = 'Cancelar'; + + return $retorno; + } + + function Gerar() + { + // primary keys + $this->campoOculto('idlog', $this->idlog); + + // foreign keys + $opcoes = array('' => 'Selecione'); + if (class_exists('clsPais')) { + $objTemp = new clsPais(); + $lista = $objTemp->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['idpais']] = $registro['nome']; + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('idpais', 'Pais', $opcoes, $this->idpais); + + $opcoes = array('' => 'Selecione'); + if (class_exists('clsUf')) { + if ($this->idpais) { + $objTemp = new clsUf(); + $lista = $objTemp->lista(FALSE, FALSE, $this->idpais, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['sigla_uf']] = $registro['nome']; + } + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('sigla_uf', 'Estado', $opcoes, $this->sigla_uf); + + $opcoes = array('' => 'Selecione'); + if (class_exists('clsMunicipio')) { + if ($this->sigla_uf) { + $objTemp = new clsMunicipio(); + $lista = $objTemp->lista(FALSE, $this->sigla_uf, FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['idmun']] = $registro['nome']; + } + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('idmun', 'Município', $opcoes, $this->idmun); + + $opcoes = array('' => 'Selecione'); + if (class_exists('clsUrbanoTipoLogradouro')) { + $objTemp = new clsUrbanoTipoLogradouro(); + $objTemp->setOrderby('descricao ASC'); + $lista = $objTemp->lista(); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['idtlog']] = $registro['descricao']; + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('idtlog', 'Tipo de Logradouro', $opcoes, $this->idtlog); + + $this->campoTexto('nome', 'Nome', $this->nome, 30, 150, true); + } + + function Novo() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicLogradouro(NULL, $this->idtlog, $this->nome, $this->idmun, + NULL, 'S', NULL, NULL, 'U', $this->pessoa_logada, NULL, 'I', NULL, 9); + + $cadastrou = $obj->cadastra(); + if ($cadastrou) { + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: public_logradouro_lst.php'); + die(); + } + + $this->mensagem = 'Cadastro não realizado.
'; + echo ""; + + return FALSE; + } + + function Editar() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicLogradouro($this->idlog, $this->idtlog, $this->nome, + $this->idmun, NULL, 'S', $this->pessoa_logada, NULL, 'U', NULL, NULL, 'I', NULL, 9); + + $editou = $obj->edita(); + if ($editou) { + $this->mensagem .= 'Edição efetuada com sucesso.
'; + header('Location: public_logradouro_lst.php'); + die(); + } + + $this->mensagem = 'Edição não realizada.
'; + echo ""; + + return FALSE; + } + + function Excluir() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicLogradouro($this->idlog, $this->idtlog, $this->nome, + $this->idmun, NULL, 'S', $this->pessoa_logada); + + $excluiu = $obj->excluir(); + if ($excluiu) { + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + header('Location: public_logradouro_lst.php'); + die(); + } + + $this->mensagem = 'Exclusão não realizada.
'; + echo ''; + + return FALSE; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html + +// Atribui o conteúdo à  página +$pagina->addForm($miolo); + +// Gera o código HTML $pagina->MakeAll(); ?> - \ No newline at end of file diff --git a/ieducar/intranet/public_municipio_cad.php b/ieducar/intranet/public_municipio_cad.php index aec96de..36e0300 100755 --- a/ieducar/intranet/public_municipio_cad.php +++ b/ieducar/intranet/public_municipio_cad.php @@ -1,236 +1,239 @@ + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Prefeitura Municipal de Itajaí + * @license http://creativecommons.org/licenses/GPL/2.0/legalcode.pt CC GNU GPL + * @package Core + * @subpackage Enderecamento + * @subpackage Municipio + * @since Arquivo disponível desde a versão 1.0.0 + * @version $Id$ + */ + +require_once 'include/clsBase.inc.php'; +require_once 'include/clsCadastro.inc.php'; +require_once 'include/clsBanco.inc.php'; +require_once 'include/public/geral.inc.php'; class clsIndexBase extends clsBase { - function Formular() - { - $this->SetTitulo( "{$this->_instituicao} Município" ); - $this->processoAp = "755"; - } + function Formular() + { + $this->SetTitulo($this->_instituicao . ' Município'); + $this->processoAp = '755'; + } } class indice extends clsCadastro { - /** - * Referencia pega da session para o idpes do usuario atual - * - * @var int - */ - var $pessoa_logada; - - var $idmun; - var $nome; - var $sigla_uf; - var $area_km2; - var $idmreg; - var $idasmun; - var $cod_ibge; - var $geom; - var $tipo; - var $idmun_pai; - var $idpes_rev; - var $idpes_cad; - var $data_rev; - var $data_cad; - var $origem_gravacao; - var $operacao; - var $idsis_rev; - var $idsis_cad; - - var $idpais; - - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $this->idmun=$_GET["idmun"]; - - if( is_numeric( $this->idmun ) ) - { - $obj = new clsPublicMunicipio( $this->idmun ); - $registro = $obj->detalhe(); - if( $registro ) - { - foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto - $this->$campo = $val; - - $obj_uf = new clsUf( $this->sigla_uf ); - $det_uf = $obj_uf->detalhe(); - $this->idpais = $det_uf['idpais']->idpais; -// $this->fexcluir = true; - - $retorno = "Editar"; - } - } - $this->url_cancelar = ($retorno == "Editar") ? "public_municipio_det.php?idmun={$registro["idmun"]}" : "public_municipio_lst.php"; - $this->nome_url_cancelar = "Cancelar"; - return $retorno; - } - - function Gerar() - { - // primary keys - $this->campoOculto( "idmun", $this->idmun ); - - // foreign keys - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsPais" ) ) - { - $objTemp = new clsPais(); - $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['idpais']}"] = "{$registro['nome']}"; - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "idpais", "Pais", $opcoes, $this->idpais ); - - $opcoes = array( "" => "Selecione" ); - if( class_exists( "clsUf" ) ) - { - if( $this->idpais ) - { - $objTemp = new clsUf(); - $lista = $objTemp->lista( false, false, $this->idpais, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) - { - foreach ( $lista as $registro ) - { - $opcoes["{$registro['sigla_uf']}"] = "{$registro['nome']}"; - } - } - } - } - else - { - echo ""; - $opcoes = array( "" => "Erro na geracao" ); - } - $this->campoLista( "sigla_uf", "Estado", $opcoes, $this->sigla_uf ); - - - // text - $this->campoTexto( "nome", "Nome", $this->nome, 30, 60, true ); -// $this->campoNumero( "area_km2", "Area Km2", $this->area_km2, 6, 6, false ); - } - - function Novo() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - - $obj = new clsPublicMunicipio( null, $this->nome, $this->sigla_uf, null, null, null, null, null, 'M', null, null, $this->pessoa_logada, null, null, 'U', 'I', null, 9 ); - $cadastrou = $obj->cadastra(); - if( $cadastrou ) - { - $this->mensagem .= "Cadastro efetuado com sucesso.
"; - header( "Location: public_municipio_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Cadastro não realizado.
"; - echo ""; - return false; - } - - function Editar() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicMunicipio( $this->idmun, $this->nome, $this->sigla_uf, null, null, null, null, null, 'M', null, $this->pessoa_logada, null, null, null, 'U', 'I', null, 9 ); - $editou = $obj->edita(); - if( $editou ) - { - $this->mensagem .= "Edição efetuada com sucesso.
"; - header( "Location: public_municipio_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Edição não realizada.
"; - echo ""; - return false; - } - - function Excluir() - { - @session_start(); - $this->pessoa_logada = $_SESSION['id_pessoa']; - @session_write_close(); - - $obj = new clsPublicMunicipio( $this->idmun, null, null, null, null, null, null, null, null, null, $this->pessoa_logada ); - $excluiu = $obj->excluir(); - if( $excluiu ) - { - $this->mensagem .= "Exclusão efetuada com sucesso.
"; - header( "Location: public_municipio_lst.php" ); - die(); - return true; - } - - $this->mensagem = "Exclusão não realizada.
"; - echo ""; - return false; - } + /** + * Referência a usuário da sessão. + * @var int + */ + var $pessoa_logada; + + var $idmun; + var $nome; + var $sigla_uf; + var $area_km2; + var $idmreg; + var $idasmun; + var $cod_ibge; + var $geom; + var $tipo; + var $idmun_pai; + var $idpes_rev; + var $idpes_cad; + var $data_rev; + var $data_cad; + var $origem_gravacao; + var $operacao; + var $idsis_rev; + var $idsis_cad; + + var $idpais; + + function Inicializar() + { + $retorno = 'Novo'; + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $this->idmun = $_GET['idmun']; + + if (is_numeric($this->idmun)) { + $obj = new clsPublicMunicipio( $this->idmun ); + $registro = $obj->detalhe(); + + if ($registro) { + foreach ($registro as $campo => $val) { + $this->$campo = $val; + } + + $obj_uf = new clsUf( $this->sigla_uf ); + $det_uf = $obj_uf->detalhe(); + $this->idpais = $det_uf['idpais']->idpais; + + $retorno = 'Editar'; + } + } + $this->url_cancelar = ($retorno == 'Editar') ? + 'public_municipio_det.php?idmun=' . $registro['idmun'] : + 'public_municipio_lst.php'; + $this->nome_url_cancelar = 'Cancelar'; + + return $retorno; + } + + function Gerar() + { + // primary keys + $this->campoOculto('idmun', $this->idmun); + + // foreign keys + $opcoes = array('' => 'Selecione'); + if (class_exists('clsPais')) { + $objTemp = new clsPais(); + $lista = $objTemp->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'nome ASC'); + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['idpais']] = $registro['nome']; + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('idpais', 'Pais', $opcoes, $this->idpais); + + $opcoes = array('' => 'Selecione'); + if (class_exists('clsUf')) { + if ($this->idpais) { + $objTemp = new clsUf(); + $lista = $objTemp->lista(FALSE, FALSE, $this->idpais, FALSE, FALSE, 'nome ASC'); + + if (is_array($lista) && count($lista)) { + foreach ($lista as $registro) { + $opcoes[$registro['sigla_uf']] = $registro['nome']; + } + } + } + } + else { + echo ''; + $opcoes = array('' => 'Erro na geracao'); + } + $this->campoLista('sigla_uf', 'Estado', $opcoes, $this->sigla_uf); + + // text + $this->campoTexto('nome', 'Nome', $this->nome, 30, 60, TRUE); + } + + function Novo() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicMunicipio(NULL, $this->nome, $this->sigla_uf, NULL, NULL, + NULL, NULL, NULL, 'M', NULL, NULL, $this->pessoa_logada, NULL, NULL, 'U', + 'I', NULL, 9); + + $cadastrou = $obj->cadastra(); + if ($cadastrou) { + $this->mensagem .= 'Cadastro efetuado com sucesso.
'; + header('Location: public_municipio_lst.php'); + die(); + } + + $this->mensagem = 'Cadastro não realizado.
'; + echo ""; + return FALSE; + } + + function Editar() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicMunicipio($this->idmun, $this->nome, $this->sigla_uf, + NULL, NULL, NULL, NULL, NULL, 'M', NULL, $this->pessoa_logada, NULL, NULL, + NULL, 'U', 'I', NULL, 9 ); + + $editou = $obj->edita(); + + if ($editou) { + $this->mensagem .= "Edição efetuada com sucesso.
"; + header('Location: public_municipio_lst.php'); + die(); + } + + $this->mensagem = "Edição não realizada.
"; + echo ""; + + return FALSE; + } + + function Excluir() + { + session_start(); + $this->pessoa_logada = $_SESSION['id_pessoa']; + session_write_close(); + + $obj = new clsPublicMunicipio($this->idmun, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, $this->pessoa_logada); + $excluiu = $obj->excluir(); + + if ($excluiu) { + $this->mensagem .= 'Exclusão efetuada com sucesso.
'; + header('Location: public_municipio_lst.php'); + die(); + } + + $this->mensagem = 'Exclusão não realizada.
'; + echo ""; + + return FALSE; + } } -// cria uma extensao da classe base +// Instancia objeto de página $pagina = new clsIndexBase(); -// cria o conteudo + +// Instancia objeto de conteúdo $miolo = new indice(); -// adiciona o conteudo na clsBase -$pagina->addForm( $miolo ); -// gera o html + +// Atribui o conteúdo à  página +$pagina->addForm($miolo); + +// Gera o código HTML $pagina->MakeAll(); ?> + \ No newline at end of file -- libgit2 0.21.2