function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Telefones - Detalhe";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->cod_telefones = $_GET["cod_telefones"];
     $tmp_obj = new clsPmicontrolesisTelefones($this->cod_telefones);
     $registro = $tmp_obj->detalhe();
     if (!$registro) {
         header("location: controlesis_telefones_lst.php");
         die;
     }
     if ($registro["nome"]) {
         $this->addDetalhe(array("Nome", "{$registro["nome"]}"));
     }
     if ($registro["numero"]) {
         $this->addDetalhe(array("Numero", "{$registro["numero"]}"));
     }
     $this->url_novo = "controlesis_telefones_cad.php";
     $this->url_editar = "controlesis_telefones_cad.php?cod_telefones={$registro["cod_telefones"]}";
     $this->url_cancelar = "controlesis_telefones_lst.php";
     $this->largura = "100%";
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->titulo = "Telefones - 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("Nome", "Numero"));
     // Filtros de Foreign Keys
     // outros Filtros
     $this->campoTexto("nome", "Nome", $this->nome, 30, 255, false);
     $this->campoNumero("numero", "Numero", $this->numero, 15, 255, false);
     // Paginador
     $this->limite = 20;
     $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0;
     $obj_telefones = new clsPmicontrolesisTelefones();
     $obj_telefones->setOrderby("nome ASC");
     $obj_telefones->setLimite($this->limite, $this->offset);
     $lista = $obj_telefones->lista($this->cod_telefones, null, null, $this->nome, $this->numero, null, null, 1);
     $total = $obj_telefones->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             // muda os campos data
             $registro["data_cadastro_time"] = strtotime(substr($registro["data_cadastro"], 0, 16));
             $registro["data_cadastro_br"] = date("d/m/Y H:i", $registro["data_cadastro_time"]);
             $registro["data_exclusao_time"] = strtotime(substr($registro["data_exclusao"], 0, 16));
             $registro["data_exclusao_br"] = date("d/m/Y H:i", $registro["data_exclusao_time"]);
             // pega detalhes de foreign_keys
             $this->addLinhas(array("<a href=\"controlesis_telefones_det.php?cod_telefones={$registro["cod_telefones"]}\">{$registro["nome"]}</a>", "<a href=\"controlesis_telefones_det.php?cod_telefones={$registro["cod_telefones"]}\">{$registro["numero"]}</a>"));
         }
     }
     $this->addPaginador2("controlesis_telefones_lst.php", $total, $_GET, $this->nome, $this->limite);
     $this->acao = "go(\"controlesis_telefones_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
 }
 function Excluir()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     $obj = new clsPmicontrolesisTelefones($this->cod_telefones, null, $this->pessoa_logada, $this->nome, $this->numero, null, null, 0);
     $excluiu = $obj->excluir();
     if ($excluiu) {
         $this->mensagem .= "Exclus&atilde;o efetuada com sucesso.<br>";
         header("Location: controlesis_telefones_lst.php");
         die;
         return true;
     }
     $this->mensagem = "Exclus&atilde;o n&atilde;o realizada.<br>";
     echo "<!--\nErro ao excluir clsPmicontrolesisTelefones\nvalores obrigatorios\nif( is_numeric( {$this->cod_telefones} ) && is_numeric( {$this->ref_funcionario_exc} ) )\n-->";
     return false;
 }