Ejemplo n.º 1
0
    }
    $noe_confirmed_dropped_students = $noes->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']);
    }
    $noe_denied_dropped_students = $noes->fetchDeniedDroppedStudents($_POST);
    foreach ($noe_denied_dropped_students as $ds) {
        $date = date("Y-m-d", strtotime($ds['exam_date']));
        $noe_students_array[] = array('student_num' => $ds['student_num'], 'last_name' => $ds['last_name'], 'first_name' => $ds['first_name'], 'email' => $ds['email'], 'startDate' => $date, 'endDate' => $date, 'status' => "droppedDenied");
    }
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($noe_students_array);
    exit;
} elseif ($_GET['page'] === "add-file") {
    try {
        $file_id = $examFiles->addFile($_POST, $_FILES['exam_file'], $SESSION->user_id);
        $examFiles->addStudentsToFile($file_id, explode(';', $_POST['student_list']));
        $loggers['audit']->info("Document added to NOE {$_POST['request_id']}");
        //Trigger a notification to all professors in the course about the file receipt
        if (!empty($file_id)) {
            $faculty->sendDocumentReceiptNotification($_POST['request_id'], $file_id);
            $loggers['audit']->info("Document received notification sent for {$_POST['request_id']}");
        }
    } catch (\InvalidArgumentException $e) {
        $loggers['audit']->warning("Error occurred with exam file upload: " . $e->getMessage());
    }
    if (\Ventus\Utilities\Functions::checkIfStringIsDate($_GET['start']) && \Ventus\Utilities\Functions::checkIfStringIsDate($_GET['end']) && ctype_digit($_POST['request_id'])) {
        header("Location: notice-of-examination.php?start={$_GET['start']}&end={$_GET['end']}&mode={$_GET['mode']}&focus={$_POST['request_id']}");
    } else {
        header('Location: notice-of-examination.php');
    }