// Load the Model and L10N //============================================================================================ $model = new FollowUps($dbo); $dashboard = new Dashboard($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 //============================================================================================ $this_page = "followups"; if (!isset($_GET['page'])) { $count_pending_follow_ups = $dashboard->fetchCountPendingFollowUps($SESSION->student_num); $all_student_follow_ups = $model->listFollowUpsStudent($SESSION->student_num); $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/follow-ups.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/follow-ups.php'; require_once FS_PHP . '/footer-external.php'; } elseif ($_GET['page'] === "switch") { $model->switchStatus($SESSION->student_num, $_POST['completion_status'], $_POST['follow_up_id']); $loggers['audit']->info("Follow-up completion status changed to {$_POST['completion_status']} for follow-up {$_POST['follow_up_id']}"); } elseif ($_GET['page'] === "fetch") { $follow_up_messages = $model->getFollowUpMessages($_POST['follow_up_id']); foreach ($follow_up_messages as $f) { $insertedOnDate = \DateTime::createFromFormat(DATETIME_MYSQL, $f['inserted_on']); $message_array[] = array('sender_type' => $f['sender_type'], 'sender' => $f['sender'], 'emp_name' => $f['emp_first_name'] . ' ' . $f['emp_last_name'], 'student_name' => $f['first_name'] . ' ' . $f['last_name'], 'inserted_on' => $l10nDate->format($insertedOnDate, 'date_time'), 'inserted_on_stamp' => $insertedOnDate->getTimestamp() * 1000, 'message' => $f['message']); } header('Content-Type: application/json; charset=utf-8');
$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($_GET['for']) && ($_GET['for'] === 'student' && !empty($studentProfile) || $_GET['for'] === 'employee')) { if ($_GET['for'] === "student") { $thisPage = "follow"; $semester = \Ventus\Utilities\Functions::fetchSemester(); $current_courses = $courses->fetchAllStudentCoursesForSemester($_GET['student_num'], $semester['now_short']); $followups = $follow->listFollowUpsStudent($_GET['student_num']); $followupcount = $follow->fetchFollowUpsCountStudent($_GET['student_num']); $poccount = $profile->countUnlockedPOC($_GET['student_num']); } elseif ($_GET['for'] === "employee") { $thisPage = "GlobalFollowUps"; $followups = $follow->listFollowUpsEmployee($SESSION->user_id); } foreach ($followups as $key => $f) { $recipients = $follow->listFollowUpRecipients($f['follow_up_id']); $recipient_string = ""; foreach ($recipients as $r) { $recipient_string .= $r['first_name'] . ' ' . $r['last_name'] . ', '; } $followups[$key]['recipients'] = $recipient_string; } $emps = \Ventus\Utilities\Functions::listEmployees(SERVICE_ID_ACCESS);