?> " /> </label> <label class="label_small"> <span class="field">Categoria:</span> <select name="category_id"> <option value=""> Selecione a categoria: </option> <?php $ReadSes = new WsAreaCategory(); $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>"; $ReadSet = new WsAreaCategory(); $ReadSet->setCategory_parent($ses->category_id); $ReadSet->Execute()->Query("#category_parent# ORDER BY category_title ASC"); if ($ReadSet->Execute()->getRowCount() >= 1) { foreach ($ReadSet->Execute()->getResult() as $cat) { echo "<option "; if ($data['category_id'] == $cat->category_id) { echo "selected=\"selected\" "; } echo "value=\"{$cat->category_id}\"> »»{$cat->category_title} </option>"; } } } } ?> </select> </label>
} $delCat = filter_input(INPUT_GET, 'delete', FILTER_VALIDATE_INT); if ($delCat) { require '_models/AdminAreaCategory.class.php'; $deletar = new AdminAreaCategory(); $deletar->ExeDelete($delCat); WSErro($deletar->getError()[0], $deletar->getError()[1]); } $ReadSes = new WsAreaCategory(); $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); $ReadSes->setCategory_parent($category_id); $ReadSes->Execute()->Query("#category_parent#"); $ContSesCats = $ReadSes->Execute()->getRowCount(); ?> <section> <header> <h1><?php echo $category_title; ?> <span>( <?php echo $ContSesCats; ?> Categorias )</span></h1> <p class="tagline"><?php echo $category_content;
private function checkCats() { $Read = new WsAreaCategory(); $Read->setCategory_parent($this->CatId); $Read->Execute()->Query("#category_parent#"); if (!empty($Read->Execute()->getResult()[0])) { return false; } else { return true; } }