/** * Check whether a control sheet is editable * @param string $date The exam date * @return boolean */ public function isControlSheetEditable($date) { $date = mb_substr($date, 0, 10); if (!\Ventus\Utilities\Functions::checkIfStringIsDate($date)) { throw new \InvalidArgumentException('Invalid exam date'); } $dt = new \DateTime($date . ' ' . FACULTY_EXAM_MODIFICATIONS_BLOCK_AFTER_TIME); return time() < \Ventus\Utilities\Functions::findNextBusinessDay($dt->getTimestamp(), -1 * FACULTY_BUSINESS_DAYS_BEFORE_EXAM_BLOCK_CHANGES_CONTROL_SHEET); }
$endDate = new \DateTime($default_date_range['end']); } $startDate = $startDate->format('Y-m-d'); $endDate = $endDate->format('Y-m-d'); $denied_requests = $denied->fetchDeniedExamRequests($startDate, $endDate); foreach ($denied_requests as &$req) { $req["dropped"] = $model->determineDropped($req); } unset($req); $l10n->addResource(__DIR__ . '/l10n/denied-requests.json'); $viewFile = 'views/denied-requests.php'; } elseif ($_GET['page'] === 'undo-denial') { $denied->undoDenial($_GET); $loggers['audit']->info("Removed denied request (in-class request) for student {$_GET['student_num']} for NOE {$_GET['exam_request_id']}"); if (!empty($_GET['start']) && !empty($_GET['end'])) { if (\Ventus\Utilities\Functions::checkIfStringIsDate($_GET['start']) && \Ventus\Utilities\Functions::checkIfStringIsDate($_GET['end'])) { header('Location: denied-requests.php?start=' . $_GET['start'] . '&end=' . $_GET['end']); } else { header('Location: denied-requests.php'); } die; } else { header('location:denied-requests.php'); die; } } elseif ($_GET['page'] === "export") { $l10n->addResource(FS_L10N . '/filenames.json'); $l10n->addResource(__DIR__ . '/l10n/denied-requests.json'); $result = $denied->fetchDeniedExamRequestsForExport($_GET['start'], $_GET['end']); foreach ($result as &$r) { $r["column4"] = $l10n->__($r["column4"]);
echo json_encode($noe_students_array); exit; } elseif ($_GET['page'] === "add-file") { try { $file_id = $examFiles->addFile($_POST, $_FILES['exam_file'], $SESSION->user_id); $examFiles->addStudentsToFile($file_id, explode(';', $_POST['student_list'])); $loggers['audit']->info("Document added to NOE {$_POST['request_id']}"); //Trigger a notification to all professors in the course about the file receipt if (!empty($file_id)) { $faculty->sendDocumentReceiptNotification($_POST['request_id'], $file_id); $loggers['audit']->info("Document received notification sent for {$_POST['request_id']}"); } } catch (\InvalidArgumentException $e) { $loggers['audit']->warning("Error occurred with exam file upload: " . $e->getMessage()); } if (\Ventus\Utilities\Functions::checkIfStringIsDate($_GET['start']) && \Ventus\Utilities\Functions::checkIfStringIsDate($_GET['end']) && ctype_digit($_POST['request_id'])) { header("Location: notice-of-examination.php?start={$_GET['start']}&end={$_GET['end']}&mode={$_GET['mode']}&focus={$_POST['request_id']}"); } else { header('Location: notice-of-examination.php'); } die; } elseif ($_GET['page'] === "delete-file") { $examFiles->deleteFile($_POST['file_id']); $loggers['audit']->info("Exam file {$_POST['file_id']} deleted"); } elseif ($_GET['page'] === "export") { $l10n->addResource(FS_L10N . '/filenames.json'); require_once 'l10n/notice-of-examination.php'; $result = $noes->fetchNoticeDetailsForExport($_GET['start'], $_GET['end']); foreach ($result as &$r) { $r["column2"] = $l10n->__($r["column2"]); //The exam type is stored in English in the database
} $l10n->addResource(__DIR__ . '/l10n/unconfirmed-request-details.json'); $l10n->localizeArray($accommodations, 'name'); $viewFile = 'views/unconfirmed-request-details.php'; } elseif ($_GET['page'] === 'add-exam-request') { $applicable_files = $examFiles->fetchFilesForAllStudents($_POST['professor_exam_request_id']); $confirmed_request_id = $model->confirmStudentParticipation($_POST, $_POST['student_num'], $SESSION->user_id); $loggers['audit']->info("Exam confirmed for student {$_POST['student_num']} for {$_POST['professor_exam_request_id']}"); foreach ($applicable_files as $file) { $examFiles->addStudentsToFile($file, array($_POST['student_num'])); } echo $confirmed_request_id; } elseif ($_GET['page'] === "write-in-class") { $denied->confirmStudentParticipationInClass($_GET); $loggers['audit']->info("In-class participation confirmed for student {$_GET['student_num']} for {$_GET['professor_exam_request_id']}"); if (ctype_digit($_GET['professor_exam_request_id']) && ctype_digit($_GET['student_num']) && \Ventus\Utilities\Functions::checkIfStringIsDate($_GET['exam_date'])) { header('Location: denied-requests.php?focus=' . $_GET['professor_exam_request_id'] . $_GET['student_num'] . '&start=' . $_GET['exam_date'] . '&end=' . $_GET['exam_date']); } else { header('Location: denied-requests.php'); } die; } elseif ($_GET['page'] === "export") { $l10n->addResource(FS_L10N . '/filenames.json'); $l10n->addResource(__DIR__ . '/l10n/unconfirmed-requests.json'); $requests = $model->getExamsAwaitingResponseForExport($_GET['start'], $_GET['end']); //Remove the elements where a student does not yet have active accommodations for the exam foreach ($requests as $key => $r) { //We must also check to see if the student has opted out $opted_out = \Ventus\Utilities\Functions::checkIfStudentHasOptedOut($r['column0'], $r['column4'], $r['column5'], $r['column3']); $active_exam_accommodations = $model->getAllStudentActiveExamAndTranscriptionAccommodations($r['column0'], $r['column7'], $r['column4'], $r['column5'], $r['column3']); if (empty($active_exam_accommodations)) {