Exemplo n.º 1
0
 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;
 }