public static function CatParentByName($CategoryName) { $Read = new WsCategories(); if (self::CatByName($CategoryName)) { $Read->setCategory_parent(self::CatByName($CategoryName)); $Read->Execute()->Query("#category_parent#"); } if ($Read->Execute()->getResult()) { return $Read->Execute()->getResult(); } else { WSErro("A subcategoria de {$CategoryName} não foi encontrada!", WS_INFOR); } }
$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#"); $ContSesCats = $ReadSes->Execute()->getRowCount(); ?> <section> <header> <h1><?php echo $category_title; ?> <span>( <?php echo $ContSesPosts; ?> posts ) ( <?php echo $ContSesCats; ?>
?> " /> </label> <label class="label_small"> <span class="field">Categoria:</span> <select name="post_category"> <option value=""> Selecione a categoria: </option> <?php $ReadSes = new WsCategories(); $ReadSes->Execute()->Query("category_parent IS NULL ORDER BY category_title ASC"); if ($ReadSes->Execute()->getRowCount() >= 1) { foreach ($ReadSes->Execute()->getResult() as $ses) { echo "<option disabled=\"disabled\" value=\"\"> {$ses->category_title} </option>"; $ReadCat = new WsCategories(); $ReadCat->setCategory_parent($ses->category_id); $ReadCat->Execute()->Query("#category_parent# ORDER BY category_title ASC"); if ($ReadCat->Execute()->getRowCount() >= 1) { foreach ($ReadCat->Execute()->getResult() as $cat) { echo "<option "; if ($post['post_category'] == $cat->category_id) { echo "selected=\"selected\" "; } echo "value=\"{$cat->category_id}\"> »»{$cat->category_title} </option>"; } } } } ?> </select> </label>
private function checkCats() { $Read = new WsCategories(); $Read->setCategory_parent($this->CatId); $Read->Query("WHERE #category_parent#"); if (isset($Read->getResult()[0])) { return false; } else { return true; } }