Example #1
0
    <section>

        <header>
            <h1>Setores:</h1>
        </header>

        <?php 
$empty = filter_input(INPUT_GET, 'empty', FILTER_VALIDATE_BOOLEAN);
if ($empty) {
    WSErro("Oppss: você tentou editar um setor que não existe no sistema!", WS_INFOR);
}
$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);
Example #2
0
?>

<div class="content form_create">

    <article>

        <header>
            <h1>Criar Setor:</h1>
        </header>

        <?php 
require '_models/AdminSetor.class.php';
$data = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if (!empty($data['SendPostForm'])) {
    unset($data['SendPostForm']);
    $cadastra = new AdminSetor();
    $cadastra->ExeCreate($data);
    if ($cadastra->getResult() == null) {
        WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
    } else {
        header('Location: painel.php?exe=setor/update&create=true&setId=' . $cadastra->getResult());
    }
}
?>

        <form name="PostForm" action="" method="post" enctype="multipart/form-data">
            <label class="label">
                <span class="field">Titulo:</span>
                <input type="text" name="setor_content" placeholder="nome do setor" value="<?php 
if (isset($data)) {
    echo $data['setor_content'];
Example #3
0
<div class="content form_create">

    <article>

        <header>
            <h1>Atualizar Setor:</h1>
        </header>

        <?php 
require '_models/AdminSetor.class.php';
$data = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$setId = filter_input(INPUT_GET, 'setId', FILTER_VALIDATE_INT);
if (!empty($data['SendPostForm'])) {
    unset($data['SendPostForm']);
    $data['setor_id'] = $setId;
    $cadastra = new AdminSetor();
    $cadastra->ExeUpdate($data);
    WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
} else {
    $Read = new WsSetor();
    $Read->setSetor_id($setId);
    $Read->Execute()->Query("#setor_id#");
    if (!$Read->Execute()->getResult()) {
        header("Location: painel.php?exe=setor/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 Setor <b>{$data['setor_content']}</b> foi cadastrado com sucesso no sistema! Continue atualizando o mesmo!", WS_ACCEPT);