예제 #1
0
$action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT);
if ($action) {
    require_once '_models/AdminSetor.class.php';
    $postAction = filter_input(INPUT_GET, 'setor', FILTER_VALIDATE_INT);
    $postUpdate = new AdminSetor();
    switch ($action) {
        case 'active':
            $postUpdate->ExeStatus($postAction, '1');
            WSErro("O status do setor foi atualizado para <b>ativo</b>. Setor publicado!", WS_ACCEPT);
            break;
        case 'inative':
            $postUpdate->ExeStatus($postAction, '0');
            WSErro("O status do setor foi atualizado para <b>inativo</b>. Setor agora é um rascunho!", WS_ACCEPT);
            break;
        case 'delete':
            $postUpdate->ExeDelete($postAction);
            WSErro('O Setor <b>' . $postUpdate->getError()[0] . "</b>, foi deletado com sucesso!", $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=setor/index&page=");
$Pager->ExePager($getPage, 6);
$Read = new Controle();
$Read->FullRead("SELECT * FROM ws_setor ORDER by setor_status ASC, setor_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$Read->getResult()) {
    $Pager->ReturnPage();