$ir = new IncidentReport($dbo); $follow = new \Ventus\Specialist\FollowUps($dbo); $courses = new \Ventus\Specialist\Courses($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; if (!empty($studentProfile)) { $thisPage = 'incident'; $semester = \Ventus\Utilities\Functions::fetchSemester(); $current_courses = $courses->fetchAllStudentCoursesForSemester($_GET['student_num'], $semester['now_short']); $followupcount = $follow->fetchFollowUpsCountStudent($_GET['student_num']); $poccount = $profile->countUnlockedPOC($_GET['student_num']); $incident_reports = $ir->listIncidentReports($_GET['student_num']); foreach ($incident_reports as &$p) { $p["files"] = $ir->fetchAllIncidentReportFiles($p["incident_report_id"]); } unset($p); $l10n->addResource(__DIR__ . '/l10n/incident-report.json'); $viewFile = 'views/incident-report.php'; } } elseif ($_GET['page'] === "create") { $allowedFileTypes = unserialize(FILE_TYPES_ALLOWED_FOR_NOTES_DISABILITIES); $last_inserted = $ir->createIncidentReport($_POST); $loggers['audit']->info("Incident report created for student {$_POST['student_num']}"); for ($i = 0, $numFiles = sizeof($_FILES["incident_report_attachment"]["name"]) - 1; $i < $numFiles; $i++) { if (in_array($_FILES["incident_report_attachment"]["type"][$i], $allowedFileTypes, true)) {