function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Acesso - Detalhe"; $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet"); $this->cod_acesso = $_GET["cod_acesso"]; $tmp_obj = new clsPortalAcesso($this->cod_acesso); $registro = $tmp_obj->detalhe(); if (!$registro) { header("location: portal_acesso_lst.php"); die; } if ($registro["cod_acesso"]) { $this->addDetalhe(array("Acesso", "{$registro["cod_acesso"]}")); } if ($registro["data_hora"]) { $this->addDetalhe(array("Data Hora", dataFromPgToBr($registro["data_hora"], "d/m/Y H:i"))); } if ($registro["ip_externo"]) { $this->addDetalhe(array("Ip Externo", "{$registro["ip_externo"]}")); } if ($registro["ip_interno"]) { $this->addDetalhe(array("Ip Interno", "{$registro["ip_interno"]}")); } if ($registro["cod_pessoa"]) { $this->addDetalhe(array("Pessoa", "{$registro["cod_pessoa"]}")); } if ($registro["obs"]) { $this->addDetalhe(array("Obs", "{$registro["obs"]}")); } if (!is_null($registro["sucesso"])) { $this->addDetalhe(array("Sucesso", dbBool($registro["sucesso"]) ? "Sim" : "Não")); } $this->url_novo = "portal_acesso_cad.php"; $this->url_editar = "portal_acesso_cad.php?cod_acesso={$registro["cod_acesso"]}"; $this->url_cancelar = "portal_acesso_lst.php"; $this->largura = "100%"; }
function Excluir() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; @session_write_close(); $obj = new clsPortalAcesso($this->cod_acesso, $this->data_hora, $this->ip_externo, $this->ip_interno, $this->cod_pessoa, $this->obs, $this->sucesso); $excluiu = $obj->excluir(); if ($excluiu) { $this->mensagem .= "Exclusão efetuada com sucesso.<br>"; header("Location: portal_acesso_lst.php"); die; return true; } $this->mensagem = "Exclusão não realizada.<br>"; echo "<!--\nErro ao excluir clsPortalAcesso\nvalores obrigatorios\nif( is_numeric( {$this->cod_acesso} ) )\n-->"; return false; }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); if (is_numeric($_GET["cod_pessoa_libera"])) { $obj_acesso = new clsPortalAcesso(); $obj_acesso->setCamposLista("cod_acesso"); $obj_acesso->setLimite(1); $obj_acesso->setOrderby("data_hora DESC"); $lista = $obj_acesso->lista(null, null, null, null, $_GET["cod_pessoa_libera"], null, 'f'); if ($lista) { foreach ($lista as $cod_acesso) { $obj_acesso = new clsPortalAcesso($cod_acesso, null, null, null, null, null, 't'); if ($obj_acesso->edita()) { $this->mensagem = "Alteração realizada com sucesso"; } } } } $this->titulo = "Acesso - Listagem"; foreach ($_GET as $var => $val) { // passa todos os valores obtidos no GET para atributos do objeto $this->{$var} = $val === "" ? null : $val; } $this->addCabecalhos(array("Cod. Pessoa", "Nome Pessoa", "Falhas", "Ultimo Sucesso", "Quinto Erro")); // Filtros de Foreign Keys // outros Filtros $this->campoData("ultimo_sucesso_ini", "Data minima do ultimo sucesso", $this->ultimo_sucesso_ini, false); $this->campoData("ultimo_sucesso_fim", "Data maxima do ultimo sucesso", $this->ultimo_sucesso_fim, false); $this->campoData("quinto_erro_ini", "Data minima do quinto erro", $this->quinto_erro_ini, false); $this->campoData("quinto_erro_fim", "Data maxima do quinto erro", $this->quinto_erro_fim, false); $this->campoNumero("cod_pessoa", "Pessoa", $this->cod_pessoa, 15, 255, false); // Paginador $this->limite = 20; $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0; $obj_acesso = new clsPortalAcesso(); $obj_acesso->setOrderby("falha DESC"); $obj_acesso->setLimite($this->limite, $this->offset); $lista = $obj_acesso->lista_falhas($this->cod_pessoa, $this->min_quantidade_falhas, $this->max_quantidade_falhas, $this->ultimo_sucesso_ini, $this->ultimo_sucesso_fim, $this->quinto_erro_ini, $this->quinto_erro_fim); $total = $obj_acesso->_total; // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { // muda os campos data $registro["ultimo_sucesso_time"] = strtotime(substr($registro["ultimo_sucesso"], 0, 16)); $registro["ultimo_sucesso_br"] = date("d/m/Y H:i", $registro["ultimo_sucesso_time"]); $registro["quinto_erro_time"] = strtotime(substr($registro["quinto_erro"], 0, 16)); $registro["quinto_erro_br"] = date("d/m/Y H:i", $registro["quinto_erro_time"]); // pega detalhes de foreign_keys $pessoa = new clsPessoa_($registro["cod_pessoa"]); $det_pessoa = $pessoa->detalhe(); $registro["nome"] = $det_pessoa["nome"]; $this->addLinhas(array("<a href=\"portal_acesso_lst.php?cod_pessoa_libera={$registro["cod_pessoa"]}\">{$registro["cod_pessoa"]}</a>", "<a href=\"portal_acesso_lst.php?cod_pessoa_libera={$registro["cod_pessoa"]}\">{$registro["nome"]}</a>", "<a href=\"portal_acesso_lst.php?cod_pessoa_libera={$registro["cod_pessoa"]}\">{$registro["falha"]}</a>", "<a href=\"portal_acesso_lst.php?cod_pessoa_libera={$registro["cod_pessoa"]}\">{$registro["ultimo_sucesso_br"]}</a>", "<a href=\"portal_acesso_lst.php?cod_pessoa_libera={$registro["cod_pessoa"]}\">{$registro["quinto_erro_br"]}</a>")); } } $this->addPaginador2("portal_acesso_lst.php", $total, $_GET, $this->nome, $this->limite); $this->acao = "go(\"portal_acesso_cad.php\")"; $this->nome_acao = "Novo"; $this->largura = "100%"; }