101 {
103
104 $tree =
$DIC[
'tree'];
107
108 self::$counter++;
109
110 $this->tpl =
new ilTemplate(
'tpl.appointment_panel.html',
true,
true,
'Services/Calendar');
111
112
113 $this->tpl->setVariable('PANEL_NUM', self::$counter);
114 $this->tpl->setVariable('PANEL_TITLE', str_replace(' ()', '', $a_app['event']->getPresentationTitle(false)));
115 if ($a_app["event"]->isMilestone()) {
116 $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_ms_details'));
117 } else {
118 $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_details'));
119 }
120 $this->tpl->setVariable('PANEL_TXT_DATE', $this->lng->txt('date'));
121
122 if ($a_app['fullday']) {
126 ));
127 } else {
131 ));
132 }
133 if ($a_app['event']->getLocation()) {
134 $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where'));
136 }
137 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())));
140 }
141
142 if ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0) {
143 $this->tpl->setVariable('PANEL_TXT_COMPL', $this->lng->txt('cal_task_completion'));
144 $this->tpl->setVariable('PANEL_COMPL', $a_app['event']->getCompletion() . " %");
145 }
146
147 if ($a_app['event']->isMilestone()) {
148
149 $users = $a_app['event']->readResponsibleUsers();
150 $delim = "";
151 foreach ($users as $r) {
152 $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
153 $delim = "<br />";
154 }
155 if (count($users) > 0) {
156 $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible'));
157 $this->tpl->setVariable('PANEL_RESP', $value);
158 }
159 }
160
161 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
164 $entry_obj_id = isset($cat_info['subitem_obj_ids'][$cat_id]) ?
165 $cat_info['subitem_obj_ids'][$cat_id] :
166 $cat_info['obj_id'];
167
168 $this->tpl->setVariable('PANEL_TXT_CAL_TYPE', $this->lng->txt('cal_cal_type'));
169 switch ($cat_info['type']) {
171 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_system'));
172 break;
173
175 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_personal'));
176 break;
177
180 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_type_' .
$type));
181
182
183 if ($this->
settings->isCGRegistrationEnabled() and
$type ==
'crs' or
$type ==
'grp') {
184 if (!$a_app['event']->isAutoGenerated()) {
185 include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
187
189 $this->tpl->setCurrentBlock('panel_cancel_book_link');
190 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
191 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
192 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
193 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
194
195 $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_reg_unregister'));
196 $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister'));
197 $this->tpl->parseCurrentBlock();
198 } else {
199 $this->tpl->setCurrentBlock('panel_book_link');
200 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
201 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
202 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
203 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
204 $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_reg_register'));
205 $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister'));
206 $this->tpl->parseCurrentBlock();
207 }
208
209 include_once './Services/Link/classes/class.ilLink.php';
210 $registrations = array();
212 $usr_id = $usr_data;
213 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $usr_id);
214 $registrations[] =
'<a href="' . $this->ctrl->getLinkTargetByClass(
'ilconsultationhoursgui',
'showprofile') .
'">' .
ilObjUser::_lookupFullname($usr_id);
215 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
216 }
217 if (count($registrations)) {
218 $this->tpl->setCurrentBlock('panel_current_booking');
219 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_reg_registered_users'));
220 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations));
221 $this->tpl->parseCurrentBlock();
222 }
223 }
224 }
225 break;
226
228 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch'));
229
230 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
232
233 $is_owner = $entry->isOwner();
234 $user_entry = ($cat_info[
'obj_id'] ==
$ilUser->getId());
235
236 if ($user_entry && !$is_owner) {
237
238 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
240 $ref_event = $apps[0];
241 } else {
242 $ref_event = $a_app['event']->getEntryId();
243 }
244
245 $this->tpl->setCurrentBlock('panel_booking_owner');
246 $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner'));
248 $this->tpl->parseCurrentBlock();
249
250 $this->tpl->setCurrentBlock('panel_max_booking');
251 $this->tpl->setVariable('PANEL_TXT_MAX_BOOKING', $this->lng->txt('cal_ch_num_bookings'));
252 $this->tpl->setVariable('PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
253 $this->tpl->parseCurrentBlock();
254
255 if (!$is_owner) {
256 if ($entry->hasBooked($ref_event)) {
258 $this->tpl->setCurrentBlock('panel_cancel_book_link');
259 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
260 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
261 $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
262 $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
263 $this->tpl->parseCurrentBlock();
264 }
265 }
266 #else if(!$entry->isBookedOut($ref_event))
267 elseif ($entry->isAppointmentBookableForUser($ref_event,
$GLOBALS[
'DIC'][
'ilUser']->getId())) {
268 $this->tpl->setCurrentBlock('panel_book_link');
269 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
270 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
271 $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book'));
272 $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book'));
273 $this->tpl->parseCurrentBlock();
274 }
275
276 $this->tpl->setCurrentBlock('panel_current_booking');
277 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
278 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
279 $this->tpl->parseCurrentBlock();
280 } else {
281 $obj_ids = $entry->getTargetObjIds();
282 foreach ($obj_ids as $obj_id) {
285 include_once './Services/Link/classes/class.ilLink.php';
286 $this->tpl->setCurrentBlock('panel_booking_target_row');
287 $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE', $title);
288 $this->tpl->setVariable(
'PANEL_BOOKING_TARGET',
ilLink::_getLink(end($refs)));
289 $this->tpl->parseCurrentBlock();
290 }
291 if ($obj_ids) {
292 $this->tpl->setCurrentBlock('panel_booking_target');
293 $this->tpl->setVariable('PANEL_TXT_BOOKING_TARGET', $this->lng->txt('cal_ch_target_object'));
294 $this->tpl->parseCurrentBlock();
295 }
296
297 $link_users = true;
299 $link_users = false;
300 }
301
302 include_once './Services/Link/classes/class.ilLink.php';
303 $bookings = array();
304 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', 1);
305 foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
306 if ($link_users) {
307 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $user_id);
308 $bookings[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' .
310 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
311 } else {
313 }
314 }
315 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', '');
316 $this->tpl->setCurrentBlock('panel_current_booking');
317 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
318 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $bookings));
319 $this->tpl->parseCurrentBlock();
320 }
321 break;
322
324 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_booking'));
325
326 $this->tpl->setCurrentBlock('panel_cancel_book_link');
327 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
328 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
329 $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
330 $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
331 $this->tpl->parseCurrentBlock();
332 break;
333 }
334
335 $this->tpl->setVariable('PANEL_TXT_CAL_NAME', $this->lng->txt('cal_calendar_name'));
336 $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']);
337
338
339 if ($cat_info['editable'] and !$a_app['event']->isAutoGenerated()) {
340 $this->tpl->setCurrentBlock('panel_edit_link');
341 $this->tpl->setVariable('TXT_PANEL_EDIT', $this->lng->txt('edit'));
342
343 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
344 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
345 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
346 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
347 $this->tpl->setVariable('PANEL_EDIT_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askEdit'));
348
349 $this->tpl->setCurrentBlock('panel_delete_link');
350 $this->tpl->setVariable('TXT_PANEL_DELETE', $this->lng->txt('delete'));
351
352 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
353 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->
getSeed()->
get(
IL_CAL_DATE));
354 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
355 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
356 $this->tpl->setVariable('PANEL_DELETE_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askdelete'));
357 $this->tpl->parseCurrentBlock();
358 }
359 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
366
367 include_once('./Services/Link/classes/class.ilLink.php');
369 $parent = $tree->getParentId(current($refs));
371 $this->tpl->setVariable('PANEL_TXT_LINK', $this->lng->txt('ext_link'));
372 $this->tpl->setVariable('PANEL_LINK_HREF', $href);
373 $this->tpl->setVariable('PANEL_LINK_NAME', $title);
374 $this->tpl->setVariable('PANEL_PARENT', $parent_title);
375 }
376
377 return $this->tpl->get();
378 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
const MODE_PORTFOLIO_CONSULTATION
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupCategory($a_cal_id)
Lookup category id.
registration for calendar appointments
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
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 _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static _lookupFullname($a_user_id)
Lookup Full Name.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen