コード例 #1
0
    $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);
    }
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($files);
    exit;
} elseif ($_GET['page'] === "fetch-students") {
    //Fetch the students belonging to a course and then eliminate those that have opted out
    $noe_students = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $_GET['course_code'], $_GET['course_section'], $_GET['session'], $_GET['request_id']);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($noe_students);
    exit;
} 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 = $noes->fetchStudentAcceptanceStatus($n['student_num'], $_POST['request_id']);