<article> <header> <h1>Atualizar Área:</h1> </header> <?php require '_models/AdminArea.class.php'; $data = filter_input_array(INPUT_POST, FILTER_DEFAULT); $areaId = filter_input(INPUT_GET, 'areaId', FILTER_VALIDATE_INT); if (!empty($data['SendPostForm'])) { unset($data['SendPostForm']); $data['area_id'] = $areaId; $cadastra = new AdminArea(); $cadastra->ExeUpdate($data); WSErro($cadastra->getError()[0], $cadastra->getError()[1]); } else { $Read = new WsAreaTrabalho(); $Read->setArea_id($areaId); $Read->Execute()->Query("#area_id#"); if (!$Read->Execute()->getResult()) { header("Location: painel.php?exe=area_trabalho/index&empty=true"); } else { $data = (array) $Read->Execute()->getResult()[0]; } } $checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN); if ($checkCreate && empty($cadastra)) { WSErro("O Área <b>{$data['area_title']}</b> foi cadastrado com sucesso no sistema! Continue atualizando o mesmo!", WS_ACCEPT); } ?>
if ($action) { require_once '_models/AdminArea.class.php'; $postAction = filter_input(INPUT_GET, 'area', FILTER_VALIDATE_INT); $postUpdate = new AdminArea(); switch ($action) { case 'active': $postUpdate->ExeStatus($postAction, '1'); WSErro("O status da área foi atualizado para <b>ativo</b>. Área publicado!", WS_ACCEPT); break; case 'inative': $postUpdate->ExeStatus($postAction, '0'); WSErro("O status do área foi atualizado para <b>inativo</b>. Área agora é um rascunho!", WS_ACCEPT); break; case 'delete': $postUpdate->ExeDelete($postAction); WSErro($postUpdate->getError()[0], $postUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR); break; } } $posti = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager("painel.php?exe=area_trabalho/index&page="); $Pager->ExePager($getPage, 6); $Read = new Controle(); $Read->FullRead("SELECT * FROM ws_area_trabalho ORDER by area_status ASC, area_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if (!$Read->getResult()) { $Pager->ReturnPage(); WSErro("Desculpa, ainda não temos áreas cadastrados", WS_INFOR);