24 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
75 if(isset(self::$instance) and self::$instance)
100 global $tree,
$lng,$ilUser;
104 $this->tpl =
new ilTemplate(
'tpl.appointment_panel.html',
true,
true,
'Services/Calendar');
107 $this->tpl->setVariable(
'PANEL_NUM',self::$counter);
108 $this->tpl->setVariable(
'PANEL_TITLE', str_replace(
' ()',
'', $a_app[
'event']->getPresentationTitle()));
109 if ($a_app[
"event"]->isMilestone())
111 $this->tpl->setVariable(
'PANEL_DETAILS',$this->lng->txt(
'cal_ms_details'));
115 $this->tpl->setVariable(
'PANEL_DETAILS',$this->lng->txt(
'cal_details'));
117 $this->tpl->setVariable(
'PANEL_TXT_DATE',$this->lng->txt(
'date'));
119 if($a_app[
'fullday'])
131 if($a_app[
'event']->getLocation())
133 $this->tpl->setVariable(
'PANEL_TXT_WHERE',$this->lng->txt(
'cal_where'));
136 if($a_app[
'event']->getDescription())
138 $this->tpl->setVariable(
'PANEL_TXT_DESC',$this->lng->txt(
'description'));
139 $this->tpl->setVariable(
'PANEL_DESC',
ilUtil::makeClickable(nl2br($a_app[
'event']->getDescription())));
142 if($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
144 $this->tpl->setVariable(
'PANEL_TXT_COMPL',$this->lng->txt(
'cal_task_completion'));
145 $this->tpl->setVariable(
'PANEL_COMPL',$a_app[
'event']->getCompletion().
" %");
148 if ($a_app[
'event']->isMilestone())
151 $users = $a_app[
'event']->readResponsibleUsers();
153 foreach($users as $r)
155 $value.= $delim.$r[
"lastname"].
", ".$r[
"firstname"].
" [".$r[
"login"].
"]";
158 if (count($users) > 0)
160 $this->tpl->setVariable(
'PANEL_TXT_RESP', $this->lng->txt(
'cal_responsible'));
161 $this->tpl->setVariable(
'PANEL_RESP', $value);
165 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
168 $entry_obj_id = isset($cat_info[
'subitem_obj_ids'][$cat_id]) ?
169 $cat_info[
'subitem_obj_ids'][$cat_id] :
172 $this->tpl->setVariable(
'PANEL_TXT_CAL_TYPE',$this->lng->txt(
'cal_cal_type'));
173 switch($cat_info[
'type'])
176 $this->tpl->setVariable(
'PANEL_CAL_TYPE',$this->lng->txt(
'cal_type_system'));
180 $this->tpl->setVariable(
'PANEL_CAL_TYPE',$this->lng->txt(
'cal_type_personal'));
185 $this->tpl->setVariable(
'PANEL_CAL_TYPE',$this->lng->txt(
'cal_type_'.$type));
188 if($this->settings->isCGRegistrationEnabled() and
$type ==
'crs' or type ==
'grp')
190 if(!$a_app[
'event']->isAutoGenerated())
192 include_once
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
197 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
198 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
199 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
200 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart',$a_app[
'dstart']);
201 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend',$a_app[
'dend']);
203 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->lng->txt(
'cal_reg_unregister'));
204 $this->tpl->setVariable(
'PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmUnregister'));
205 $this->tpl->parseCurrentBlock();
209 $this->tpl->setCurrentBlock(
'panel_book_link');
210 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
211 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
212 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart',$a_app[
'dstart']);
213 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend',$a_app[
'dend']);
214 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->lng->txt(
'cal_reg_register'));
215 $this->tpl->setVariable(
'PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmRegister'));
216 $this->tpl->parseCurrentBlock();
219 include_once
'classes/class.ilLink.php';
220 $registrations = array();
224 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
$usr_id);
226 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
228 if(count($registrations))
230 $this->tpl->setCurrentBlock(
'panel_current_booking');
231 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->lng->txt(
'cal_reg_registered_users'));
232 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', implode(
'<br />', $registrations));
233 $this->tpl->parseCurrentBlock();
240 $this->tpl->setVariable(
'PANEL_CAL_TYPE',$this->lng->txt(
'cal_ch_ch'));
242 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
245 $is_owner = $entry->isOwner();
246 $user_entry = ($cat_info[
'obj_id'] == $ilUser->getId());
248 if($user_entry && !$is_owner)
251 include_once
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
253 $ref_event = $apps[0];
257 $ref_event = $a_app[
'event']->getEntryId();
260 $this->tpl->setCurrentBlock(
'panel_booking_owner');
261 $this->tpl->setVariable(
'PANEL_TXT_BOOKING_OWNER', $this->lng->txt(
'cal_ch_booking_owner'));
263 $this->tpl->parseCurrentBlock();
265 $this->tpl->setCurrentBlock(
'panel_max_booking');
266 $this->tpl->setVariable(
'PANEL_TXT_MAX_BOOKING', $this->lng->txt(
'cal_ch_num_bookings'));
267 $this->tpl->setVariable(
'PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
268 $this->tpl->parseCurrentBlock();
272 if($entry->hasBooked($ref_event))
274 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
275 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$ref_event);
276 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
277 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->lng->txt(
'cal_ch_cancel_booking'));
278 $this->tpl->setVariable(
'PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking'));
279 $this->tpl->parseCurrentBlock();
281 else if(!$entry->isBookedOut($ref_event))
283 $this->tpl->setCurrentBlock(
'panel_book_link');
284 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$ref_event);
285 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
286 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->lng->txt(
'cal_ch_book'));
287 $this->tpl->setVariable(
'PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'book'));
288 $this->tpl->parseCurrentBlock();
291 $this->tpl->setCurrentBlock(
'panel_current_booking');
292 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->lng->txt(
'cal_ch_current_bookings'));
293 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
294 $this->tpl->parseCurrentBlock();
298 $target = $entry->getTargetObjId();
301 global $ilObjDataCache;
303 $this->tpl->setCurrentBlock(
'panel_booking_target');
304 $this->tpl->setVariable(
'PANEL_TXT_BOOKING_TARGET', $this->lng->txt(
'cal_ch_target_object'));
305 $this->tpl->setVariable(
'PANEL_BOOKING_TARGET', $ilObjDataCache->lookupTitle($target));
306 $this->tpl->parseCurrentBlock();
309 include_once
'classes/class.ilLink.php';
311 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel',1);
312 foreach($entry->getCurrentBookings($a_app[
'event']->getEntryId()) as $user_id)
314 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',$user_id);
315 $bookings[] =
'<a href="'.$this->ctrl->getLinkTargetByClass(
'ilconsultationhoursgui',
'showprofile').
'">'.
ilObjUser::_lookupFullname($user_id);
316 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
318 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel',
'');
319 $this->tpl->setCurrentBlock(
'panel_current_booking');
320 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->lng->txt(
'cal_ch_current_bookings'));
321 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', implode(
'<br />', $bookings));
322 $this->tpl->parseCurrentBlock();
327 $this->tpl->setVariable(
'PANEL_CAL_TYPE',$this->lng->txt(
'cal_ch_booking'));
329 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
330 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
331 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
332 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->lng->txt(
'cal_ch_cancel_booking'));
333 $this->tpl->setVariable(
'PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking'));
334 $this->tpl->parseCurrentBlock();
338 $this->tpl->setVariable(
'PANEL_TXT_CAL_NAME',$this->lng->txt(
'cal_calendar_name'));
339 $this->tpl->setVariable(
'PANEL_CAL_NAME',$cat_info[
'title']);
342 if($cat_info[
'editable'] and !$a_app[
'event']->isAutoGenerated())
344 $this->tpl->setCurrentBlock(
'panel_edit_link');
345 $this->tpl->setVariable(
'TXT_PANEL_EDIT',$this->lng->txt(
'edit'));
347 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
348 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
349 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
350 $this->tpl->setVariable(
'PANEL_EDIT_HREF',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
352 $this->tpl->setCurrentBlock(
'panel_delete_link');
353 $this->tpl->setVariable(
'TXT_PANEL_DELETE',$this->lng->txt(
'delete'));
355 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
356 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->
getSeed()->
get(
IL_CAL_DATE));
357 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
358 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt',$a_app[
'dstart']);
359 $this->tpl->setVariable(
'PANEL_DELETE_HREF',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askdelete'));
360 $this->tpl->parseCurrentBlock();
362 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
369 $lng->txt(
'obj_'.
$type);
371 include_once(
'classes/class.ilLink.php');
373 $parent = $tree->getParentId(current($refs));
375 $this->tpl->setVariable(
'PANEL_TXT_LINK',$this->lng->txt(
'ext_link'));
376 $this->tpl->setVariable(
'PANEL_LINK_HREF',$href);
377 $this->tpl->setVariable(
'PANEL_LINK_NAME',
$title);
378 $this->tpl->setVariable(
'PANEL_PARENT',$parent_title);
381 return $this->tpl->get();