Пример #1
0
 /**
  * Check whether a control sheet is editable
  * @param string $date The exam date
  * @return boolean
  */
 public function isControlSheetEditable($date)
 {
     $date = mb_substr($date, 0, 10);
     if (!\Ventus\Utilities\Functions::checkIfStringIsDate($date)) {
         throw new \InvalidArgumentException('Invalid exam date');
     }
     $dt = new \DateTime($date . ' ' . FACULTY_EXAM_MODIFICATIONS_BLOCK_AFTER_TIME);
     return time() < \Ventus\Utilities\Functions::findNextBusinessDay($dt->getTimestamp(), -1 * FACULTY_BUSINESS_DAYS_BEFORE_EXAM_BLOCK_CHANGES_CONTROL_SHEET);
 }
Пример #2
0
 /**
  * Calculates the exam date range depending on the days before which files changes are blocked
  */
 public function getExamDateRange($timestamp)
 {
     $rangeStart = \DateTime::createFromFormat('U', \Ventus\Utilities\Functions::findNextBusinessDay($timestamp, FACULTY_BUSINESS_DAYS_BEFORE_EXAM_BLOCK_CHANGES_FILES + 1));
     // We start counting from the next business day
     $rangeStart->setTimeZone(new \DateTimeZone(date_default_timezone_get()));
     $rangeStart->setTime(0, 0, 0);
     $rangeEnd = clone $rangeStart;
     $rangeEnd->setTime(23, 59, 59);
     // For testing
     $range = array('start' => $rangeStart, 'end' => $rangeEnd);
     return $range;
 }
Пример #3
0
$model = new Faculty();
if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) {
    $l10n->setLanguage($SESSION->corr_lang);
    \Locale::setDefault($SESSION->corr_lang);
}
$l10n->addResource(FS_L10N . '/header-external.json');
//============================================================================================
// Load the page requested by the user
//============================================================================================
if (!isset($_GET['page'])) {
    if (isset($_POST['rid'])) {
        $request_details = $model->fetchExamRequestDetails($_POST['rid']);
        $request_details[0]['session_long'] = \Ventus\Utilities\Functions::convertCodeToString($request_details[0]['session'], $l10n);
        //If the time this page is being loaded is less than 2 business days before the exam then the details cannot be edited
        $request_editable = false;
        if (time() < \Ventus\Utilities\Functions::findNextBusinessDay(strtotime(date('Y-m-d ', strtotime($request_details[0]['exam_date'])) . FACULTY_EXAM_MODIFICATIONS_BLOCK_AFTER_TIME), -1 * FACULTY_BUSINESS_DAYS_BEFORE_EXAM_BLOCK_CHANGES_NOE_DETAILS)) {
            $request_editable = true;
        }
        $l10n->addResource(__DIR__ . '/l10n/header.json');
        $l10n->addResource(__DIR__ . '/l10n/request-details.json');
        require_once FS_PHP . '/header-external.php';
        require_once 'views/request-details.php';
        require_once FS_PHP . '/footer-external.php';
    } else {
        header('Location: list-courses.php');
        exit;
    }
} elseif ($_GET['page'] === "new-request") {
    $this_page = "add-noe";
    $all_course_prefixes = $model->fetchDistinctCoursePrefix($SESSION->user_id);
    $all_course_codes = $model->fetchDistinctCourseCode($SESSION->user_id);
Пример #4
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++;
                     }
                 }
                 //Quick stat 2: For each NOE, check if it has no files AND no indication of paper copy being received
                 if (!$model->checkIfDocumentReceived($c['exam_request_id']) && !$model->checkIfFileExistsForNOE($c['exam_request_id'])) {
                     $quick_stat_2_changed = true;
                     $count_exams_no_files++;
                 }
                 //Quick stat 3: For each NOE, check if it has a control sheet
                 if (!$model->checkIfNoeHasControlSheet($c['exam_request_id']) && $students_confirmed_at_as > 0) {
                     $quick_stat_3_changed = true;
                     $count_exams_no_control_sheet++;