24 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
75 if (isset(self::$instance) and self::$instance) {
76 return self::$instance;
103 $this->tpl =
new ilTemplate(
'tpl.appointment_panel.html',
true,
true,
'Services/Calendar');
107 $this->tpl->setVariable(
'PANEL_TITLE', str_replace(
' ()',
'', $a_app[
'event']->getPresentationTitle(
false)));
108 if ($a_app[
"event"]->isMilestone()) {
109 $this->tpl->setVariable(
'PANEL_DETAILS', $this->lng->txt(
'cal_ms_details'));
111 $this->tpl->setVariable(
'PANEL_DETAILS', $this->lng->txt(
'cal_details'));
113 $this->tpl->setVariable(
'PANEL_TXT_DATE', $this->lng->txt(
'date'));
115 if ($a_app[
'fullday']) {
126 if ($a_app[
'event']->getLocation()) {
127 $this->tpl->setVariable(
'PANEL_TXT_WHERE', $this->lng->txt(
'cal_where'));
130 if ($a_app[
'event']->getDescription()) {
131 $this->tpl->setVariable(
'PANEL_TXT_DESC', $this->lng->txt(
'description'));
132 $this->tpl->setVariable(
'PANEL_DESC',
ilUtil::makeClickable(nl2br($a_app[
'event']->getDescription())));
135 if ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0) {
136 $this->tpl->setVariable(
'PANEL_TXT_COMPL', $this->lng->txt(
'cal_task_completion'));
137 $this->tpl->setVariable(
'PANEL_COMPL', $a_app[
'event']->getCompletion() .
" %");
140 if ($a_app[
'event']->isMilestone()) {
142 $users = $a_app[
'event']->readResponsibleUsers();
145 $value.= $delim . $r[
"lastname"] .
", " . $r[
"firstname"] .
" [" . $r[
"login"] .
"]";
149 $this->tpl->setVariable(
'PANEL_TXT_RESP', $this->lng->txt(
'cal_responsible'));
150 $this->tpl->setVariable(
'PANEL_RESP', $value);
154 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
157 $entry_obj_id = isset($cat_info[
'subitem_obj_ids'][$cat_id]) ?
158 $cat_info[
'subitem_obj_ids'][$cat_id] :
161 $this->tpl->setVariable(
'PANEL_TXT_CAL_TYPE', $this->lng->txt(
'cal_cal_type'));
162 switch ($cat_info[
'type']) {
164 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_type_system'));
168 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_type_personal'));
173 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_type_' .
$type));
176 if ($this->
settings->isCGRegistrationEnabled() and
$type ==
'crs' or $type ==
'grp') {
177 if (!$a_app[
'event']->isAutoGenerated()) {
178 include_once
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
182 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
183 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
184 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
185 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart', $a_app[
'dstart']);
186 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend', $a_app[
'dend']);
188 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->lng->txt(
'cal_reg_unregister'));
189 $this->tpl->setVariable(
'PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmUnregister'));
190 $this->tpl->parseCurrentBlock();
192 $this->tpl->setCurrentBlock(
'panel_book_link');
193 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
194 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
195 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dstart', $a_app[
'dstart']);
196 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dend', $a_app[
'dend']);
197 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->lng->txt(
'cal_reg_register'));
198 $this->tpl->setVariable(
'PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'confirmRegister'));
199 $this->tpl->parseCurrentBlock();
202 include_once
'./Services/Link/classes/class.ilLink.php';
203 $registrations =
array();
205 $usr_id = $usr_data[
'usr_id'];
206 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user', $usr_id);
207 $registrations[] =
'<a href="' . $this->ctrl->getLinkTargetByClass(
'ilconsultationhoursgui',
'showprofile') .
'">' .
ilObjUser::_lookupFullname($usr_id);
208 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
210 if (count($registrations)) {
211 $this->tpl->setCurrentBlock(
'panel_current_booking');
212 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->lng->txt(
'cal_reg_registered_users'));
213 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', implode(
'<br />', $registrations));
214 $this->tpl->parseCurrentBlock();
221 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_ch_ch'));
223 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
226 $is_owner = $entry->isOwner();
227 $user_entry = ($cat_info[
'obj_id'] == $ilUser->getId());
229 if ($user_entry && !$is_owner) {
231 include_once
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
233 $ref_event = $apps[0];
235 $ref_event = $a_app[
'event']->getEntryId();
238 $this->tpl->setCurrentBlock(
'panel_booking_owner');
239 $this->tpl->setVariable(
'PANEL_TXT_BOOKING_OWNER', $this->lng->txt(
'cal_ch_booking_owner'));
241 $this->tpl->parseCurrentBlock();
243 $this->tpl->setCurrentBlock(
'panel_max_booking');
244 $this->tpl->setVariable(
'PANEL_TXT_MAX_BOOKING', $this->lng->txt(
'cal_ch_num_bookings'));
245 $this->tpl->setVariable(
'PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
246 $this->tpl->parseCurrentBlock();
249 if ($entry->hasBooked($ref_event)) {
251 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
252 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $ref_event);
253 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
254 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->lng->txt(
'cal_ch_cancel_booking'));
255 $this->tpl->setVariable(
'PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking'));
256 $this->tpl->parseCurrentBlock();
259 #else if(!$entry->isBookedOut($ref_event)) 260 elseif ($entry->isAppointmentBookableForUser($ref_event,
$GLOBALS[
'ilUser']->getId())) {
261 $this->tpl->setCurrentBlock(
'panel_book_link');
262 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $ref_event);
263 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
264 $this->tpl->setVariable(
'TXT_PANEL_BOOK', $this->lng->txt(
'cal_ch_book'));
265 $this->tpl->setVariable(
'PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'book'));
266 $this->tpl->parseCurrentBlock();
269 $this->tpl->setCurrentBlock(
'panel_current_booking');
270 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->lng->txt(
'cal_ch_current_bookings'));
271 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
272 $this->tpl->parseCurrentBlock();
274 $obj_ids = $entry->getTargetObjIds();
275 foreach ($obj_ids as $obj_id) {
278 include_once
'./Services/Link/classes/class.ilLink.php';
279 $this->tpl->setCurrentBlock(
'panel_booking_target_row');
280 $this->tpl->setVariable(
'PANEL_BOOKING_TARGET_TITLE',
$title);
281 $this->tpl->setVariable(
'PANEL_BOOKING_TARGET',
ilLink::_getLink(end($refs)));
282 $this->tpl->parseCurrentBlock();
285 $this->tpl->setCurrentBlock(
'panel_booking_target');
286 $this->tpl->setVariable(
'PANEL_TXT_BOOKING_TARGET', $this->lng->txt(
'cal_ch_target_object'));
287 $this->tpl->parseCurrentBlock();
295 include_once
'./Services/Link/classes/class.ilLink.php';
297 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel', 1);
298 foreach ($entry->getCurrentBookings($a_app[
'event']->getEntryId()) as $user_id) {
300 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user', $user_id);
301 $bookings[] =
'<a href="' . $this->ctrl->getLinkTargetByClass(
'ilconsultationhoursgui',
'showprofile') .
'">' .
303 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'user',
'');
308 $this->ctrl->setParameterByClass(
'ilconsultationhoursgui',
'panel',
'');
309 $this->tpl->setCurrentBlock(
'panel_current_booking');
310 $this->tpl->setVariable(
'PANEL_TXT_CURRENT_BOOKING', $this->lng->txt(
'cal_ch_current_bookings'));
311 $this->tpl->setVariable(
'PANEL_CURRENT_BOOKING', implode(
'<br />', $bookings));
312 $this->tpl->parseCurrentBlock();
317 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_ch_booking'));
319 $this->tpl->setCurrentBlock(
'panel_cancel_book_link');
320 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
321 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
322 $this->tpl->setVariable(
'TXT_PANEL_CANCELBOOK', $this->lng->txt(
'cal_ch_cancel_booking'));
323 $this->tpl->setVariable(
'PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking'));
324 $this->tpl->parseCurrentBlock();
328 $this->tpl->setVariable(
'PANEL_TXT_CAL_NAME', $this->lng->txt(
'cal_calendar_name'));
329 $this->tpl->setVariable(
'PANEL_CAL_NAME', $cat_info[
'title']);
332 if ($cat_info[
'editable'] and !$a_app[
'event']->isAutoGenerated()) {
333 $this->tpl->setCurrentBlock(
'panel_edit_link');
334 $this->tpl->setVariable(
'TXT_PANEL_EDIT', $this->lng->txt(
'edit'));
336 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
337 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
338 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
339 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt', $a_app[
'dstart']);
340 $this->tpl->setVariable(
'PANEL_EDIT_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askEdit'));
342 $this->tpl->setCurrentBlock(
'panel_delete_link');
343 $this->tpl->setVariable(
'TXT_PANEL_DELETE', $this->lng->txt(
'delete'));
345 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
346 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
347 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
348 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt', $a_app[
'dstart']);
349 $this->tpl->setVariable(
'PANEL_DELETE_HREF', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'askdelete'));
350 $this->tpl->parseCurrentBlock();
352 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
358 $lng->txt(
'obj_' .
$type);
360 include_once(
'./Services/Link/classes/class.ilLink.php');
362 $parent = $tree->getParentId(current($refs));
364 $this->tpl->setVariable(
'PANEL_TXT_LINK', $this->lng->txt(
'ext_link'));
365 $this->tpl->setVariable(
'PANEL_LINK_HREF', $href);
366 $this->tpl->setVariable(
'PANEL_LINK_NAME',
$title);
367 $this->tpl->setVariable(
'PANEL_PARENT', $parent_title);
370 return $this->tpl->get();
static _lookupCategory($a_cal_id)
Lookup category id.
static _getInstance()
get singleton instance
__construct(ilDate $seed=null)
Singleton.
static _lookupFullname($a_user_id)
Lookup Full Name.
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjId($a_id)
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
registration for calendar appointments
special template class to simplify handling of ITX/PEAR
const MODE_PORTFOLIO_CONSULTATION
static _getInstance($a_usr_id=0)
get singleton instance
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
GUI class for YUI appointment panels.
static _getInstance(ilDate $seed)
get singleton instance
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")