SetTitulo( "{$this->_instituicao} Uf" ); $this->processoAp = "754"; $this->addEstilo('localizacaoSistema'); } } class indice extends clsCadastro { /** * Referencia pega da session para o idpes do usuario atual * * @var int */ var $pessoa_logada; var $sigla_uf; var $nome; var $geom; var $idpais; function Inicializar() { $retorno = "Novo"; @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $this->sigla_uf=$_GET["sigla_uf"]; if( is_string( $this->sigla_uf ) ) { $obj = new clsPublicUf( $this->sigla_uf ); $registro = $obj->detalhe(); 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_uf_det.php?sigla_uf={$registro["sigla_uf"]}" : "public_uf_lst.php"; $this->nome_url_cancelar = "Cancelar"; $nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar"; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos( array( $_SERVER['SERVER_NAME']."/intranet" => "Início", "" => "{$nomeMenu} UF" )); $this->enviaLocalizacao($localizacao->montar()); return $retorno; } function Gerar() { // 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 ); // text $this->campoTexto( "sigla_uf", "Sigla Uf", $this->sigla_uf, 2, 2, true ); $this->campoTexto( "nome", "Nome", $this->nome, 30, 30, true ); // $this->campoTexto( "geom", "Geom", $this->geom, 30, 255, false ); } function Novo() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj = new clsPublicUf( $this->sigla_uf, $this->nome, $this->geom, $this->idpais ); $cadastrou = $obj->cadastra(); if( $cadastrou ) { $this->mensagem .= "Cadastro efetuado com sucesso.
"; header( "Location: public_uf_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 clsPublicUf( $this->sigla_uf, $this->nome, $this->geom, $this->idpais ); $editou = $obj->edita(); if( $editou ) { $this->mensagem .= "Edição efetuada com sucesso.
"; header( "Location: public_uf_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 clsPublicUf( $this->sigla_uf ); $excluiu = $obj->excluir(); if( $excluiu ) { $this->mensagem .= "Exclusão efetuada com sucesso.
"; header( "Location: public_uf_lst.php" ); die(); return true; } $this->mensagem = "Exclusão não realizada.
"; echo ""; return false; } } // cria uma extensao da classe base $pagina = new clsIndexBase(); // cria o conteudo $miolo = new indice(); // adiciona o conteudo na clsBase $pagina->addForm( $miolo ); // gera o html $pagina->MakeAll(); ?>