示例#1
0
 /**
  * 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);
         }
     }
 }
示例#2
0
文件: calendar.php 项目: hughnguy/php
$SESSION = new \Zend_Session_Namespace('internal', true);
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") {
示例#3
0
文件: profile.php 项目: hughnguy/php
$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']}");
示例#4
0
require FS_L10N . '/header-external.php';
//============================================================================================
// Load the content
//============================================================================================
$this_page = "book-appointment";
if (!isset($_GET['page'])) {
    $l10n->addResource(__DIR__ . '/l10n/header.json');
    $l10n->addResource(__DIR__ . '/l10n/book-appointment.json');
    $departments = $app->getDepartmentsWithStudentAppointments();
    $l10n->localizeArray($departments, 'name');
    require_once FS_PHP . '/header-external.php';
    require_once 'views/book-appointment.php';
    require_once FS_PHP . '/footer-external.php';
} else {
    if ($_GET['page'] === "get-employees-for-department") {
        $employees = \Ventus\Utilities\Functions::listEmployees($_GET['id']);
        header('Content-Type: application/json; charset=utf-8');
        echo json_encode($employees);
        exit;
    } elseif ($_GET['page'] === "book-open") {
        $_POST['student'] = $SESSION->student_num;
        // if student has booked more than 2 appointments from now onwards for a specific department, don't let them book any more
        $data['student_app_count'] = $app->getAppointmentsBookedByStudentCount($_POST['appointment_type_id'], $_POST['student']);
        if ($data['student_app_count'] >= STUDENT_APPOINTMENT_MAX_APPOINTMENTS) {
            $data['success'] = false;
        } else {
            $start = new \DateTime($_POST['appointment_start']);
            $end = $start->add(new \DateInterval("PT55M"))->format(DATETIME_MYSQL);
            $data = $app->bookAppointment($_POST['appointment_type_id'], $_POST['appointment_start'], $end, $_POST['student'], $_POST['emp_id']);
            $data['remaining'] = $app->getAppointmentCount($_POST['appointment_type_id'], $_POST['appointment_start']);
            $data['appointment_start'] = $_POST['appointment_start'];