} elseif ($_GET['page'] === "add-and-remove") { $course_details = array(); if (!empty($_POST['mode']) && $_POST['mode'] !== "template") { $_POST['mode'] = explode('-', $_POST['mode']); $course_details['course_code'] = $_POST['mode'][0]; $course_details['course_section'] = $_POST['mode'][1] === "null" ? null : $_POST['mode'][1]; $course_details['session'] = $_POST['mode'][2]; //Check if someone is trying to edit accommodations for a course that was held in a past session if ($model->fetchSessionStatus($course_details['session']) === -1) { $loggers['audit']->warning("Attempted to edit accommodations for past course for student {$_POST['student_num']}"); exit; } } $_POST['changes_add'] = json_decode($_POST['changes_add']); if (sizeof($_POST['changes_add']) > 0) { $model->addNewAccommodations($SESSION->user_id, $_POST, $_POST['changes_add'], $course_details); $loggers['audit']->info("Accommodations added for student {$_POST['student_num']}"); } $_POST['changes_remove'] = json_decode($_POST['changes_remove']); if (sizeof($_POST['changes_remove']) > 0) { $model->removeExistingAccommodations($SESSION->user_id, $_POST['changes_remove'], $_POST['student_num'], $course_details); $loggers['audit']->info("Accommodations removed for student {$_POST['student_num']}"); } } 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']}");