Exemplo n.º 1
0
<div class="content cat_list">

    <section>

        <h1>Categorias:</h1>

        <?php 
$empty = filter_input(INPUT_GET, 'empty', FILTER_VALIDATE_BOOLEAN);
if ($empty) {
    WSErro("Você tentou editar uma categoria que não existe no sistema!", WS_INFOR);
}
$delCat = filter_input(INPUT_GET, 'delete', FILTER_VALIDATE_INT);
if ($delCat) {
    require '_models/AdminCategory.class.php';
    $deletar = new AdminCategory();
    $deletar->ExeDelete($delCat);
    WSErro($deletar->getError()[0], $deletar->getError()[1]);
}
$ReadSes = new WsCategories();
$ReadSes->Execute()->Query("category_parent IS NULL ORDER BY category_title ASC");
if (!$ReadSes->Execute()->getResult()) {
    WSErro("Desculpa, ainda não temos categorias cadastrados", WS_INFOR);
} else {
    foreach ($ReadSes->Execute()->getResult() as $ses) {
        extract((array) $ses);
        $ReadPosts = new WsPosts();
        $ReadPosts->setPost_cat_parent($category_id);
        $ReadPosts->Execute()->Query("#post_cat_parent#");
        $ContSesPosts = $ReadPosts->Execute()->getRowCount();
        $ReadSes->setCategory_parent($category_id);
        $ReadSes->Execute()->Query("#category_parent#");