} $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'); echo json_encode($message_array); exit; } elseif ($_GET['page'] === "message") { $model->addFollowUpMessage($SESSION->student_num, $_POST['message'], $_POST['follow_up_id']); $loggers['audit']->info("Follow-up message added to follow-up {$_POST['follow_up_id']}"); } else { header('location: https://' . URL_PHP . '/error-external.php?eid=S004');
$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); $l10n->addResource(__DIR__ . '/l10n/follow-ups.json'); $viewFile = 'views/follow-ups.php'; } } elseif ($_GET['page'] === "add") { $follow->addFollowUp($_POST, $_POST['message'], $_POST['to_emp_class'], $_POST['to_emp_val'], "employee"); $loggers['audit']->info("Follow-up added"); } elseif ($_GET['page'] === "switch") { $follow->switchStatus($SESSION->user_id, $_POST['follow_up_id'], $_POST['completion_status']); $loggers['audit']->info("Follow-up {$_POST['follow_up_id']} completion status changed to {$_POST['completion_status']}"); } elseif ($_GET['page'] === "fetch") { $follow_up_messages = $follow->getFollowUpMessages($_POST['follow_up_id']); foreach ($follow_up_messages as $f) { $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($f['inserted_on'], 'date_time_without_year'), 'inserted_on_stamp' => strtotime($f['inserted_on']) * 1000, 'message' => $f['message']); } header('Content-Type: application/json; charset=utf-8'); echo json_encode($message_array); exit; } elseif ($_GET['page'] === "message") { $follow->addFollowUpMessage($SESSION->user_id, $_POST['follow_up_id'], $_POST['message'], 'employee'); $loggers['audit']->info("Message added to follow-up {$_POST['follow_up_id']}"); } elseif ($_GET['page'] === "delete") { $follow->removeFollowUp($_POST['follow_up_id']); $loggers['audit']->info("Follow-up {$_POST['follow_up_id']} deleted");