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'; $nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar"; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "" => "{$nomeMenu} bairro")); $this->enviaLocalizacao($localizacao->montar()); return $retorno; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = 'Bairro - Detalhe'; $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->idbai = $_GET['idbai']; $tmp_obj = new clsPublicBairro(); $lst_bairro = $tmp_obj->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->idbai); if (!$lst_bairro) { header('Location: public_bairro_lst.php'); die; } else { $registro = $lst_bairro[0]; } if ($registro['nome']) { $this->addDetalhe(array('Nome', $registro['nome'])); } $zona = App_Model_ZonaLocalizacao::getInstance(); $zona = $zona->getValue($registro['zona_localizacao']); $this->addDetalhe(array('Zona Localização', $zona)); if ($registro['nm_municipio']) { $this->addDetalhe(array("Município", $registro['nm_municipio'])); } if ($registro['nm_estado']) { $this->addDetalhe(array('Estado', $registro['nm_estado'])); } if ($registro['nm_pais']) { $this->addDetalhe(array('Pais', $registro['nm_pais'])); } $this->url_novo = 'public_bairro_cad.php'; $this->url_editar = 'public_bairro_cad.php?idbai=' . $registro['idbai']; $this->url_cancelar = 'public_bairro_lst.php'; $this->largura = '100%'; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "" => "Detalhe do bairro")); $this->enviaLocalizacao($localizacao->montar()); }
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() { @session_start(); $this->__pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->__titulo = 'Bairro - Listagem'; // Passa todos os valores obtidos no GET para atributos do objeto foreach ($_GET as $var => $val) { $this->{$var} = $val === '' ? NULL : $val; } $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); $this->addCabecalhos(array('Nome', 'Zona Localização', 'Município', 'Estado', 'Pais')); // Filtros de 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 "<!--\nErro\nClasse clsPais nao encontrada\n-->"; $opcoes = array('' => 'Erro na geração'); } $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 geração'); } $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 geração'); } $this->campoLista('idmun', 'Município', $opcoes, $this->idmun, '', FALSE, '', '', FALSE, FALSE); // Outros filtros $this->campoTexto('nome', 'Nome', $this->nome, 30, 255, FALSE); // Paginador $this->__limite = 20; $this->__offset = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $this->__limite - $this->__limite : 0; $obj_bairro = new clsPublicBairro(); $obj_bairro->setOrderby('nome ASC'); $obj_bairro->setLimite($this->__limite, $this->__offset); $lista = $obj_bairro->lista($this->idmun, NULL, $this->nome, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this->idpais, $this->sigla_uf); $total = $obj_bairro->_total; // Zona Localização. $zona = App_Model_ZonaLocalizacao::getInstance(); // UrlHelper. $url = CoreExt_View_Helper_UrlHelper::getInstance(); $options = array('query' => array('idbai' => NULL)); // Monta a lista. if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $zl = $zona->getValue($registro['zona_localizacao']); $options['query']['idbai'] = $registro['idbai']; $this->addLinhas(array($url->l($registro['nome'], 'public_bairro_det.php', $options), $url->l($zl, 'public_bairro_det.php', $options), $url->l($registro['nm_municipio'], 'public_bairro_det.php', $options), $url->l($registro['nm_estado'], 'public_bairro_det.php', $options), $url->l($registro['nm_pais'], 'public_bairro_det.php', $options))); } } $this->addPaginador2('public_bairro_lst.php', $total, $_GET, $this->nome, $this->__limite); $this->acao = 'go("public_bairro_cad.php")'; $this->nome_acao = 'Novo'; $this->largura = '100%'; }