} $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { if (isset($_POST['cid']) && $_POST['cid'] !== "") { //Security step: double check that the user has permission for this course $has_permission = $model->checkCourseAllowed($SESSION->user_id, $_POST['cid']); if ($has_permission) { $course_details = $model->fetchCourseDetails($_POST['cid']); $prof_details = $model->fetchProfessorDetails($course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session'], $course_details[0]['teaching_method']); $semester = \Ventus\Utilities\Functions::convertCodeToString($course_details[0]['session'], $l10n); $num_students = $model->fetchCountStudents(array("Exam"), $course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session']); $num_requests = $model->fetchCountProfessorRequests($course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session'], $course_details[0]['teaching_method']); $data_students = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session']); $data_requests = $model->fetchDataProfessorRequests($course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session'], $course_details[0]['teaching_method']); $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/list-students-exams.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/list-students-exams.php'; require_once FS_PHP . '/footer-external.php'; } else { $loggers['audit']->warning("Unauthorized attempt to access page (class ID: {$_POST['cid']})"); header('location: https://' . URL_PHP . '/error-external.php?eid=F094'); } } else { header('Location: list-courses.php'); exit; } } elseif ($_GET['page'] === "fetch-request-details") {
//============================================================================================ $model = new Faculty(); $examFiles = new \Ventus\Exams\ExamFiles($dbo); if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) { $l10n->setLanguage($SESSION->corr_lang); \Locale::setDefault($SESSION->corr_lang); } $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { if (isset($_POST['rid'])) { $request_details = $model->fetchExamRequestDetails($_POST['rid']); //Fetch all the students in this course and then remove the ones that have opted out $students_in_course = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $request_details[0]['course_code'], $request_details[0]['course_section'], $request_details[0]['session']); $request_details[0]['session_code'] = $request_details[0]['session']; $request_details[0]['session'] = \Ventus\Utilities\Functions::convertCodeToString($request_details[0]['session'], $l10n); $existing_files = $examFiles->fetchFiles($_POST['rid']); foreach ($existing_files as $key => $ef) { $students_for_file = $examFiles->fetchStudentsForFile($ef['id']); $existing_files[$key]['student_list'] = implode(',', $students_for_file); } //If the time this page is being loaded is less than 2 business days before the exam then the details cannot be edited $request_editable = $examFiles->isFilesEditable($request_details[0]['exam_date']); $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/request-documents.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/request-documents.php'; require_once FS_PHP . '/footer-external.php'; } else {
$quick_stat_3_changed = true; $count_exams_no_control_sheet++; } } //Compile all data into a well formatted array $course_prof_student_request[] = array('class_id' => $c['class_id'], 'course_code' => $c['course_code'], 'course_section' => $c['course_section'], 'teach_method' => $c['teaching_method'], 'date' => $c['date'], 'exam_type' => $c['exam_type'], 'exam_duration' => $c['exam_duration'], 'exam_alternate_special' => $c['exam_alternate_special'], 'exam_alternate_special_student' => $c['exam_alternate_special_student'], 'contact_name' => $c['contact_name'], 'contact_number' => $c['contact_number'], 'requestor_email' => $c['requestor_email'], 'inserted_on' => $c['inserted_on'], 'exam_request_id' => $c['exam_request_id'], 'session' => $c['session'], 'control_sheet' => $c['control_sheet'], 'file' => $c['file'], 'professor_email' => $c['professor_email'], 'professor_name' => $c['professor_name'], 'quick_stat_1' => $quick_stat_1_changed, 'quick_stat_2' => $quick_stat_2_changed, 'quick_stat_3' => $quick_stat_3_changed); } } } $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/list-exams.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/list-exams.php'; require_once FS_PHP . '/footer-external.php'; } elseif ($_GET['page'] === "fetch-student-statuses") { $noe_students = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $_POST['course_code'], $_POST['course_section'], $_POST['session'], $_POST['request_id']); foreach ($noe_students as $n) { $student_exam_status = $model->fetchStudentAcceptanceStatus($n['student_num'], $_POST['request_id']); if (!is_string($student_exam_status)) { $sDate = date("Y-m-d", strtotime($student_exam_status['startDate'])); $eDate = date("Y-m-d", strtotime($student_exam_status['endDate'])); $student_exam_status = "accepted:" . $student_exam_status['request_id']; } else { $sDate = date("Y-m-d", strtotime($_POST['exam_date'])); $eDate = date("Y-m-d", strtotime($_POST['exam_date'])); } $noe_students_array[] = array('student_num' => $n['student_num'], 'last_name' => $n['last_name'], 'first_name' => $n['first_name'], 'email' => trim($n['email']), 'startDate' => $sDate, 'endDate' => $eDate, 'status' => $student_exam_status); } $noe_confirmed_dropped_students = $model->fetchConfirmedDroppedStudents($_POST); foreach ($noe_confirmed_dropped_students as $ds) { $noe_students_array[] = array('student_num' => $ds['student_num'], 'last_name' => $ds['last_name'], 'first_name' => $ds['first_name'], 'email' => $ds['email'], 'startDate' => date("Y-m-d", strtotime($ds['startDate'])), 'endDate' => date("Y-m-d", strtotime($ds['endDate'])), 'status' => "droppedConfirmed:" . $ds['request_id']);