/** * set appointments * * @access public * @return */ public function setAppointments($a_apps) { include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $cat = new ilCalendarCategory($this->cat_id); foreach ($a_apps as $cal_entry_id) { $entry = new ilCalendarEntry($cal_entry_id); $rec = ilCalendarRecurrences::_getFirstRecurrence($entry->getEntryId()); // booking if ($cat->getType() == ilCalendarCategory::TYPE_CH) { include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $book = new ilBookingEntry($entry->getContextId()); if ($book) { $title = $entry->getTitle(); if ($book->isOwner()) { $max = (int) $book->getNumberOfBookings(); $current = (int) $book->getCurrentNumberOfBookings($entry->getEntryId()); if ($max > 1) { $title .= ' (' . $current . '/' . $max . ')'; } else { if ($current == $max) { $title .= ' (' . $this->lng->txt('cal_booked_out') . ')'; } else { $title .= ' (' . $this->lng->txt('cal_book_free') . ')'; } } } else { if ($book->hasBooked($entry->getEntryId())) { $title .= ' (' . $this->lng->txt('cal_date_booked') . ')'; } } } } else { $title = $entry->getPresentationTitle(); } $tmp_arr['id'] = $entry->getEntryId(); $tmp_arr['title'] = $title; $tmp_arr['description'] = $entry->getDescription(); $tmp_arr['fullday'] = $entry->isFullday(); $tmp_arr['begin'] = $entry->getStart()->get(IL_CAL_UNIX); $tmp_arr['end'] = $entry->getEnd()->get(IL_CAL_UNIX); $tmp_arr['dt_sort'] = $entry->getStart()->get(IL_CAL_UNIX); $tmp_arr['dt'] = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()); #$tmp_arr['duration'] = ($dur = $tmp_arr['end'] - $tmp_arr['begin']) ? $dur : 60 * 60 * 24; $tmp_arr['duration'] = $tmp_arr['end'] - $tmp_arr['begin']; if ($tmp_arr['fullday']) { $tmp_arr['duration'] += 60 * 60 * 24; } if (!$tmp_arr['fullday'] and $tmp_arr['end'] == $tmp_arr['begin']) { $tmp_arr['duration'] = ''; } $tmp_arr['frequence'] = $rec->getFrequenceType(); $tmp_arr['deletable'] = (!$entry->isAutoGenerated() and $this->is_editable); $appointments[] = $tmp_arr; } $this->setData($appointments ? $appointments : array()); }
/** * Confirmation screen for booking of consultation appointment */ public function book() { global $ilUser, $tpl; $entry = (int) $_GET['app_id']; $user = (int) $_GET['bkid']; $this->ctrl->saveParameter($this, 'app_id'); include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $entry = new ilCalendarEntry($entry); $form = $this->initFormConfirmBooking(); $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd())); $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')'); $tpl->setContent($form->getHTML()); return true; }
/** * Confirmation screen for booking of consultation appointment */ public function book() { global $ilUser, $tpl; $entry = (int) $_GET['app_id']; $user = (int) $_GET['bkid']; include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $entry = new ilCalendarEntry($entry); $booking = new ilBookingEntry($entry->getContextId()); $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId()); $timezone = $ilUser->getTimeZone(); switch ($user_settings->getTimeFormat()) { case ilCalendarSettings::TIME_FORMAT_24: $title = $entry->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $timezone); $title .= "-" . $entry->getEnd()->get(IL_CAL_FKT_DATE, 'H:i', $timezone); break; case ilCalendarSettings::TIME_FORMAT_12: $title = $entry->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $timezone); $title .= "-" . $entry->getEnd()->get(IL_CAL_FKT_DATE, 'h:ia', $timezone); break; } $title .= ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')'; include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php'; $conf = new ilConfirmationGUI(); $conf->setFormAction($this->ctrl->getFormAction($this)); $conf->setHeaderText($this->lng->txt('cal_confirm_booking_info')); $conf->setConfirm($this->lng->txt('cal_confirm_booking'), 'bookconfirmed'); $conf->setCancel($this->lng->txt('cancel'), 'cancel'); $conf->addItem('app_id', $entry->getEntryId(), $title); $tpl->setContent($conf->getHTML()); }