Beispiel #1
0
 function Gerar()
 {
     @session_start();
     $this->__pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->__titulo = "Uf - 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("Nome", "Sigla Uf", "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 geracao");
     }
     $this->campoLista("idpais", "Pais", $opcoes, $this->idpais, "", false, "", "", false, false);
     // outros Filtros
     $this->campoTexto("sigla_uf", "Sigla Uf", $this->sigla_uf, 2, 2, false);
     $this->campoTexto("nome", "Nome", $this->nome, 30, 30, false);
     // Paginador
     $this->__limite = 20;
     $this->__offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->__limite - $this->__limite : 0;
     $obj_uf = new clsPublicUf();
     $obj_uf->setOrderby("nome ASC");
     $obj_uf->setLimite($this->__limite, $this->__offset);
     $lista = $obj_uf->lista($this->nome, $this->geom, $this->idpais);
     $total = $obj_uf->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             $this->addLinhas(array("<a href=\"public_uf_det.php?sigla_uf={$registro["sigla_uf"]}\">{$registro["nome"]}</a>", "<a href=\"public_uf_det.php?sigla_uf={$registro["sigla_uf"]}\">{$registro["sigla_uf"]}</a>", "<a href=\"public_uf_det.php?sigla_uf={$registro["sigla_uf"]}\">{$registro["nm_pais"]}</a>"));
         }
     }
     $this->addPaginador2("public_uf_lst.php", $total, $_GET, $this->nome, $this->__limite);
     $this->acao = "go(\"public_uf_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
 }