コード例 #1
0
ファイル: engine_jobs.php プロジェクト: noamh/Boomboom
/*
 * Author - Chudinov Kirill
 */
if (!isset($_SESSION['admin'])) {
    header('location: Login');
    die;
}
require 'engine/classes/class_jobs.php';
$jobs = new jobs();
// If there are a request to delete/show/hide job
if (isset($_POST['delete']) && isset($_POST['id_job'])) {
    $jobs->delete_job($_POST['id_job']);
} elseif (isset($_POST['show']) && isset($_POST['id_job'])) {
    $jobs->show_job($_POST['id_job']);
} elseif (isset($_POST['hide']) && isset($_POST['id_job'])) {
    $jobs->hide_job($_POST['id_job']);
}
// Browser doesn't send this variables, if they empty. So declare those variables
$_POST['websites'] = isset($_POST['websites']) ? $_POST['websites'] : array();
$_POST['categories'] = isset($_POST['categories']) ? $_POST['categories'] : array();
$_POST['job_types'] = isset($_POST['job_types']) ? $_POST['job_types'] : array();
// If admin updated the search form
if (isset($_POST['update_checkboxes'])) {
    if (!empty($_POST['websites'])) {
        $jobs->update_websites_checkboxes($_POST['websites']);
    } else {
        $_SESSION['websites_admin'] = $jobs->create_website_checkboxes();
    }
    if (!empty($_POST['job_types'])) {
        $jobs->update_job_types_checkboxes($_POST['job_types']);
    } else {