예제 #1
0
    <article>

        <header>
            <h1>Atualizar Perfil:</h1>
        </header>

        <?php 
$perfil = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$perfilid = filter_input(INPUT_GET, 'perfilId', FILTER_VALIDATE_INT);
if (isset($perfil) && $perfil['SendPostForm']) {
    $perfil['perfil_status'] = $perfil['SendPostForm'] == 'Atualizar' ? '0' : '1';
    unset($perfil['SendPostForm']);
    require_once '_models/AdminPerfil.class.php';
    $cadastra = new AdminPerfil();
    $cadastra->ExeUpdate($perfilid, $perfil);
    WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
} else {
    $WsPerfil = new WsPerfil();
    $WsPerfil->setPerfil_id($perfilid);
    $WsPerfil->Execute()->find();
    if (!$WsPerfil->Execute()->getResult()) {
        header('Location: painel.php?exe=perfil/index&empty=true');
    } else {
        $perfil = (array) $WsPerfil->Execute()->getResult();
        $perfil['perfil_date'] = date('d/m/Y H:i:s', strtotime($perfil['perfil_date']));
    }
}
$checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN);
if ($checkCreate && empty($cadastra)) {
    WSErro("O perfil <b>{$perfil['perfil_title']}</b> foi cadastrado com sucesso no sistema!", WS_ACCEPT);
}
예제 #2
0
if ($action) {
    require_once '_models/AdminPerfil.class.php';
    $perfilAction = filter_input(INPUT_GET, 'perfil', FILTER_VALIDATE_INT);
    $perfilUpdate = new AdminPerfil();
    switch ($action) {
        case 'active':
            $perfilUpdate->ExeStatus($perfilAction, '1');
            WSErro("O status do perfil foi atualizado para <b>ativo</b>. Perfil publicado!", WS_ACCEPT);
            break;
        case 'inative':
            $perfilUpdate->ExeStatus($perfilAction, '0');
            WSErro("O status do perfil foi atualizado para <b>inativo</b>. Perfil agora é um rascunho!", WS_ACCEPT);
            break;
        case 'delete':
            $perfilUpdate->ExeDelete($perfilAction);
            WSErro('O perfil ' . $perfilUpdate->getError()[0], $perfilUpdate->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=perfil/index&page=");
$Pager->ExePager($getPage, 6);
$Read = new Controle();
$Read->FullRead("SELECT * FROM ws_perfil ORDER by perfil_status ASC, perfil_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$Read->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpa, ainda não temos perfis cadastrados", WS_INFOR);