示例#1
0
文件: CronJobs.php 项目: hughnguy/php
 /**
  * Activative students who have valid disability, active accommodation, and enroll in at least one class during the current fiscal year
  */
 public final function activateAccessStudent()
 {
     // get current fiscal year
     $fiscal = \Ventus\Utilities\Functions::calcFiscalYearDate();
     $fiscal_start = $fiscal[0]['start_date']->format(DATETIME_MYSQL);
     $fiscal_end = $fiscal[0]['end_date']->format(DATETIME_MYSQL);
     // get semesters based on the begining of the fiscal year
     $semester = \Ventus\Utilities\Functions::fetchSemester($fiscal_start);
     /** The following query get a list of access students under the following conditions:
             1. Must have a disability 
             2. Must have an accommodation active during the current fiscal year
             3. Must register in a course during the current fiscal year OR it may have an exam at Access service during the current fiscal year
             4. Registered course must not be opted-out
             5. Access student must create an active student portal account
         */
     $sql = "SELECT DISTINCT vs.student_num, vs.access_profile_status\n                  FROM ventus_students vs\n                  JOIN ventus_student_disabilities vsd\n                    ON vs.student_num = vsd.student_num\n                  JOIN ventus_student_accommodations vsa\n                    ON vs.student_num = vsa.student_num\n             LEFT JOIN ventus_student_accommodations_exceptions vsae\n                    ON vs.student_num = vsae.student_num\n             LEFT JOIN ventus_exam_requests ver\n                    ON vs.student_num = ver.student_num\n             LEFT JOIN ventus_professor_exam_requests vper\n                    ON ver.professor_exam_request_id = vper.exam_request_id\n                  JOIN org_student_course_classes oscc\n                    ON vs.student_num = oscc.student_id\n                  JOIN org_course_classes occ\n                    ON oscc.class_id = occ.class_id\n                  JOIN org_courses oc\n                    ON occ.course_id = oc.course_id\n                   AND (oc.session IN (:summer, :fall, :winter)\n                    OR (oc.session = vper.session \n                   AND oc.section = vper.course_section \n                   AND oc.code = vper.course_code \n                   AND ver.official_evaluation_starttime BETWEEN date(:fiscal_start6) AND date(:fiscal_end6)))\n             LEFT JOIN ventus_students_courses_no_accommodations vscna\n                    ON vs.student_num = vscna.student_num\n                   AND vscna.course_code = oc.code\n                   AND vscna.course_section = oc.section\n                   AND vscna.session = oc.session\n                 WHERE vs.access_profile_activated_by_student = 1\n                   AND vscna.opt_out_id IS NULL\n                   AND ((date(vsa.effective_on) BETWEEN date(:fiscal_start) AND date(:fiscal_end) OR date(vsa.expires_on) BETWEEN date(:fiscal_start1) AND date(:fiscal_end1))\n                    OR (date(vsae.effective_on) BETWEEN date(:fiscal_start2) AND date(:fiscal_end2) OR date(vsae.expires_on) BETWEEN date(:fiscal_start3) AND date(:fiscal_end3))\n                    OR (date(vsa.effective_on) < date(:fiscal_start4) AND date(vsa.expires_on) > NOW())\n                    OR (date(vsae.effective_on) < date(:fiscal_start5) AND date(vsae.expires_on) > NOW()));";
     $this->deactivateAccessStudent($fiscal, $semester, $sql);
     // re/activate access students that have disability/accommodations/registered in a course
     $students = $this->db->query($sql, array('summer' => $semester['now_short'], 'fall' => $semester['next_short'], 'winter' => $semester['next1_short'], 'fiscal_start' => $fiscal_start, 'fiscal_end' => $fiscal_end, 'fiscal_start1' => $fiscal_start, 'fiscal_end1' => $fiscal_end, 'fiscal_start2' => $fiscal_start, 'fiscal_end2' => $fiscal_end, 'fiscal_start3' => $fiscal_start, 'fiscal_end3' => $fiscal_end, 'fiscal_start4' => $fiscal_start, 'fiscal_start5' => $fiscal_start, 'fiscal_start6' => $fiscal_start, 'fiscal_end6' => $fiscal_end))->fetchAll(\PDO::FETCH_COLUMN);
     $activateSql = "UPDATE ventus_students\n                           SET access_profile_status = 'active', updated_on = NOW()\n                         WHERE student_num IN (" . implode(',', array_fill(0, sizeof($students), '?')) . ");";
     $this->db->query($activateSql, $students);
 }
