80 $this->tpl =
new ilTemplate(
'tpl.appointment_panel.html',
true,
true,
'Services/Calendar');
83 $this->tpl->setVariable(
'PANEL_NUM', self::$counter);
84 $this->tpl->setVariable(
'PANEL_TITLE', str_replace(
' ()',
'', $a_app[
'event']->getPresentationTitle(
false)));
85 if ($a_app[
"event"]->isMilestone()) {
86 $this->tpl->setVariable(
'PANEL_DETAILS', $this->
lng->txt(
'cal_ms_details'));
88 $this->tpl->setVariable(
'PANEL_DETAILS', $this->
lng->txt(
'cal_details'));
90 $this->tpl->setVariable(
'PANEL_TXT_DATE', $this->
lng->txt(
'date'));
92 if ($a_app[
'fullday']) {
103 if ($a_app[
'event']->getLocation()) {
104 $this->tpl->setVariable(
'PANEL_TXT_WHERE', $this->
lng->txt(
'cal_where'));
107 if ($a_app[
'event']->getDescription()) {
108 $this->tpl->setVariable(
'PANEL_TXT_DESC', $this->
lng->txt(
'description'));
109 $this->tpl->setVariable(
'PANEL_DESC',
ilUtil::makeClickable(nl2br($a_app[
'event']->getDescription())));
112 if ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0) {
113 $this->tpl->setVariable(
'PANEL_TXT_COMPL', $this->
lng->txt(
'cal_task_completion'));
114 $this->tpl->setVariable(
'PANEL_COMPL', $a_app[
'event']->getCompletion() .
" %");
117 if ($a_app[
'event']->isMilestone()) {
119 $users = $a_app[
'event']->readResponsibleUsers();
122 foreach ($users as $r) {
123 $value .= $delim . $r[
"lastname"] .
", " . $r[
"firstname"] .
" [" . $r[
"login"] .
"]";
126 if (count($users) > 0) {
127 $this->tpl->setVariable(
'PANEL_TXT_RESP', $this->
lng->txt(
'cal_responsible'));
128 $this->tpl->setVariable(
'PANEL_RESP', $value);
134 $entry_obj_id = $cat_info[
'subitem_obj_ids'][$cat_id] ?? $cat_info[
'obj_id'];
136 $this->tpl->setVariable(
'PANEL_TXT_CAL_TYPE', $this->
lng->txt(
'cal_cal_type'));
137 switch ($cat_info[
'type']) {
139 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_type_system'));
143 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_type_personal'));
148 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_type_' .
$type));
151 if ($this->
settings->isCGRegistrationEnabled() and
$type ==
'crs' or $type ==
'grp') {
152 if (!$a_app[
'event']->isAutoGenerated()) {
155 if ($reg->isRegistered(
156 $this->user->getId(),
160 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
161 $this->
ctrl->setParameterByClass(
162 'ilcalendarappointmentgui',
166 $this->
ctrl->setParameterByClass(
167 'ilcalendarappointmentgui',
169 $a_app[
'event']->getEntryId()
171 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart', $a_app[
'dstart']);
172 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend', $a_app[
'dend']);
174 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->
lng->txt(
'cal_reg_unregister'));
175 $this->tpl->setVariable(
176 'PANEL_CANCELBOOK_HREF',
177 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmUnregister')
179 $this->tpl->parseCurrentBlock();
181 $this->tpl->setCurrentBlock(
'panel_book_link');
182 $this->
ctrl->setParameterByClass(
183 'ilcalendarappointmentgui',
187 $this->
ctrl->setParameterByClass(
188 'ilcalendarappointmentgui',
190 $a_app[
'event']->getEntryId()
192 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart', $a_app[
'dstart']);
193 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend', $a_app[
'dend']);
194 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->
lng->txt(
'cal_reg_register'));
195 $this->tpl->setVariable(
197 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmRegister')
199 $this->tpl->parseCurrentBlock();
202 $registrations = array();
203 foreach ($reg->getRegisteredUsers(
208 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user', $usr_id);
209 $registrations[] =
'<a href="' . $this->
ctrl->getLinkTargetByClass(
210 'ilconsultationhoursgui',
213 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
215 if (count($registrations)) {
216 $this->tpl->setCurrentBlock(
'panel_current_booking');
217 $this->tpl->setVariable(
218 'PANEL_TXT_CURRENT_BOOKING',
219 $this->
lng->txt(
'cal_reg_registered_users')
221 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', implode(
'<br />', $registrations));
222 $this->tpl->parseCurrentBlock();
229 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_ch_ch'));
233 $is_owner = $entry->isOwner();
234 $user_entry = ($cat_info[
'obj_id'] == $this->
user->getId());
236 if ($user_entry && !$is_owner) {
240 $a_app[
'event']->getContextId(),
241 $a_app[
'event']->getStart()
243 $ref_event = $apps[0];
245 $ref_event = $a_app[
'event']->getEntryId();
248 $this->tpl->setCurrentBlock(
'panel_booking_owner');
249 $this->tpl->setVariable(
'PANEL_TXT_BOOKING_OWNER', $this->
lng->txt(
'cal_ch_booking_owner'));
251 $this->tpl->parseCurrentBlock();
253 $this->tpl->setCurrentBlock(
'panel_max_booking');
254 $this->tpl->setVariable(
'PANEL_TXT_MAX_BOOKING', $this->
lng->txt(
'cal_ch_num_bookings'));
255 $this->tpl->setVariable(
'PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
256 $this->tpl->parseCurrentBlock();
259 if ($entry->hasBooked($ref_event)) {
261 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
262 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $ref_event);
263 $this->
ctrl->setParameterByClass(
264 'ilcalendarappointmentgui',
268 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->
lng->txt(
'cal_ch_cancel_booking'));
269 $this->tpl->setVariable(
270 'PANEL_CANCELBOOK_HREF',
271 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking')
273 $this->tpl->parseCurrentBlock();
275 } #
else if(!$entry->isBookedOut($ref_event))
276 elseif ($entry->isAppointmentBookableForUser($ref_event,
$GLOBALS[
'DIC'][
'ilUser']->getId())) {
277 $this->tpl->setCurrentBlock(
'panel_book_link');
278 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $ref_event);
279 $this->
ctrl->setParameterByClass(
280 'ilcalendarappointmentgui',
284 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->
lng->txt(
'cal_ch_book'));
285 $this->tpl->setVariable(
287 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'book')
289 $this->tpl->parseCurrentBlock();
292 $this->tpl->setCurrentBlock(
'panel_current_booking');
293 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->
lng->txt(
'cal_ch_current_bookings'));
294 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
295 $this->tpl->parseCurrentBlock();
297 $obj_ids = $entry->getTargetObjIds();
298 foreach ($obj_ids as $obj_id) {
301 $this->tpl->setCurrentBlock(
'panel_booking_target_row');
302 $this->tpl->setVariable(
'PANEL_BOOKING_TARGET_TITLE', $title);
303 $this->tpl->setVariable(
'PANEL_BOOKING_TARGET',
ilLink::_getLink(end($refs)));
304 $this->tpl->parseCurrentBlock();
307 $this->tpl->setCurrentBlock(
'panel_booking_target');
308 $this->tpl->setVariable(
'PANEL_TXT_BOOKING_TARGET', $this->
lng->txt(
'cal_ch_target_object'));
309 $this->tpl->parseCurrentBlock();
318 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel', 1);
319 foreach ($entry->getCurrentBookings($a_app[
'event']->getEntryId()) as $user_id) {
321 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user', $user_id);
322 $bookings[] =
'<a href="' . $this->
ctrl->getLinkTargetByClass(
323 'ilconsultationhoursgui',
327 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
332 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel',
'');
333 $this->tpl->setCurrentBlock(
'panel_current_booking');
334 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->
lng->txt(
'cal_ch_current_bookings'));
335 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', implode(
'<br />', $bookings));
336 $this->tpl->parseCurrentBlock();
341 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_ch_booking'));
343 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
344 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
345 $this->
ctrl->setParameterByClass(
346 'ilcalendarappointmentgui',
350 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->
lng->txt(
'cal_ch_cancel_booking'));
351 $this->tpl->setVariable(
352 'PANEL_CANCELBOOK_HREF',
353 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking')
355 $this->tpl->parseCurrentBlock();
359 $this->tpl->setVariable(
'PANEL_TXT_CAL_NAME', $this->
lng->txt(
'cal_calendar_name'));
360 $this->tpl->setVariable(
'PANEL_CAL_NAME', $cat_info[
'title']);
362 if ($cat_info[
'editable'] and !$a_app[
'event']->isAutoGenerated()) {
363 $this->tpl->setCurrentBlock(
'panel_edit_link');
364 $this->tpl->setVariable(
'TXT_PANEL_EDIT', $this->
lng->txt(
'edit'));
366 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
368 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
369 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt', $a_app[
'dstart']);
370 $this->tpl->setVariable(
372 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askEdit')
375 $this->tpl->setCurrentBlock(
'panel_delete_link');
376 $this->tpl->setVariable(
'TXT_PANEL_DELETE', $this->
lng->txt(
'delete'));
378 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
380 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
381 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt', $a_app[
'dstart']);
382 $this->tpl->setVariable(
384 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askdelete')
386 $this->tpl->parseCurrentBlock();
393 $this->
lng->txt(
'obj_' . $type);
396 $parent = $this->tree->getParentId(current($refs));
398 $this->tpl->setVariable(
'PANEL_TXT_LINK', $this->
lng->txt(
'ext_link'));
399 $this->tpl->setVariable(
'PANEL_LINK_HREF', $href);
400 $this->tpl->setVariable(
'PANEL_LINK_NAME', $title);
401 $this->tpl->setVariable(
'PANEL_PARENT', $parent_title);
404 return $this->tpl->get();
static _lookupCategory(int $a_cal_id)
static _lookupFullname(int $a_user_id)
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static getAppointmentIds(int $a_user_id, int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
static _lookupTitle(int $obj_id)
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
registration for calendar appointments
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
const MODE_PORTFOLIO_CONSULTATION
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
static _getInstance($a_usr_id=0)
get singleton instance
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static _lookupType(int $id, bool $reference=false)
static makeClickable(string $a_text, bool $detectGotoLinks=false)