74 : string
75 {
77
78 self::$counter++;
79
80 $this->tpl =
new ilTemplate(
'tpl.appointment_panel.html',
true,
true,
'Services/Calendar');
81
82
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'));
87 } else {
88 $this->tpl->setVariable(
'PANEL_DETAILS', $this->
lng->txt(
'cal_details'));
89 }
90 $this->tpl->setVariable(
'PANEL_TXT_DATE', $this->
lng->txt(
'date'));
91
92 if ($a_app['fullday']) {
96 ));
97 } else {
101 ));
102 }
103 if ($a_app['event']->getLocation()) {
104 $this->tpl->setVariable(
'PANEL_TXT_WHERE', $this->
lng->txt(
'cal_where'));
106 }
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())));
110 }
111
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() . " %");
115 }
116
117 if ($a_app['event']->isMilestone()) {
118
119 $users = $a_app['event']->readResponsibleUsers();
120 $delim = "";
121 $value = '';
122 foreach ($users as $r) {
123 $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
124 $delim = "<br />";
125 }
126 if (count($users) > 0) {
127 $this->tpl->setVariable(
'PANEL_TXT_RESP', $this->
lng->txt(
'cal_responsible'));
128 $this->tpl->setVariable('PANEL_RESP', $value);
129 }
130 }
131
134 $entry_obj_id = $cat_info['subitem_obj_ids'][$cat_id] ?? $cat_info['obj_id'];
135
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'));
140 break;
141
143 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_type_personal'));
144 break;
145
148 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_type_' .
$type));
149
150
151 if ($this->
settings->isCGRegistrationEnabled() and
$type ==
'crs' or
$type ==
'grp') {
152 if (!$a_app['event']->isAutoGenerated()) {
154
155 if ($reg->isRegistered(
156 $this->user->getId(),
159 )) {
160 $this->tpl->setCurrentBlock('panel_cancel_book_link');
161 $this->
ctrl->setParameterByClass(
162 'ilcalendarappointmentgui',
163 'seed',
165 );
166 $this->
ctrl->setParameterByClass(
167 'ilcalendarappointmentgui',
168 'app_id',
169 $a_app['event']->getEntryId()
170 );
171 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart', $a_app[
'dstart']);
172 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend', $a_app[
'dend']);
173
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')
178 );
179 $this->tpl->parseCurrentBlock();
180 } else {
181 $this->tpl->setCurrentBlock('panel_book_link');
182 $this->
ctrl->setParameterByClass(
183 'ilcalendarappointmentgui',
184 'seed',
186 );
187 $this->
ctrl->setParameterByClass(
188 'ilcalendarappointmentgui',
189 'app_id',
190 $a_app['event']->getEntryId()
191 );
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(
196 'PANEL_BOOK_HREF',
197 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmRegister')
198 );
199 $this->tpl->parseCurrentBlock();
200 }
201
202 $registrations = array();
203 foreach ($reg->getRegisteredUsers(
206 ) as $usr_data) {
207 $usr_id = $usr_data;
208 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user', $usr_id);
209 $registrations[] =
'<a href="' . $this->
ctrl->getLinkTargetByClass(
210 'ilconsultationhoursgui',
211 'showprofile'
213 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
214 }
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')
220 );
221 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations));
222 $this->tpl->parseCurrentBlock();
223 }
224 }
225 }
226 break;
227
229 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_ch_ch'));
230
232
233 $is_owner = $entry->isOwner();
234 $user_entry = ($cat_info[
'obj_id'] == $this->
user->getId());
235
236 if ($user_entry && !$is_owner) {
237
239 $entry->getObjId(),
240 $a_app['event']->getContextId(),
241 $a_app['event']->getStart()
242 );
243 $ref_event = $apps[0];
244 } else {
245 $ref_event = $a_app['event']->getEntryId();
246 }
247
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();
252
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();
257
258 if (!$is_owner) {
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',
265 'seed',
267 );
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')
272 );
273 $this->tpl->parseCurrentBlock();
274 }
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',
281 'seed',
283 );
284 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->
lng->txt(
'cal_ch_book'));
285 $this->tpl->setVariable(
286 'PANEL_BOOK_HREF',
287 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'book')
288 );
289 $this->tpl->parseCurrentBlock();
290 }
291
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();
296 } else {
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();
305 }
306 if ($obj_ids) {
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();
310 }
311
312 $link_users = true;
314 $link_users = false;
315 }
316
317 $bookings = array();
318 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel', 1);
319 foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
320 if ($link_users) {
321 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user', $user_id);
322 $bookings[] =
'<a href="' . $this->
ctrl->getLinkTargetByClass(
323 'ilconsultationhoursgui',
324 'showprofile'
325 ) . '">' .
327 $this->
ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
328 } else {
330 }
331 }
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();
337 }
338 break;
339
341 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->
lng->txt(
'cal_ch_booking'));
342
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',
347 'seed',
349 );
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')
354 );
355 $this->tpl->parseCurrentBlock();
356 break;
357 }
358
359 $this->tpl->setVariable(
'PANEL_TXT_CAL_NAME', $this->
lng->txt(
'cal_calendar_name'));
360 $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']);
361
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'));
365
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(
371 'PANEL_EDIT_HREF',
372 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askEdit')
373 );
374
375 $this->tpl->setCurrentBlock('panel_delete_link');
376 $this->tpl->setVariable(
'TXT_PANEL_DELETE', $this->
lng->txt(
'delete'));
377
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(
383 'PANEL_DELETE_HREF',
384 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askdelete')
385 );
386 $this->tpl->parseCurrentBlock();
387 }
394
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);
402 }
403
404 return $this->tpl->get();
405 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MODE_PORTFOLIO_CONSULTATION
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupCategory(int $a_cal_id)
registration for calendar appointments
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 formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
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.
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
static _lookupFullname(int $a_user_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
special template class to simplify handling of ITX/PEAR
static makeClickable(string $a_text, bool $detectGotoLinks=false)