Exemplo n.º 1
0
    $id = $_POST['category_id'];
    $action = $_POST['option-action'];
    $option = $_POST['option-option'];
    if ($action == 'delete') {
        foreach ($id as $id) {
            $check = count_job($id);
            if ($check['rows'] > 0) {
                $_SESSION['alert'] = 'error';
                $_SESSION['msg'] = "Can't delete item(s) because it contains one or more item(s)";
            } else {
                delete($id);
                $_SESSION['alert'] = 'success';
                $_SESSION['msg'] = "Item(s) has been successfully removed";
            }
        }
    } else {
        if ($action == 'visibility') {
            foreach ($id as $id) {
                if ($option == 'yes') {
                    update_visibility(1, $id);
                } else {
                    if ($option == 'no') {
                        update_visibility(0, $id);
                    }
                }
            }
            $_SESSION['alert'] = 'success';
            $_SESSION['msg'] = "Changes has been saved";
        }
    }
}
Exemplo n.º 2
0
/* -- BUTTON RESET -- */
if (empty($search_parameter)) {
    $reset = "hidden";
} else {
    $reset = "";
}
if (isset($_POST['btn_index_store_job'])) {
    // DEFINED VARIABLE
    $career_id = $_POST['category_id'];
    $action = $_POST['option-action'];
    $option = $_POST['option-option'];
    if ($action == 'delete') {
        foreach ($career_id as $career_id) {
            delete($career_id);
        }
        $_SESSION['alert'] = 'success';
        $_SESSION['msg'] = 'Item(s) has been successfully deleted';
    } else {
        foreach ($career_id as $career_id) {
            if ($option == 'yes') {
                update_visibility(1, $career_id);
            } else {
                if ($option == 'no') {
                    update_visibility(0, $career_id);
                }
            }
        }
        $_SESSION['alert'] = 'success';
        $_SESSION['msg'] = "Changes has been saved";
    }
}