Example #1
0
 foreach ($course_list as $c) {
     $num_students = $model->fetchCountStudents(array('Exam'), $c['code'], $c['section'], $selected_semester);
     $count_professor_requests = $model->fetchCountProfessorRequests($c['code'], $c['section'], $selected_semester, $c['teaching_method']);
     //Processing for quick stat 1 and quick stat 3
     $quick_stat_1_changed = false;
     $quick_stat_3_changed = false;
     if ($count_professor_requests > 0) {
         //If requests do exist, get each of these requests
         $course_requests = $model->fetchDataProfessorRequests($c['code'], $c['section'], $selected_semester, $c['teaching_method']);
         if (!(FACULTY_ALERTS_SHOW_ONLY_FOR_NOE_TEACH_METHODS && !in_array($c['teaching_method'], $noe_teach_methods))) {
             foreach ($course_requests as $cr) {
                 //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($cr['exam_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($cr['exam_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 (!$noes->checkIfFileExistsForNOE($cr['exam_request_id']) && !$noes->checkIfDocumentReceived($cr['exam_request_id']) && $model->fetchCountStudentsConfirmedAtAS($cr['exam_request_id']) > 0 && (int) $num_students > 0) {
                         $quick_stat_1_changed = true;
                         $count_exams_due_48_hours++;
                     }
                 }
                 //Quick stat 3: For each request that is in the future, check if a file exists but a control sheet doesnt
                 if (time() < strtotime($cr['exam_date']) && $noes->checkIfFileExistsForNOE($cr['exam_request_id']) && !$noes->checkIfNoeHasControlSheet($cr['exam_request_id'])) {
                     $quick_stat_3_changed = true;
                     $count_files_no_control_sheet++;
                 }
             }
         }
     }
     //Processing for quick stat 2: Get all courses that have students in them but are missing exam requests
     $quick_stat_2_changed = false;
     if ($count_professor_requests <= 0 && $num_students > 0) {