예제 #1
0
<div class="content form_create">

    <article>

        <header>
            <h1>Atualizar Tipo:</h1>
        </header>

        <?php 
require '_models/AdminSetorType.class.php';
$data = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$typeId = filter_input(INPUT_GET, 'typeId', FILTER_VALIDATE_INT);
if (!empty($data['SendPostForm'])) {
    unset($data['SendPostForm']);
    $data['type_id'] = $typeId;
    $cadastra = new AdminSetorType();
    $cadastra->ExeUpdate($data);
    WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
} else {
    $Read = new WsSetorType();
    $Read->setType_id($typeId);
    $Read->Execute()->Query("#type_id#");
    if (!$Read->Execute()->getResult()) {
        header("Location: painel.php?exe=setor_type/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 tipo <b>{$data['type_content']}</b> foi cadastrado com sucesso no sistema! Continue atualizando o mesmo!", WS_ACCEPT);
예제 #2
0
    <section>

        <header>
            <h1>Tipo:</h1>
        </header>

        <?php 
$empty = filter_input(INPUT_GET, 'empty', FILTER_VALIDATE_BOOLEAN);
if ($empty) {
    WSErro("Oppss: você tentou editar um tipo que não existe no sistema!", WS_INFOR);
}
$action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT);
if ($action) {
    require_once '_models/AdminSetorType.class.php';
    $postAction = filter_input(INPUT_GET, 'tipo', FILTER_VALIDATE_INT);
    $postUpdate = new AdminSetorType();
    switch ($action) {
        case 'active':
            $postUpdate->ExeStatus($postAction, '1');
            WSErro("O status do tipo foi atualizado para <b>ativo</b>. Setor publicado!", WS_ACCEPT);
            break;
        case 'inative':
            $postUpdate->ExeStatus($postAction, '0');
            WSErro("O status do tipo foi atualizado para <b>inativo</b>. Setor agora é um rascunho!", WS_ACCEPT);
            break;
        case 'delete':
            $postUpdate->ExeDelete($postAction);
            WSErro('O Tipo <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);
예제 #3
0
?>

<div class="content form_create">

    <article>

        <header>
            <h1>Criar Tipo:</h1>
        </header>

        <?php 
require '_models/AdminSetorType.class.php';
$data = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if (!empty($data['SendPostForm'])) {
    unset($data['SendPostForm']);
    $cadastra = new AdminSetorType();
    $cadastra->ExeCreate($data);
    if ($cadastra->getResult() == null) {
        WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
    } else {
        header('Location: painel.php?exe=setor_type/update&create=true&typeId=' . $cadastra->getResult());
    }
}
?>
        
        <form name="PostForm" action="" method="post" enctype="multipart/form-data">
            <label class="label">
                <span class="field">Titulo:</span>
                <input type="text" name="type_content" placeholder="Tipo de Setor" value="<?php 
if (isset($data)) {
    echo $data['type_content'];