示例#1
0
    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);
    $l10n->addResource(FS_SPECIALIST . '/l10n/follow-ups.json');
    $viewFile = '../specialist/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");