function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Cep Logradouro - Detalhe"; $this->idlog = $_GET["idlog"]; $obj_cep_logradouro = new clsUrbanoCepLogradouro(); $lst_cep_logradouro = $obj_cep_logradouro->lista(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $this->idlog); if (!$lst_cep_logradouro) { header("location: urbano_cep_logradouro_lst.php"); die; } else { $registro = $lst_cep_logradouro[0]; } if ($registro["nm_pais"]) { $this->addDetalhe(array("Pais", "{$registro["nm_pais"]}")); } if ($registro["nm_estado"]) { $this->addDetalhe(array("Estado", "{$registro["nm_estado"]}")); } if ($registro["nm_municipio"]) { $this->addDetalhe(array("Município", "{$registro["nm_municipio"]}")); } if ($registro["nm_logradouro"]) { $this->addDetalhe(array("Logradouro", "{$registro["nm_logradouro"]}")); } $obj_cep_log_bairro = new clsUrbanoCepLogradouroBairro(); $lst_cep_log_bairro = $obj_cep_log_bairro->lista(null, null, null, null, null, null, null, null, null, null, null, null, null, $this->idlog); if ($lst_cep_log_bairro) { $tab_endereco = "<TABLE>\n\t\t\t\t\t <TR align=center>\n\t\t\t\t\t <TD bgcolor=#A1B3BD><B>CEP</B></TD>\n\t\t\t\t\t <TD bgcolor=#A1B3BD><B>Bairro</B></TD>\n\t\t\t\t\t </TR>"; $cont = 0; foreach ($lst_cep_log_bairro as $endereco) { if ($cont % 2 == 0) { $color = " bgcolor=#E4E9ED "; } else { $color = " bgcolor=#FFFFFF "; } $obj_bairro = new clsPublicBairro(null, null, $endereco['idbai']); $det_bairro = $obj_bairro->detalhe(); $endereco['cep'] = int2CEP($endereco['cep']); $tab_endereco .= "<TR>\n\t\t\t\t\t\t\t\t\t<TD {$color} align=center>{$endereco['cep']}</TD>\n\t\t\t\t\t\t\t\t\t<TD {$color} align=center>{$det_bairro['nome']}</TD>\n\t\t\t\t\t\t\t\t</TR>"; $cont++; } $tab_endereco .= "</TABLE>"; } if ($tab_endereco) { $this->addDetalhe(array("Tabela de CEP-Bairro", "{$tab_endereco}")); } $this->url_novo = "urbano_cep_logradouro_cad.php"; $this->url_editar = "urbano_cep_logradouro_cad.php?cep={$registro["cep"]}&idlog={$registro["idlog"]}"; $this->url_cancelar = "urbano_cep_logradouro_lst.php"; $this->largura = "100%"; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "" => "Detalhe do CEP")); $this->enviaLocalizacao($localizacao->montar()); }
function Excluir() { session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $obj = new clsUrbanoCepLogradouro($this->cep, $this->idlog, $this->nroini, $this->nrofin, $this->idpes_rev, $this->data_rev, $this->origem_gravacao, $this->idpes_cad, $this->data_cad, $this->operacao, $this->idsis_rev, $this->idsis_cad); $excluiu = $obj->excluir(); if ($excluiu) { $this->mensagem .= 'Exclusão efetuada com sucesso.<br>'; header('Location: urbano_cep_logradouro_lst.php'); die; } $this->mensagem = 'Exclusão não realizada.<br>'; echo "<!--\nErro ao excluir clsUrbanoCepLogradouro\nvalores obrigatorios\nif( is_numeric( {$this->cep} ) && is_numeric( {$this->idlog} ) )\n-->"; return FALSE; }
function Gerar() { @session_start(); $this->__pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->__titulo = "Cep Logradouro - Listagem"; foreach ($_GET as $var => $val) { // passa todos os valores obtidos no GET para atributos do objeto $this->{$var} = $val === "" ? null : $val; } $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet"); $this->addCabecalhos(array("Logradouro", "Município", "Estado", "Pais")); $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 "<!--\nErro\nClasse clsPais nao encontrada\n-->"; $opcoes = array("" => "Erro na geracao"); } $this->campoLista("idpais", "Pais", $opcoes, $this->idpais, "", false, "", "", false, false); $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 "<!--\nErro\nClasse clsUf nao encontrada\n-->"; $opcoes = array("" => "Erro na geracao"); } $this->campoLista("sigla_uf", "Estado", $opcoes, $this->sigla_uf, "", false, "", "", false, false); $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 "<!--\nErro\nClasse clsMunicipio nao encontrada\n-->"; $opcoes = array("" => "Erro na geracao"); } $this->campoLista("idmun", "Município", $opcoes, $this->idmun, "", false, "", "", false, false); $opcoes = array("" => "Selecione"); if (class_exists("clsLogradouro")) { if ($this->idmun) { $objTemp = new clsLogradouro(); $lista = $objTemp->lista(false, false, $this->idmun, false, false, false, false, "nome ASC"); if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $opcoes["{$registro['idlog']}"] = "{$registro['nome']}"; } } } } else { echo "<!--\nErro\nClasse clsLogradouro nao encontrada\n-->"; $opcoes = array("" => "Erro na geracao"); } $this->campoLista("idlog", "Logradouro", $opcoes, $this->idlog, "", false, "", "", false, false); // Paginador $this->__limite = 20; $this->__offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->__limite - $this->__limite : 0; $obj_cep_logradouro = new clsUrbanoCepLogradouro(); $obj_cep_logradouro->setOrderby("nm_logradouro ASC"); $obj_cep_logradouro->setLimite($this->__limite, $this->__offset); $lista = $obj_cep_logradouro->lista_(null, null, null, null, null, null, null, null, null, null, null, null, $this->idpais, $this->sigla_uf, $this->idmun, $this->idlog); $total = $obj_cep_logradouro->_total; // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $this->addLinhas(array("<a href=\"urbano_cep_logradouro_det.php?idlog={$registro["idlog"]}\">{$registro["nm_logradouro"]}</a>", "<a href=\"urbano_cep_logradouro_det.php?idlog={$registro["idlog"]}\">{$registro["nm_municipio"]}</a>", "<a href=\"urbano_cep_logradouro_det.php?idlog={$registro["idlog"]}\">{$registro["nm_estado"]}</a>", "<a href=\"urbano_cep_logradouro_det.php?idlog={$registro["idlog"]}\">{$registro["nm_pais"]}</a>")); } } $this->addPaginador2("urbano_cep_logradouro_lst.php", $total, $_GET, $this->nome, $this->__limite); $this->acao = "go(\"urbano_cep_logradouro_cad.php\")"; $this->nome_acao = "Novo"; $this->largura = "100%"; }