示例#2
0
文件: events.php 项目: hughnguy/php
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $thisPage = 'events';
    // Get fiscal year for the dropdown menu
    $fiscalYears = \Ventus\Utilities\Functions::calcFiscalYearDate(date("Y-m-d"), 5);
    // Fetch events depend on what user has chosen from the fiscal dropdown menu
    $fiscal = $_GET['fiscal'];
    $event = array();
    if ($fiscal === null || $fiscal === 'current-fiscal-year') {
        $fiscalDates = \Ventus\Utilities\Functions::calcFiscalYearDate();
        $events = $model->getFiscalYearEvent($fiscalDates[0]['start_date']->format(DATETIME_MYSQL), $fiscalDates[0]['end_date']->format(DATETIME_MYSQL));
    } elseif ($fiscal === 'no-fiscal-year-filter') {
        $events = $model->getEvent();
    } else {
        $fiscalDates = \Ventus\Utilities\Functions::calcFiscalYearDate($fiscal . '-' . FISCAL_START_DATE, 1);
        $events = $model->getFiscalYearEvent($fiscalDates[0]['start_date']->format(DATETIME_MYSQL), $fiscalDates[0]['end_date']->format(DATETIME_MYSQL));
    }
    if (is_array($events)) {
        foreach ($events as $e) {
            $e['total_registered'] = $model->countEmployer((int) $e['id']);
            $event[] = $e;
        }
    }
    $services = $serviceModel->getService();
    $l10n->addResource(__DIR__ . '/l10n/events.json');
    $l10n->localizeArray($services, 'name');
    $l10n->localizeArray($event, 'name');
    $l10n->localizeArray($event, 'location');
    $viewFile = 'views/events.php';
} elseif ($_GET['page'] === "create-event") {
示例#3
0
         $files[$key]['file_exists'] = true;
         if ($files[$key]['cron_logged'] === "1") {
             $files[$key]['file_exists'] = false;
         }
         unset($files[$key]['content']);
     }
     $output = array('files' => $files, 'controlSheet' => $controlSheet);
     header('Content-Type: application/json; charset=utf-8');
     echo json_encode($output);
     exit;
 } else {
     if ($_GET['page'] === "print-exam-form") {
         $request = $model->getExamRequestById($_GET['request_id']);
         $controlSheet = $controlSheets->fetchControlSheet($_GET['prof_request_id']);
         $examAccommodations = $model->getExamAccommodationsById($_GET['request_id']);
         $currentFiscalYearArray = \Ventus\Utilities\Functions::calcFiscalYearDate(null, 1);
         $currentFiscalYear = $currentFiscalYearArray[0]['start_date']->format("Y") . "-" . $currentFiscalYearArray[0]['end_date']->format("Y");
         require_once "views/confirmed-requests-printouts.php";
     } else {
         if ($_GET['page'] === "print-delivery-sheet") {
             $deliverySheet = $model->printDeliverySheet($_GET['start'], $_GET['end']);
             $l10n->addResource(__DIR__ . '/l10n/delivery-sheet.json');
             require 'views/delivery-sheet.php';
         } else {
             if ($_GET['page'] === "print-exam-labels") {
                 $requests = $model->getExamRequestsInRangeForLabels($_GET['start'], $_GET['end']);
                 require_once "views/confirmed-requests-printouts.php";
             } elseif ($_GET['page'] === "switch-document-received-status") {
                 $model->updateDocumentReceivedStatus($_POST['request_id'], $_POST['documents_received']);
                 $loggers['audit']->info("Document received status changed to {$_POST['documents_received']} for exam {$_POST['request_id']}");
                 //If the document has been marked as received, an email needs to go out