Example #1
0
} elseif ($_GET['page'] === "date-update") {
    if (!empty($_POST['mode']) && $_POST['mode'] !== "template") {
        $session = explode('-', $_POST['mode']);
        $session = $session[2];
        //Check if someone is trying to edit accommodation dates for a course that was held in a past session
        if ($model->fetchSessionStatus($session) === -1) {
            if (ctype_digit($_POST['student_num'])) {
                $loggers['audit']->warning("Invalid attempt to change dates for accommodation {$_POST['student_accommodation_id']}");
                header('location: accommodations.php?student_num=' . $_POST['student_num'] . (!empty($_POST['mode']) ? '&mode=' . $_POST['mode'] : null));
            } else {
                header('Location: accommodations.php');
            }
            exit;
        }
    }
    $model->updateDates($_POST, $_POST['student_accommodation_id']);
    $loggers['audit']->info("Dates changed for accommodation {$_POST['student_accommodation_id']}");
    if (ctype_digit($_POST['student_num'])) {
        header('location: accommodations.php?student_num=' . $_POST['student_num'] . (!empty($_POST['mode']) ? '&mode=' . $_POST['mode'] : null));
    } else {
        header('Location: accommodations.php');
    }
    exit;
} else {
    require_once FS_PHP . '/error.php';
}
/**
 * View rendering
 */
if (isset($render) && $render) {
    $follow_up_pending_count = $follow->fetchFollowUpsCountEmployee($SESSION->user_id);