Esempio n. 1
0
 if (!$startDate) {
     $startDate = new \DateTime($default_date_range['start']);
 }
 if (!$endDate) {
     $endDate = new \DateTime($default_date_range['end']);
 }
 $startDate = $startDate->format('Y-m-d');
 $endDate = $endDate->format('Y-m-d');
 $notices = $model->fetchNOEs($SESSION->user_id, $startDate, $endDate);
 $count_exams_due_48_hours = 0;
 $count_exams_no_files = 0;
 $count_exams_no_control_sheet = 0;
 if (!empty($notices)) {
     $noe_teach_methods = unserialize(PROFESSOR_POSSIBLE_NOE_TEACH_METHODS);
     foreach ($notices as $c) {
         $students_confirmed_at_as = $model->fetchCountStudentsConfirmedAtAS($c['exam_request_id'], $c['course_code'], $c['course_section'], $c['session']);
         //If the user has asked for rows that only has AS students, then there should be more than zero AS students for the NOE
         //Or the user wants to regular unfiltered view
         if (empty($_GET['mode']) || $_GET['mode'] === "as_only" && $students_confirmed_at_as > 0) {
             $quick_stat_1_changed = false;
             $quick_stat_2_changed = false;
             $quick_stat_3_changed = false;
             //If requests do exist, get each of these requests
             if (!(FACULTY_ALERTS_SHOW_ONLY_FOR_NOE_TEACH_METHODS && !in_array($c['teaching_method'], $noe_teach_methods))) {
                 //Quick stat 1: For each request, check if the exam is 48 hours to 72 hours away
                 $exam_range_to_consider = unserialize(FACULTY_ALERTS_CONSIDER_EXAM_RANGE_DAYS_BEFORE_EXAM);
                 if (time() > \Ventus\Utilities\Functions::findNextBusinessDay(strtotime(date('Y-m-d ', strtotime($c['date'])) . FACULTY_EXAM_MODIFICATIONS_BLOCK_AFTER_TIME), -1 * $exam_range_to_consider['days_before_exam_start']) && time() < \Ventus\Utilities\Functions::findNextBusinessDay(strtotime(date('Y-m-d ', strtotime($c['date'])) . FACULTY_EXAM_MODIFICATIONS_BLOCK_AFTER_TIME), -1 * $exam_range_to_consider['days_before_exam_end'])) {
                     //If it is, check if that request already has an exam file uploaded
                     if (!$model->checkIfFileExistsForNOE($c['exam_request_id']) && !$model->checkIfDocumentReceived($c['exam_request_id'])) {
                         $quick_stat_1_changed = true;
                         $count_exams_due_48_hours++;
Esempio n. 2
0
        $startDate = \DateTime::createFromFormat('Y-m-d', urldecode($_GET['start']));
        $endDate = \DateTime::createFromFormat('Y-m-d', urldecode($_GET['end']));
    }
    if (!$startDate) {
        $startDate = new \DateTime($default_date_range['start']);
    }
    if (!$endDate) {
        $endDate = new \DateTime($default_date_range['end']);
    }
    $startDate = $startDate->format('Y-m-d');
    $endDate = $endDate->format('Y-m-d');
    $notices = $noes->fetchNOEs($startDate, $endDate);
    if ($_GET['mode'] === "as_only") {
        //If the user has requested that only NOE's with AS confirmations, we need to filter out those that don't
        $notices = array_filter($notices, function ($n) use($noes) {
            return $noes->fetchCountStudentsConfirmedAtAS($n['exam_request_id'], $n['course_code'], $n['course_section'], $n['session']) > 0;
        });
    }
    $l10n->addResource(__DIR__ . '/l10n/notice-of-examination.json');
    $viewFile = 'views/notice-of-examination.php';
} elseif ($_GET['page'] === "add-notice-of-exam") {
    $noe_id = $noes->addNOE($_POST, $SESSION->first_name . " " . $SESSION->last_name, $SESSION->user_name, $SESSION->user_id);
    $loggers['audit']->info("NOE {$noe_id} added");
    echo $noe_id;
    //Need to borrow prof module functions to trigger reminder emails professor and students
    $professor = new \Ventus\Professor\RequestForm($dbo);
    $professor->reminderToAccessServiceStudents(null, $noe_id);
    $loggers['audit']->info("Exam confirmation reminders sent to students for NOE {$noe_id}");
    $professor->reminderToProfessors(array('source' => 'exams', 'exam_request_id' => $noe_id));
    $loggers['audit']->info("Exam reminder sent to professors for NOE {$noe_id}");
} elseif ($_GET['page'] === "delete-request") {