function Gerar() { foreach ($_GET as $campo => $valor) { $this->{$campo} = $valor; } @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; $_SESSION["campo1"] = $_GET["campo1"] ? $_GET["campo1"] : $_SESSION["campo1"]; $_SESSION["campo2"] = $_GET["campo2"] ? $_GET["campo2"] : $_SESSION["campo2"]; $this->ref_cod_biblioteca = $this->ref_cod_biblioteca ? $this->ref_cod_biblioteca : $_GET['ref_cod_biblioteca']; session_write_close(); $this->titulo = "Cliente - Listagem"; /*foreach( $_SESSION AS $var => $val ) // passa todos os valores obtidos no SESSION para atributos do objeto $this->$var = ( $val === "" ) ? null: $val; foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto $this->$var = ( $val === "" ) ? null: $val;*/ $this->addCabecalhos(array("Login", "Cliente")); $this->campoTexto("nm_cliente", "Cliente", $this->nm_cliente, 30, 255, false); $this->campoNumero("login", "Login", $this->login, 9, 9); $this->campoOculto("ref_cod_biblioteca", $this->ref_cod_biblioteca); if (isset($_GET["ref_cod_biblioteca"])) { $this->ref_cod_biblioteca = $_GET["ref_cod_biblioteca"]; } // Paginador $this->limite = 20; $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0; $obj_acervo = new clsPmieducarCliente(); $obj_acervo->setOrderby("nome ASC"); $obj_acervo->setLimite($this->limite, $this->offset); if ($this->ref_cod_biblioteca) { $lista = $obj_acervo->listaPesquisaCliente(null, null, null, null, $this->login, null, null, null, null, null, 1, $this->nm_cliente, $this->ref_cod_biblioteca); } else { $lista = $obj_acervo->lista(null, null, null, null, $this->login, null, null, null, null, null, 1, $this->nm_cliente); } $total = $obj_acervo->_total; // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { if (is_string($_SESSION['campo1']) && is_string($_SESSION['campo2'])) { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_cliente']}', '{$registro['nome']}'); addVal1('{$_SESSION['campo2']}','{$registro['nome']}', '{$registro['cod_cliente']}'); fecha();\""; } else { if (is_string($_SESSION['campo1'])) { $script = " onclick=\"addVal1('{$_SESSION['campo1']}','{$registro['cod_cliente']}', '{$registro['nome']}'); fecha();\""; } } $this->addLinhas(array("<a href=\"javascript:void(0);\" {$script}>{$registro["login"]}</a>", "<a href=\"javascript:void(0);\" {$script}>{$registro["nome"]}</a>")); } } $this->addPaginador2("educar_pesquisa_cliente_lst.php", $total, $_GET, $this->nome, $this->limite); $this->largura = "100%"; }