public function excluir()
 {
     $listar = UtilObjeto::listar("noticiasimagem", "where id_noticia = " . $this->id);
     if (is_array($listar)) {
         foreach ($listar as $id => $dados) {
             $objImagem = new NoticiasImagem();
             $objImagem->id = $id;
             $objImagem->carregar();
             if ($objImagem->excluir()) {
                 if (parent::excluir()) {
                     @unlink(PATHUPLOAD . 'noticias/' . $objImagem->imagem);
                 }
             }
         }
     }
     $this->carregar();
     if (parent::excluir()) {
         UtilObjeto::limpar("noticiastag", "where id_noticia = " . $this->id);
     }
     return true;
 }
$nomeClasseG = "Cliente";
$nomeClasse = strtolower($nomeClasseG);
##########################
# carregar
##########################
if (isPost($idP)) {
    $obj = new $nomeClasseG();
    $obj->id = $_REQUEST['id'];
    $obj->carregar();
}
##########################
# cadastrar
##########################
if (isPost($_POST['ok'])) {
    $erro = false;
    UtilObjeto::limpar("clientefaz", "WHERE id_cliente = " . $idP);
    if (isPost($_POST['faz']) && is_array($_POST['faz'])) {
        foreach ($_POST['faz'] as $idPostCat) {
            if (!$obj->inserirFaz($idPostCat)) {
                $erro = true;
                break;
            }
        }
    }
    if (!$erro) {
        $msg = $msg_ok;
        $msgClass = "msgSucesso";
    } else {
        $msg = $msg_erro;
    }
}
Example #3
0
$titulo = "Notícias Tags";
$acao = "Gerenciar";
$pg_cadastrar = URLADMIN . "noticias-tags/cadastrar.php";
$pg_alterar = URLADMIN . "noticias-tags/alterar.php";
$pg_visualizar = "";
$msg_ok = "Registro Excluído!";
$msg_erro = "Erro ao excluir, verifique se existe tarefas vinculados a este usuário.";
$nomeClasse = "NoticiasTags";
$nomeTabela = strtolower($nomeClasse);
##########################
# excluir
##########################
if (isPost($_POST['idexcluir'])) {
    $obj = new $nomeClasse();
    $obj->id = $_POST['idexcluir'];
    UtilObjeto::limpar("noticiastag", "where id_tag = " . $obj->id);
    if ($obj->excluir()) {
        $msg = $msg_ok;
        $msgClass = "msgSucesso";
    } else {
        $msg = $msg_erro;
    }
}
if (!isPost($_POST['txtBusca'])) {
    # GERA A PAGINAÇÂO
    $Tabela = $nomeTabela;
    $Where = "order by titulo asc";
    $ItemPorPagina = 20;
    $UtilObjeto = 's';
    $Paginacao = Paginacao::geraPaginacao($UtilObjeto, $Tabela, $Where, $ItemPorPagina);
    # LISTA PAGINAÇÃO
Example #4
0
$nomeClasseG = "NoticiasTags";
$nomeClasse = strtolower($nomeClasseG);
##########################
# carregar
##########################
if (isPost($idP)) {
    $obj = new $nomeClasseG();
    $obj->id = $_REQUEST['id'];
    $obj->carregar();
}
##########################
# cadastrar
##########################
if (isPost($_POST['ok'])) {
    $erro = false;
    UtilObjeto::limpar("noticiastag", "WHERE id_noticia = " . $idP);
    if (isPost($_POST['tags']) && is_array($_POST['tags'])) {
        foreach ($_POST['tags'] as $idPostCat) {
            if (!$obj->inserirTags($idPostCat)) {
                $erro = true;
                break;
            }
        }
    }
    if (!$erro) {
        $msg = $msg_ok;
        $msgClass = "msgSucesso";
    } else {
        $msg = $msg_erro;
    }
}