/** * Add an event to the calendar for one or more employees * @param array $data The POST array. * @param int $departmentID The department ID, in the case of all employees */ protected function insertEvent(array $data, $departmentID) { global $SESSION; $keys = array('emp_id', 'appointment_description', 'appointment_type_id', 'appointment_start', 'appointment_end', 'student', 'all_day', 'dass_alert'); $data = $this->db->pick($keys, $data); //Is this an all day event? $data['all_day'] = (int) ($data['all_day'] === "true"); $data['updated_on'] = date(DATETIME_MYSQL); $data['inserted_on'] = $data['updated_on']; $data['last_modified'] = $SESSION->user_id; if ($data['emp_id'] === "all") { // If an event needs to be added for all employees $allemps = \Ventus\Utilities\Functions::listEmployees($departmentID); foreach ($allemps as $a) { $data['emp_id'] = $a['user_id']; $this->db->insert('ventus_calendar', $data); $event = $this->db->lastInsertId(); if ($_POST['frequency'] !== '') { $this->addRecurringEvents($_POST['frequency'], $event, $data); } } } else { // Event to be added for an individual employee $this->db->insert('ventus_calendar', $data); $event = $this->db->lastInsertId(); if ($_POST['frequency'] !== '') { $this->addRecurringEvents($_POST['frequency'], $event, $data); } } }
/** * Determines the last day of the term * @param int $next Whether to get the day for the next term. Defaults to FALSE * @return \DateTime */ public function determineEndOfTerm($next = false) { $term = \Ventus\Utilities\Functions::fetchSemester(); // Taking the start date of the term following and subtracting one day $key = $next ? 'next1_short' : 'next_short'; return \DateTime::createFromFormat('Yn-d H:i:s', "{$term[$key]}-01 23:59:59")->modify('-1 day'); }
/** * 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); }
/** * 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; }
/** * A method that generates emails and letters from letter details that usually come from the UI via POST requests. * * @param \Ventus\Specialist\EmailLetterGenerator $model. The EmailLetterGenerator model. * @param array $letter_details. An array containing letters details. * @param array $course_details. An array containing course details (optional parameter). * @return array containing email and letters details. */ public function generateEmailLetter(\Ventus\Specialist\EmailLetterGenerator $model, array $letter_details, array $course_details = array()) { // Variable declarations & initiations $email_letter_serial = array(); // If document is not an CAM_LETTER_ID_FRENCH, and CAM_LETTER_ID_ENGLISH if ((empty($letter_details['acc_mode']) || $letter_details['acc_mode'] === 'template') && ((int) $letter_details['template_id'] !== CAM_LETTER_ID_FRENCH && (int) $letter_details['template_id'] !== CAM_LETTER_ID_ENGLISH)) { $email_letter_serial[$letter_details['template_id']] = $model->insertSentTemplate($letter_details, $course_details); } else { //Has student opted out? We assume no by default $opted_out = false; $all_active_accommodations = null; if ($letter_details['acc_mode'] !== 'template') { if (empty($course_details)) { $course_components = explode('-', $letter_details['acc_mode']); $course_details['code'] = $course_components[0]; $course_details['section'] = $course_components[1] === 'null' ? null : $course_components[1]; $course_details['session'] = $course_components[2]; } $course_code = $course_details['code']; $course_section = $course_details['section']; $course_session = $course_details['session']; $opted_out = \Ventus\Utilities\Functions::checkIfStudentHasOptedOut($letter_details['student_num'], $course_code, $course_section, $course_session); //This string is passed to the email letter generator code $acc_mode = $course_code . '-' . (empty($course_section) ? 'null' : $course_section) . '-' . $course_session; //Accommodations are course specific so we need to fetch all the accommodations for a specific course $all_active_accommodations = $this->student_profile->fetchStudentActiveTemplateAndCsaAccommodations($letter_details['student_num'], $course_code, $course_section, $course_session); } //Check if student has opted out- if so, don't send email. Double checking here, even though the opt-out courses are disabled on the UI if (!$opted_out) { if (empty($all_active_accommodations) && $letter_details['acc_mode'] === 'template' || !empty($all_active_accommodations) && $letter_details['acc_mode'] !== 'template') { // Ensure the CAM LETTER ID are set correctly. if (is_int(CAM_LETTER_ID_FRENCH) && is_int(CAM_LETTER_ID_ENGLISH)) { $cam_ids = array("fr" => CAM_LETTER_ID_FRENCH, "en" => CAM_LETTER_ID_ENGLISH); } foreach ($cam_ids as $key => $cam_id) { //Generate letter and put in to students letters- first in French, then english $letter_details['template_id'] = $cam_id; $letter_details['content'] = file_get_contents("https://" . URL_SPECIALIST . "/email-letter-generator.php?page=fetch-template&templateid={$letter_details['template_id']}&student_num={$letter_details['student_num']}&acc_mode={$acc_mode}"); $email_letter_serial[$key] = $model->insertSentTemplate($letter_details, $course_details); if ($letter_details['mode'] === 'letter') { $model->markPastCamsAsInactive($letter_details['student_num'], $letter_details['template_id'], $course_details); } } } } } // populate the email_letter object $email_letter = array('email_letter_serial' => $email_letter_serial, 'cam_ids' => $cam_ids, 'model' => $model, 'course_details' => $course_details, 'letter_details' => $letter_details); return $email_letter; }
/** * Verify that the client isn't trying to breach the system by injecting items that apply to past semester and years * @param array $data containing student number, course code, session and possibly course section * @return boolean */ public function verifyRequestIsValid(array $data) { //Because client side checking isn't enough- if the semester is < current semester, reject the request $current_semester = \Ventus\Utilities\Functions::fetchSemester(); $current_semester = $current_semester['now_short']; $current_session = (int) substr($current_semester, -1); $current_year = (int) substr($current_semester, 0, 4); $course_session = (int) substr($data['session'], -1); $course_year = (int) substr($data['session'], 0, 4); //Reject anything that applies to < this year OR applies to this year but < the current session if ($course_year < $current_year || $course_year === $current_year && $course_session < $current_session) { return false; } return true; }
/** * For a given semester, indicate whether it belongs in the past(-1), present(0) or future(1) * @param string $session The semester * @return int */ public function fetchSessionStatus($session) { if (!ctype_digit($session)) { throw new \InvalidArgumentException("Session specified is not numeric…"); } $year = substr($session, 0, 4); $semester = substr($session, -1); $current_session = \Ventus\Utilities\Functions::fetchSemester(); $current_session = $current_session['now_short']; $current_year = substr($current_session, 0, 4); $current_semester = substr($current_session, -1); //If the sessions match, things are easy if ($session === $current_session) { return 0; } else { if ($year > $current_year) { return 1; } else { if ($year < $current_year) { return -1; } else { //If the current semester is the first one of the year, everything else in the same year will be in the future if ($current_semester === "1") { return 1; } //If the current semester is the middle one of the year, the current course could be in the past or the future if ($current_semester === "5") { if ($semester === "1") { return -1; } else { if ($semester === "9") { return 1; } } } else { if ($current_semester === "9") { return -1; } } } } } }
$profile = new Profile($dbo); $follow = new FollowUps($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; if (!empty($studentProfile)) { $thisPage = 'profile'; $lastAppointment = \Ventus\Utilities\Functions::getLastAppointment($_GET['student_num'], SERVICE_ID_ACCESS); $allAppointments = \Ventus\Utilities\Functions::getAllAppointments($_GET['student_num'], SERVICE_ID_ACCESS); $all_student_activity = $profile->listAllActivity($_GET['student_num']); $all_employees = \Ventus\Utilities\Functions::listEmployees(SERVICE_ID_ACCESS); $followupcount = $follow->fetchFollowUpsCountStudent($_GET['student_num']); $poccount = $profile->countUnlockedPOC($_GET['student_num']); $l10n->addResource(__DIR__ . '/l10n/profile.json'); $l10n->localizeArray($allAppointments, 'label'); $l10n->localizeArray($all_student_activity, 'otherDetail'); $l10n->localizeArray($studentProfile, 'faculty'); $l10n->localizeArray($studentProfile, 'program'); if ($lastAppointment) { $l10n->localizeArray($lastAppointment[0], 'label'); } $viewFile = 'views/profile.php'; } } elseif ($_GET['page'] === "activate-profile") { $profile->activateStudentProfile($_GET['student_num']); $loggers['audit']->info("Access Service profile activated for student {$_GET['student_num']}");
//============================================================================================ 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") {
$sentLetters = $model->getStudentLetters($_GET['student_num']); $l10n->addResource(__DIR__ . '/l10n/email-letter-generator.json'); $viewFile = 'views/email-letter-generator.php'; } } elseif ($_GET['page'] === "fetch-template") { $semester = \Ventus\Utilities\Functions::fetchSemester(); //Has student opted out? We assume no by default $opted_out = false; //Deal with whether we have course specific accs that need to be fetched $course_details = array(); if (!empty($_GET['acc_mode']) && $_GET['acc_mode'] !== 'template') { $course_components = explode('-', $_GET['acc_mode']); $course_details['course_code'] = $course_components[0]; $course_details['course_section'] = $course_components[1] === 'null' ? null : $course_components[1]; $course_details['session'] = $course_components[2]; $opted_out = \Ventus\Utilities\Functions::checkIfStudentHasOptedOut($_GET['student_num'], $course_details['course_code'], $course_details['course_section'], $course_details['session']); } //Get the actual base template that we are starting with $content = $template->getTemplate($_GET['templateid']); $content = html_entity_decode($content[0]['content']); //Fetch all the possible fields that need to be changed from tags to actual data $replacementItems = $model->getTemplateReplaceItems($_GET['student_num']); //Given a comma seperated list this functions puts that into the proper HTML so it will display in the rich editor as a bullet list function generateBulletList($accs, $lang) { $result = ""; foreach ($accs as $a) { if ($lang === 'en') { $name = $a['name']; } else { $name = $a['nom'];
$l10n->_e('colHeaderAddedOn'); ?> </th> <th></th> </tr> </thead> <tbody> <?php foreach ($notices as $c) { if (time() > strtotime($c['date'])) { $data_editable = "no"; } else { $data_editable = "yes"; } echo '<tr class="noe-main-row" data-request-id="' . $c['exam_request_id'] . '" data-exam-alternate="' . $c['exam_alternate_special'] . '" data-exam-alternate-student="' . $c['exam_alternate_special_student'] . '"> <td>', '<span rel="tooltip" title="' . \Ventus\Utilities\Functions::convertCodeToString($c['session'], $l10n) . '">' . $c['course_code'], ' ', strtoupper($c['course_section']), ' ', strtoupper($c['teach_method']) . '</span>', '<br>', $c['professor_name'] === " " ? '<span style="font-size: 11px; font-style: italic;">' . $l10n->__('noProfDetails') . '</span>' : '<a href="mailto:' . $c['professor_email'] . '" style="font-size: 11px;">' . $c['professor_name'] . '</a>', '</td> <td>', ucfirst($l10n->__($c['exam_type'])), '</td> <td>', $l10nDate->format($c['date'], 'date_time'), '</td> <td><span class="exam-duration-field" request-id="' . $c['exam_request_id'] . '" ' . ' default-val="' . $c['exam_duration'] . '" ' . '>', $c['exam_duration'], '</span> ', $l10n->__('minutesLabel'), '</td> <td>', $c['exam_alternate_special'] === 'none' ? 'N/A' : ucfirst($l10n->__($c['exam_alternate_special'])) . ' (' . $c['exam_alternate_special_student'] . ')', '</td> <td><span rel="tooltip" title="', $c['contact_number'], '"><a href="mailto:', $c['requestor_email'], '">', $c['contact_name'], '</a></span></td> <td style="text-align: center;">' . ($c['control_sheet'] === null ? '<button type="button" class="btn-unset view-edit-control-sheet" rel="tooltip" request-id="' . $c['exam_request_id'] . '" data-is-complete="0" title="' . $l10n->__('ctrlSheetIncompleteTooltip', $antiXSS::HTML_ATTR) . '" data-editable="' . $data_editable . '"><span data-ventus-icon="đ" style="color: red;"></span></button>' : '<button type="button" class="btn-unset view-edit-control-sheet" rel="tooltip" request-id="' . $c['exam_request_id'] . '" data-is-complete="1" title="' . $l10n->__('ctrlSheetTooltip', $antiXSS::HTML_ATTR) . '" data-editable="' . $data_editable . '"><span data-ventus-icon="Đ" style="color: green;"></span></button>') . '</td> <td style="text-align: center;">' . ($c['file'] === null ? '<button type="button" class="btn-unset view-edit-files" rel="tooltip" title="' . $l10n->__('noFilesTooltip', $antiXSS::HTML_ATTR) . '" data-course-code="' . $c['course_code'] . '" data-course-session="' . $c['session'] . '" data-course-section="' . $c['course_section'] . '" request-id="' . $c['exam_request_id'] . '" data-editable="' . $data_editable . '" ><span data-ventus-icon="đ" style="color: red;"></span></button>' : '<button type="button" class="btn-unset view-edit-files" rel="tooltip" title="' . $l10n->__('filesTooltip', $antiXSS::HTML_ATTR) . '" data-course-session="' . $c['session'] . '" data-course-code="' . $c['course_code'] . '" data-course-section="' . $c['course_section'] . '" request-id="' . $c['exam_request_id'] . '" data-editable="' . $data_editable . '"><span data-ventus-icon="Đ" style="color: green;"></span></button>') . '</td> <td>', $l10nDate->format($c['inserted_on'], 'date_time'), '</td> <td>' . '<button request-id="' . $c['exam_request_id'] . '" exam-duration="' . $c['exam_duration'] . '" exam-date="' . $c['date'] . '" class="edit-notice-of-exam btn-arrow-right btn-icon btn-maroon">' . $l10n->__('editDeleteBtn') . '<span></span></button>' . '<button data-request-id="' . $c['exam_request_id'] . '" class="view-noe-students btn-icon btn-maroon btn-arrow-down" style="margin-right: 10px;" data-noe-course="' . $c['course_code'] . '" data-noe-section="' . $c['course_section'] . '" data-noe-semester="' . $c['session'] . '" data-request-id="' . $c['exam_request_id'] . '" data-noe-exam-date="' . $c['date'] . '">' . $l10n->__('studentsBtn') . '<span></span></button>' . '</td> </tr>'; } ?> </tbody> </table>
$SESSION->lang = DEFAULT_LANGUAGE; } \Locale::setDefault($SESSION->lang); $l10n->setLanguage($SESSION->lang); //============================================================================================ // Model //============================================================================================ $cal = new Calendar($dbo); $follow = new \Ventus\Specialist\FollowUps($dbo); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { $thisPage = 'Calendar'; $emps = \Ventus\Utilities\Functions::listEmployees(SERVICE_ID_ACCESS); $appointment_types = \Ventus\Utilities\Functions::listAppointmentTypes(SERVICE_ID_ACCESS); $render = true; $l10n->addResource(__DIR__ . '/l10n/calendar.json'); $l10n->localizeArray($appointment_types, 'label'); $viewFile = 'views/calendar.php'; } elseif ($_GET['page'] === "fetchevents") { $events = $cal->listEvents($_POST['emp_id'], $_POST['start'], $_POST['end']); $l10n->addResource(__DIR__ . '/l10n/calendar.json'); $l10n->localizeArray($events, 'label'); foreach ($events as $e) { $category = ""; //Determine whether this appointment was a cancellation or no show or if the student has arrived if ($e['appointment_status'] === "cancelled") { $category = "cancelled"; } elseif ($e['appointment_status'] === "no_show") { $category = "noshow";
//============================================================================================ // Model //============================================================================================ $profile = new \Ventus\Counselling\Profile($dbo); $ptriage = new \Ventus\Counselling\PostTriage($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; if (!empty($studentProfile)) { $data = $ptriage->listPostTriages($_GET['student_num']); $employees = \Ventus\Utilities\Functions::listEmployees(SERVICE_ID_COUNSELLING); $thisPage = 'posttriage'; $l10n->addResource(FS_COUNSELLING . '/l10n/post-triage.json'); $viewFile = '../counselling/views/post-triage.php'; } } elseif ($_GET['page'] === "fetch") { $content = $ptriage->getPostTriage($_GET['row']); echo $content['post_triage']; } elseif ($_GET['page'] === "add") { $ptriage->addPostTriage($_POST); $loggers['audit']->info("Post-triage added"); } elseif ($_GET['page'] === "update") { $ptriage->updatePostTriage($_POST['id'], $_POST); $loggers['audit']->info("Post-triage {$_POST['id']} updated"); } elseif ($_GET['page'] === "lock") { $ptriage->lockPostTriage($_GET['id']);
if (!isset($SESSION->lang)) { $SESSION->lang = DEFAULT_LANGUAGE; } \Locale::setDefault($SESSION->lang); $l10n->setLanguage($SESSION->lang); //============================================================================================ // Model //============================================================================================ $cal = new Calendar($dbo); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { $render = true; $emps = \Ventus\Utilities\Functions::listEmployees(SERVICE_ID_COUNSELLING); $appointment_types = \Ventus\Utilities\Functions::listAppointmentTypes(SERVICE_ID_COUNSELLING); $thisPage = 'Calendar'; $l10n->addResource(__DIR__ . '/l10n/calendar.json'); $l10n->localizeArray($appointment_types, 'label'); $viewFile = 'views/calendar.php'; } elseif ($_GET['page'] === "fetchevents") { $events = $cal->listEvents($_POST['emp_id'], $_POST['start'], $_POST['end']); $l10n->addResource(__DIR__ . '/l10n/calendar.json'); $l10n->localizeArray($events, 'label'); foreach ($events as $e) { $category = ""; //Determine whether this appointment was a cancellation or no show or if the student has arrived if ($e['appointment_status'] === "cancelled") { $category = "cancelled"; } elseif ($e['appointment_status'] === "no_show") { $category = "noshow";
foreach ($all_employees as $a) { echo '<option value="' . $a['user_id'] . '" ' . ($studentProfile['access_assigned_employee_id'] === $a['user_id'] ? 'selected' : '') . '>' . $a['first_name'] . ' ' . $a['last_name'] . '</option>'; } ?> </select> </td> <td class="profile-cell-title"><?php $l10n->_e('camRow'); ?> </td> <td class="profile-cell-data" id="cam-checkbox-container"> <input type="checkbox" id="cam-letter-auth" <?php echo $studentProfile['access_email_permission'] == "0" ? '' : 'checked'; ?> <?php echo \Ventus\Utilities\Functions::getModuleNameFromURL() === "access-reception" ? 'disabled' : ''; ?> > <label for="cam-letter-auth"><?php $l10n->_e('sendLetterBtn'); ?> </label> </td> </tr> <?php } ?> </tbody> </table> <?php if ($studentProfile['access_profile_status'] !== "active") {
$l10n->_e('addedOn'); ?> </th> <th scope='col' style="width: 25%;"><?php $l10n->_e('letter'); ?> </th> <th scope='col'><?php $l10n->_e('course'); ?> </th> <th scope='col'></th> </tr> </thead> <tbody> <?php if (empty($all_student_letters)) { echo '<tr><td colspan="4" style="text-align: center;">' . $l10n->__('noLettersIssued') . '…' . '</td></tr>'; } foreach ($all_student_letters as $asl) { echo '<tr><td>' . $asl['first_name'] . ' ' . $asl['last_name'] . '</td> <td>' . $l10nDate->format($asl['inserted_on'], 'date_time') . '</td> <td>' . $asl['name'] . '</td> <td>' . (empty($asl['course_code']) ? 'N/A' : $asl['course_code'] . ' ' . $asc['course_section'] . '(' . \Ventus\Utilities\Functions::convertCodeToString($asl['session'], $l10n) . ')') . '</td> <td style="text-align: right;">' . '<a class="btn-maroon btn-icon btn-arrow-right view-letter" href="letters-issued-fetch-as-pdf.php?format=html&serial=' . $asl['letter_serial'] . '">' . $l10n->__('viewBtn') . ' (HTML) <span></span></a> <a class="btn-maroon btn-icon btn-arrow-right view-letter" href="letters-issued-fetch-as-pdf.php?format=pdf&serial=' . $asl['letter_serial'] . '">' . $l10n->__('viewBtn') . ' (PDF) <span></span></a>' . '</td></tr>'; } ?> </tbody> </table> <!--END MAIN BODY CONTENT-->
// Model //============================================================================================ $profile = new Profile($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; $thisPage = 'profile'; if (!empty($studentProfile)) { $intake_form_personal_info = $profile->getMostRecentPersonalInformation($_GET['student_num']); $lastAppointment = \Ventus\Utilities\Functions::getLastAppointment($_GET['student_num'], SERVICE_ID_COUNSELLING); $allAppointments = \Ventus\Utilities\Functions::getAllAppointments($_GET['student_num'], SERVICE_ID_COUNSELLING); $l10n->addResource(__DIR__ . '/l10n/profile.json'); $l10n->localizeArray($allAppointments, 'label'); $l10n->localizeArray($studentProfile, 'faculty'); $l10n->localizeArray($studentProfile, 'program'); if ($lastAppointment) { $l10n->localizeArray($lastAppointment[0], 'label'); } $viewFile = 'views/profile.php'; } } elseif ($_GET['page'] === "activate-profile") { $profile->activateStudentProfile($_GET['student_num']); $loggers['audit']->info("Counselling profile activated for student {$_GET['student_num']}"); if (ctype_digit($_GET['student_num'])) { header('Location:profile.php?student_num=' . $_GET['student_num']); } else {
//============================================================================================ $profile = new Profile($dbo); $los = new LettersSupport($dbo); $emp_profile = new \Ventus\Profile\MyProfile($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; $thisPage = 'los'; if (!empty($studentProfile)) { $emp_signature = $emp_profile->getEmpSignature($SESSION->user_name); $manager_details = \Ventus\Utilities\Functions::fetchSubGroupEmployeeDetails(SUB_SERVICE_ID_COUNSELLING_MANAGER); $letters = $los->listLetters($_GET['student_num']); $l10n->addResource(__DIR__ . '/l10n/letters-of-support.json'); $viewFile = 'views/letters-of-support.php'; } } elseif ($_GET['page'] === "add") { $los->addLetter($_POST); $loggers['audit']->info("Letter of support added"); } elseif ($_GET['page'] === "fetch") { $content = $los->getLetter($_GET['row']); echo $content['letter_of_support']; } elseif ($_GET['page'] === "update") { $los->updateLetter($_POST['id'], $_POST); $loggers['audit']->info("Letter of support {$_POST['id']} updated"); } elseif ($_GET['page'] === "lock") { $los->lockLetter($_GET['id']);
$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);
} $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { if (isset($_POST['cid']) && $_POST['cid'] !== "") { //Security step: double check that the user has permission for this course $has_permission = $model->checkCourseAllowed($SESSION->user_id, $_POST['cid']); if ($has_permission) { $course_details = $model->fetchCourseDetails($_POST['cid']); $prof_details = $model->fetchProfessorDetails($course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session'], $course_details[0]['teaching_method']); $semester = \Ventus\Utilities\Functions::convertCodeToString($course_details[0]['session'], $l10n); $num_students = $model->fetchCountStudents(array("Exam"), $course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session']); $num_requests = $model->fetchCountProfessorRequests($course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session'], $course_details[0]['teaching_method']); $data_students = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session']); $data_requests = $model->fetchDataProfessorRequests($course_details[0]['code'], $course_details[0]['section'], $course_details[0]['session'], $course_details[0]['teaching_method']); $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/list-students-exams.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/list-students-exams.php'; require_once FS_PHP . '/footer-external.php'; } else { $loggers['audit']->warning("Unauthorized attempt to access page (class ID: {$_POST['cid']})"); header('location: https://' . URL_PHP . '/error-external.php?eid=F094'); } } else { header('Location: list-courses.php'); exit; } } elseif ($_GET['page'] === "fetch-request-details") {
} else { if (time() < strtotime($r['effective_on'])) { $status = $l10n->__('pending'); $tick = "open"; } else { $status = $l10n->__('undefined') . " "; $tick = "closed"; } } } } //Are we dealing with template or course specific accommodations if ($r['source'] === "template") { $type = '<a href="accommodations.php?student_num=' . $_GET['student_num'] . '">' . $l10n->__('colBodyTypeTemplate') . '</a>'; } else { $type = '<a href="accommodations.php?student_num=' . $_GET['student_num'] . '&mode=' . $r['course_code'] . '-' . ($r['course_section'] === "" ? 'null' : $r['course_section']) . '-' . $r['session'] . '">' . $r['course_code'] . ($r['course_section'] === "" ? null : ' ' . $r['course_section']) . '<br>' . \Ventus\Utilities\Functions::convertCodeToString($r['session'], $l10n) . "<br><strong>" . mb_convert_case($l10n->__($r['exception_type']), MB_CASE_UPPER, 'UTF-8') . "</strong></a>"; } echo '<tr data-source="' . $r['source'] . '" data-student-accommodation-id="' . $r['student_accommodation_id'] . '" data-effective-date="' . date('Y-m-d', strtotime($r['effective_on'])) . '" data-expiry-date="' . date('Y-m-d', strtotime($r['expires_on'])) . '"> <td>' . $r['first_name'] . ' ' . $r['last_name'] . '</td> <td>' . $r['acc_name'] . '</td> <td>' . $l10nDate->format($r['effective_on'], 'date_time') . '</td> <td>' . $l10nDate->format($r['expires_on'], 'date_time') . '</td> <td>' . $type . '</td> <td style="text-align: right">' . (time() < strtotime($r['expires_on']) ? '<button class="btn-arrow-right btn-icon btn-maroon edit-acc-dates" type="button">' . $l10n->__('editBtn') . '<span></span></button>' : null) . '<span class="ticket acc ' . $tick . '">' . $status . '</span>' . '</td> </tr>'; } } ?> </tbody> </table> </div>
$l10n->_e('colHeaderDateAdded'); ?> </th> <th></th> </tr> </thead> <tbody> <?php $unlocked_exists = false; foreach ($data as $r) { if ($r['locked'] == 0) { $unlocked_exists = true; echo '<tr><td>' . $r['first_name'] . ' ' . $r['last_name'] . '</td> <td>' . $l10nDate->format($r['inserted_on'], 'date_time') . '</td> <td class="button-options"> <button name="' . $r['post_triage_id'] . '" class="btn-maroon btn-icon btn-arrow-right view-edit-note">' . $l10n->__('viewEditBtn') . '<span></span></button>' . (\Ventus\Utilities\Functions::getModuleNameFromURL() !== "counselling-reception" ? '<button name="' . $r['post_triage_id'] . '" class="btn-maroon btn-icon btn-refresh lock-note">' . $l10n->__('lockBtn') . '<span></span></button>' : '') . (\Ventus\Utilities\Functions::getModuleNameFromURL() !== "counselling-reception" ? '<button name="' . $r['post_triage_id'] . '" class="btn-maroon btn-icon btn-cross delete-note">' . $l10n->__('deleteBtn') . '<span></span></button>' : '') . ' </span></td></tr>'; } } if (!$unlocked_exists) { echo '<tr><td colspan="3" class="table-placeholder">' . $l10n->__('noUnlockedNotes') . '</td></tr>'; } ?> </tbody> </table> </div> <div class="past-tables"> <h2><span data-ventus-icon='L' aria-hidden="true"></span><?php $l10n->_e('lockedSectionTitle'); ?>
$daysUntilExam = $examDate->diff($today)->days; if ($examDate < $today || $daysUntilExam < STUDENT_RESPONSE_TO_EXAM_ALLOWED_UNTIL_DAYS_BEFORE_EXAM) { //Exam is no longer eligible for a response $unset = true; } } if (!$unset) { $all_exams_awaiting_reponse[] = array('exam_request_id' => $exams_awaiting_response_for_course[$i]['exam_request_id'], 'course' => strtoupper($exams_awaiting_response_for_course[$i]['course_code'] . ' ' . $exams_awaiting_response_for_course[$i]['course_section'] . ' ' . $exams_awaiting_response_for_course[$i]['teach_method']), 'exam_type' => $exams_awaiting_response_for_course[$i]['exam_type'], 'exam_alternate_special' => $exams_awaiting_response_for_course[$i]['exam_alternate_special'] === "none" ? '' : $exams_awaiting_response_for_course[$i]['exam_alternate_special'], 'exam_duration' => $exams_awaiting_response_for_course[$i]['exam_duration'] . ' min.', 'exam_date' => date(DATETIME_MYSQL, strtotime($exams_awaiting_response_for_course[$i]['exam_date']))); } else { $upcoming_exams_in_class[] = array('exam_date' => $exams_awaiting_response_for_course[$i]['exam_date'], 'exam_type' => $exams_awaiting_response_for_course[$i]['exam_type'], 'course_code' => $exams_awaiting_response_for_course[$i]['course_code'], 'course_section' => $exams_awaiting_response_for_course[$i]['course_section'], 'teach_method' => $exams_awaiting_response_for_course[$i]['teach_method'], 'exam_alternate_special' => $exams_awaiting_response_for_course[$i]['exam_alternate_special'], 'reason' => 'reasonTimeElapsed'); } } } } \Ventus\Utilities\Functions::sortByKey($all_exams_awaiting_reponse, "exam_date"); \Ventus\Utilities\Functions::sortByKey($upcoming_exams_in_class, "exam_date"); $l10nFile = 'l10n/exams.php'; $viewFile = 'views/exams.php'; } } else { require_once FS_PHP . '/error.php'; } /** * View rendering */ if (isset($render) && $render) { $follow_up_pending_count = $follow->fetchFollowUpsCountEmployee($SESSION->user_id); $l10n->addResource(__DIR__ . '/l10n/menu.json'); if (isset($l10nFile) && file_exists($l10nFile)) { require $l10nFile; }
$endDate = new \DateTime($default_date_range['end']); } $startDate = $startDate->format('Y-m-d'); $endDate = $endDate->format('Y-m-d'); $denied_requests = $denied->fetchDeniedExamRequests($startDate, $endDate); foreach ($denied_requests as &$req) { $req["dropped"] = $model->determineDropped($req); } unset($req); $l10n->addResource(__DIR__ . '/l10n/denied-requests.json'); $viewFile = 'views/denied-requests.php'; } elseif ($_GET['page'] === 'undo-denial') { $denied->undoDenial($_GET); $loggers['audit']->info("Removed denied request (in-class request) for student {$_GET['student_num']} for NOE {$_GET['exam_request_id']}"); if (!empty($_GET['start']) && !empty($_GET['end'])) { if (\Ventus\Utilities\Functions::checkIfStringIsDate($_GET['start']) && \Ventus\Utilities\Functions::checkIfStringIsDate($_GET['end'])) { header('Location: denied-requests.php?start=' . $_GET['start'] . '&end=' . $_GET['end']); } else { header('Location: denied-requests.php'); } die; } else { header('location:denied-requests.php'); die; } } elseif ($_GET['page'] === "export") { $l10n->addResource(FS_L10N . '/filenames.json'); $l10n->addResource(__DIR__ . '/l10n/denied-requests.json'); $result = $denied->fetchDeniedExamRequestsForExport($_GET['start'], $_GET['end']); foreach ($result as &$r) { $r["column4"] = $l10n->__($r["column4"]);
require_once FS_PHP . '/header-external.php'; require_once 'views/exam-requests.php'; require_once FS_PHP . '/footer-external.php'; } elseif ($_GET['page'] === "confirm-participation") { if (!isset($_POST['eid'])) { $loggers['audit']->error('Attempted to confirm exam participation at Access Service without NOE ID.'); header('Location: exam-requests.php'); die; } $count_pending_follow_ups = $dashboard->fetchCountPendingFollowUps($SESSION->student_num); $exam_still_awaiting_response = $model->verifyExamAwaitingResponse($SESSION->student_num, $_POST['eid']); if (!empty($exam_still_awaiting_response)) { $extra_time_allowed = null; $all_active_exam_accommodations = array(); //We must also check to see if the student has opted out $opted_out = \Ventus\Utilities\Functions::checkIfStudentHasOptedOut($SESSION->student_num, $exam_still_awaiting_response['course_code'], $exam_still_awaiting_response['course_section'], $exam_still_awaiting_response['session']); if (!$opted_out) { $all_active_exam_accommodations = $profile->fetchAllStudentActiveExamAndTranscriptionAccommodations($SESSION->student_num, $exam_still_awaiting_response['exam_date'], $exam_still_awaiting_response['course_code'], $exam_still_awaiting_response['course_section'], $exam_still_awaiting_response['session']); //Check all the possible allowed accommodations to see if the student has extra time foreach ($all_active_exam_accommodations as $a) { if ($a['type'] === "Extra time") { $extra_time_allowed = explode(" ", $a['name_en']); //Get the last bit of the name of the acc. resulting in the percentage value } } } $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/exam-confirm-participation.json'); $l10n->localizeArray($all_active_exam_accommodations, 'name'); require_once FS_PHP . '/header-external.php'; require_once 'views/exam-confirm-participation.php';
$quick_stat_3_changed = true; $count_exams_no_control_sheet++; } } //Compile all data into a well formatted array $course_prof_student_request[] = array('class_id' => $c['class_id'], 'course_code' => $c['course_code'], 'course_section' => $c['course_section'], 'teach_method' => $c['teaching_method'], 'date' => $c['date'], 'exam_type' => $c['exam_type'], 'exam_duration' => $c['exam_duration'], 'exam_alternate_special' => $c['exam_alternate_special'], 'exam_alternate_special_student' => $c['exam_alternate_special_student'], 'contact_name' => $c['contact_name'], 'contact_number' => $c['contact_number'], 'requestor_email' => $c['requestor_email'], 'inserted_on' => $c['inserted_on'], 'exam_request_id' => $c['exam_request_id'], 'session' => $c['session'], 'control_sheet' => $c['control_sheet'], 'file' => $c['file'], 'professor_email' => $c['professor_email'], 'professor_name' => $c['professor_name'], 'quick_stat_1' => $quick_stat_1_changed, 'quick_stat_2' => $quick_stat_2_changed, 'quick_stat_3' => $quick_stat_3_changed); } } } $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/list-exams.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/list-exams.php'; require_once FS_PHP . '/footer-external.php'; } elseif ($_GET['page'] === "fetch-student-statuses") { $noe_students = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $_POST['course_code'], $_POST['course_section'], $_POST['session'], $_POST['request_id']); foreach ($noe_students as $n) { $student_exam_status = $model->fetchStudentAcceptanceStatus($n['student_num'], $_POST['request_id']); if (!is_string($student_exam_status)) { $sDate = date("Y-m-d", strtotime($student_exam_status['startDate'])); $eDate = date("Y-m-d", strtotime($student_exam_status['endDate'])); $student_exam_status = "accepted:" . $student_exam_status['request_id']; } else { $sDate = date("Y-m-d", strtotime($_POST['exam_date'])); $eDate = date("Y-m-d", strtotime($_POST['exam_date'])); } $noe_students_array[] = array('student_num' => $n['student_num'], 'last_name' => $n['last_name'], 'first_name' => $n['first_name'], 'email' => trim($n['email']), 'startDate' => $sDate, 'endDate' => $eDate, 'status' => $student_exam_status); } $noe_confirmed_dropped_students = $model->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']);
$examFiles = new \Ventus\Exams\ExamFiles($dbo); 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']); //Fetch all the students in this course and then remove the ones that have opted out $students_in_course = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $request_details[0]['course_code'], $request_details[0]['course_section'], $request_details[0]['session']); $request_details[0]['session_code'] = $request_details[0]['session']; $request_details[0]['session'] = \Ventus\Utilities\Functions::convertCodeToString($request_details[0]['session'], $l10n); $existing_files = $examFiles->fetchFiles($_POST['rid']); foreach ($existing_files as $key => $ef) { $students_for_file = $examFiles->fetchStudentsForFile($ef['id']); $existing_files[$key]['student_list'] = implode(',', $students_for_file); } //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 = $examFiles->isFilesEditable($request_details[0]['exam_date']); $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/request-documents.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/request-documents.php'; require_once FS_PHP . '/footer-external.php'; } else { header('Location: list-courses.php'); exit;
$l10n->_e('colActive'); ?> </th> <th></th> </tr> </thead> <tbody> <?php if (empty($sentEmails)) { echo '<tr><td colspan="6" class="table-placeholder">' . $l10n->__('emailsEmpty') . '</td></tr>'; } foreach ($sentEmails as $s) { echo '<tr data-email-letter-id="' . $s['id'] . '"><td>' . $s['name'] . '</td> <td>' . $s['first_name'] . ' ' . $s['last_name'] . '</td> <td>' . $l10nDate->format($s['inserted_on'], 'day_date_time') . '</td> <td>' . (!empty($s['course_code']) ? $s['course_code'] . ' ' . $s['course_section'] . ' (' . \Ventus\Utilities\Functions::convertCodeToString($s['session'], $l10n) . ')' : 'N/A') . '</td> <td>' . '<span class="buttonset"> <input class="switch-hidden-status" value="0" type="radio" name="email_visibility_' . $s['id'] . '" id="email_visibility_yes_' . $s['id'] . '" ' . ($s['hidden'] === "0" ? 'checked' : null) . '><label for="email_visibility_yes_' . $s['id'] . '">' . $l10n->__('activeYes') . '</label> <input class="switch-hidden-status" value="1" type="radio" name="email_visibility_' . $s['id'] . '" id="email_visibility_no_' . $s['id'] . '" ' . ($s['hidden'] === "1" ? 'checked' : null) . '><label for="email_visibility_no_' . $s['id'] . '">' . $l10n->__('activeNo') . '</label> </span>' . ' </td> <td><button name="' . $s['id'] . '" template-name="' . $s['name'] . '" for="email" class="btn-maroon btn-icon btn-arrow-right view-email">' . $l10n->__('viewEmailBtn') . '<span></span></button></td></tr>'; } ?> </tbody> </table> </div> <div class='ui-helper-hidden' id="sendTemplate"> <img class="loader" src="../includes/img/search-loader-light.gif" alt="<?php
$bursary = new Bursaries($dbo); $follow = new FollowUps($dbo); $courses = new Courses($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; if (!empty($studentProfile)) { $thisPage = 'fund'; $followupcount = $follow->fetchFollowUpsCountStudent($_GET['student_num']); $poccount = $profile->countUnlockedPOC($_GET['student_num']); $semester = \Ventus\Utilities\Functions::fetchSemester(); $current_courses = $courses->fetchAllStudentCoursesForSemester($_GET['student_num'], $semester['now_short']); $osap = $bursary->listOsapBursaries($_GET['student_num']); $other = $bursary->listOtherBursaries($_GET['student_num']); $bswd = $bursary->listBswdBursaries($_GET['student_num']); $quebec = $bursary->listQuebecBursaries($_GET['student_num']); $uo = $bursary->listUOBursaries($_GET['student_num']); $l10n->addResource(__DIR__ . '/l10n/bursaries.json'); $viewFile = 'views/bursaries.php'; } } elseif ($_GET['page'] === "add") { $last_added = $bursary->addBursary($_POST); $loggers['audit']->info("Bursary added"); echo $last_added; } elseif ($_GET['page'] === "getosap") { $osapdata = $bursary->getOsapBursary($_POST['id']);
/** * search student by Hash Code * @param string $date The datetime survey email sent on * @return bool */ public function checkSessionExpire($date) { $semester = \Ventus\Utilities\Functions::fetchSemester(); $survey_end = \DateTime::createFromFormat(DATETIME_MYSQL, $semester['session_start'])->modify('+' . SURVEY_EXPIRY_DAYS . 'day'); return $survey_end < new \DateTime(); }