function Editar()
 {
     @session_start();
     $this->id_pessoa = @$_SESSION['id_pessoa'];
     session_write_close();
     $this->todos_moderadores = unserialize(urldecode($this->todos_moderadores));
     if (!empty($this->todos_moderadores)) {
         $objGrupoModerador = new clsGrupoModerador(false, $this->cod_grupos, false, $this->id_pessoa, 2);
         $objGrupoModerador->excluiTodos();
         $objGrupos = new clsGrupos($this->cod_grupos, $this->id_pessoa, false, $this->nm_grupo, 1);
         if ($objGrupos->edita()) {
             foreach ($this->todos_moderadores as $id => $moderador) {
                 $objGrupoModeradorVerificacao = new clsGrupoModerador($moderador, $this->cod_grupos);
                 if ($objGrupoModeradorVerificacao->detalhe()) {
                     $objGrupoPessoa = new clsGrupoPessoa($moderador, $this->cod_grupos, false, $this->id_pessoa);
                     if ($objGrupoPessoa->detalhe()) {
                         $objGrupoPessoa->exclui();
                     } else {
                         $obj = new clsGrupoPessoa($moderador, $this->cod_grupos, $this->id_pessoa, false, $this->cod_grupos, false, 2);
                         $obj->cadastra();
                     }
                     $objGrupoModerador = new clsGrupoModerador($moderador, $this->cod_grupos, $this->id_pessoa, false, 1);
                     $objGrupoModerador->edita();
                 } else {
                     $objGrupoPessoa = new clsGrupoPessoa($moderador, $this->cod_grupos, false, $this->id_pessoa);
                     if ($objGrupoPessoa->detalhe()) {
                         $objGrupoPessoa->exclui();
                     } else {
                         $obj = new clsGrupoPessoa($moderador, $this->cod_grupos, $this->id_pessoa, false, $this->cod_grupos, false, 2);
                         $obj->cadastra();
                     }
                     $objGrupoModerador = new clsGrupoModerador($moderador, $this->cod_grupos, $this->id_pessoa, false, 1);
                     $objGrupoModerador->cadastra();
                 }
             }
             header("Location: otopic_grupos_lst.php");
         }
     }
     $this->mensagem = "Favor Selecionar ao menos um Moderador.";
     return false;
 }
 function Editar()
 {
     @session_start();
     $pessoaFj = $_SESSION['id_pessoa'];
     session_write_close();
     $obj = new clsGrupoModerador($this->cod_pessoa_fj, $this->cod_grupo);
     $detalhe = $obj->detalhe();
     if ($detalhe && $detalhe['ativo'] == 1) {
         header("Location: otopic_meus_grupos_det.php?cod_grupo={$this->cod_grupo}");
     }
     $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->p_nm_pessoa, false, $this->http, false, $pessoaFj, date("Y-m-d H:i:s", time()), $this->email);
     $objPessoa->edita();
     $objFisica = new clsFisica($this->cod_pessoa_fj, false, $this->sexo);
     $objFisica->edita();
     $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1, $this->telefone_1, $this->ddd_telefone_1);
     $objTelefone->cadastra();
     $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2, $this->telefone_2, $this->ddd_telefone_2);
     $objTelefone->cadastra();
     $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3, $this->telefone_mov, $this->ddd_telefone_mov);
     $objTelefone->cadastra();
     $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4, $this->telefone_fax, $this->ddd_telefone_fax);
     $objTelefone->cadastra();
     if ($this->cep && $this->idbai && $this->idlog) {
         $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj);
         $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep, $this->idlog, $this->idbai, $this->numero, $this->complemento, false, $this->letra, $this->bloco, $this->apartamento, $this->andar);
         if ($objEndereco->detalhe()) {
             $objEndereco2->edita();
         } else {
             $objEndereco2->cadastra();
         }
     } else {
         $this->cep_ = idFederal2int($this->cep_);
         $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj);
         $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, "1", $this->idtlog, $this->logradouro, $this->numero, $this->letra, $this->complemento, $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, false, $this->bloco, $this->apartamento, $this->andar);
         if ($objEnderecoExterno->detalhe()) {
             $objEnderecoExterno2->edita();
         } else {
             $objEnderecoExterno2->cadastra();
         }
     }
     $obj = new clsGrupoPessoa($this->cod_pessoa_fj, $this->cod_grupo);
     if (!$obj->detalhe()) {
         $obj = new clsGrupoPessoa($this->cod_pessoa_fj, $this->cod_grupo, $pessoaFj, false, $this->cod_grupo);
         if ($obj->cadastra()) {
             header("Location: otopic_meus_grupos_det.php?cod_grupo={$this->cod_grupo}");
         }
     } else {
         $obj = new clsGrupoPessoa($this->cod_pessoa_fj, $this->cod_grupo, $pessoaFj, false, $this->cod_grupo, false, 1);
         if ($obj->edita()) {
             header("Location: otopic_meus_grupos_det.php?cod_grupo={$this->cod_grupo}");
         }
     }
     return true;
 }