$exam_details = $model->getExamRequestById($_POST['request_id']); if (!empty($exam_details)) { //There are two possible emails that are to be sent when an exam has been cancelled if ($_POST['email_to_send'] === 'exam_not_received') { $model->examCancelledNotReceived($exam_details[0]); } else { if ($_POST['email_to_send'] === 'other') { $model->examCancelledOther($exam_details[0]); } } } } } else { if ($_GET['page'] === "view-file") { if ($_GET['mode'] === "print") { $examFiles->setFilePrinted($_GET['file_id'], $_GET['student_num']); } $file = $examFiles->fetchFile($_GET['file_id']); header("Content-Length: {$file['size']}"); header("Content-Type: {$file['type']}"); header("Content-Disposition:inline; filename=" . str_replace(',', '', $file['name'])); print $file['content']; } elseif ($_GET['page'] === "fetch-files") { $files = $examFiles->fetchFilesForExamRequest($_POST['request_id'], $_POST['student_num']); $controlSheet = $controlSheets->fetchControlSheet($_POST['request_id']); foreach ($files as $key => $s) { $files[$key]['file_exists'] = true; if ($files[$key]['cron_logged'] === "1") { $files[$key]['file_exists'] = false; } unset($files[$key]['content']);