<article> <header> <h1>Atualizar Categoria:</h1> </header> <?php require '_models/AdminAreaCategory.class.php'; $data = filter_input_array(INPUT_POST, FILTER_DEFAULT); $catid = filter_input(INPUT_GET, 'catid', FILTER_VALIDATE_INT); if (!empty($data['SendPostForm'])) { unset($data['SendPostForm']); $cadastra = new AdminAreaCategory(); $cadastra->ExeUpdate($catid, $data); WSErro($cadastra->getError()[0], $cadastra->getError()[1]); } else { $Read = new WsAreaCategory(); $Read->setCategory_id($catid); $Read->Execute()->Query("#category_id#"); if (!$Read->Execute()->getResult()) { header("Location: painel.php?exe=area_category/index&empty=true"); } else { $data = (array) $Read->Execute()->getResult()[0]; } } $checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN); if ($checkCreate && empty($cadastra)) { $tipo = empty($data['category_parent']) ? 'seção' : 'categoria'; WSErro("A {$tipo} <b>{$data['category_title']}</b> foi cadastrada com sucesso no sistema! Continue atualizando a mesma!", WS_ACCEPT); }
<a href="painel.php?exe=area_trabalho/index" class="btn default" style="float: right; border: 1px solid #ccc; margin-left: 5px;">Voltar</a> <a href="painel.php?exe=area_category/create" class="user_cad" style="float: right;">Nova Categoria</a> <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/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>