Example #1
0
    $loggers['audit']->info("Exam reminder sent to professors for NOE {$noe_id}");
} elseif ($_GET['page'] === "delete-request") {
    $noes->deleteNOE($_POST['request_id']);
    $loggers['audit']->info("NOE {$_POST['request_id']} deleted");
} elseif ($_GET['page'] === "update-exam-date-and-duration") {
    $noes->updateExamStartAndDuration($_POST['request_id'], $_POST['exam_date'], $_POST['exam_duration'], $SESSION->user_id);
    $loggers['audit']->info("Exam date updated for NOE {$_POST['request_id']}");
} elseif ($_GET['page'] === "fetch-control-sheet") {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($controlSheets->fetchControlSheet($_POST['request_id']));
    exit;
} elseif ($_GET['page'] === "add-control-sheet") {
    $controlSheets->addUpdateControlSheet($_POST['request_id'], $_POST);
    $loggers['audit']->info("Control sheet added/updated for NOE {$_POST['request_id']}");
} elseif ($_GET['page'] === "view-file") {
    $file = $examFiles->fetchFile($_GET["file-id"]);
    header("Content-Length: {$file['size']}");
    header("Content-Type: {$file['type']}");
    header("Content-Disposition:attachment; filename=" . str_replace(',', '', $file['name']) . "");
    print $file['content'];
} elseif ($_GET['page'] === "fetch-files") {
    $files = $examFiles->fetchFiles($_POST["request_id"]);
    foreach ($files as $key => $f) {
        $files[$key]['file_exists'] = true;
        if ($files[$key]['cron_logged'] === "1") {
            $files[$key]['file_exists'] = false;
        }
        unset($files[$key]['content']);
        $studentsForFile = $examFiles->fetchStudentsForFile($files[$key]['id']);
        $files[$key]['students_for_file'] = implode(', ', $studentsForFile);
    }
Example #2
0
             //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']);
         }
         $output = array('files' => $files, 'controlSheet' => $controlSheet);