98 {
100
102
103 $this->tpl =
new ilTemplate(
'tpl.appointment_panel.html',
true,
true,
'Services/Calendar');
104
105
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'));
110 } else {
111 $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_details'));
112 }
113 $this->tpl->setVariable('PANEL_TXT_DATE', $this->lng->txt('date'));
114
115 if ($a_app['fullday']) {
119 ));
120 } else {
124 ));
125 }
126 if ($a_app['event']->getLocation()) {
127 $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where'));
129 }
131 $this->tpl->setVariable('PANEL_TXT_DESC', $this->lng->txt('description'));
133 }
134
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() . " %");
138 }
139
140 if ($a_app['event']->isMilestone()) {
141
142 $users = $a_app[
'event']->readResponsibleUsers();
143 $delim = "";
145 $value.= $delim .
$r[
"lastname"] .
", " .
$r[
"firstname"] .
" [" .
$r[
"login"] .
"]";
146 $delim = "<br />";
147 }
149 $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible'));
150 $this->tpl->setVariable('PANEL_RESP', $value);
151 }
152 }
153
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] :
159 $cat_info['obj_id'];
160
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'));
165 break;
166
168 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_personal'));
169 break;
170
173 $this->tpl->setVariable(
'PANEL_CAL_TYPE', $this->lng->txt(
'cal_type_' .
$type));
174
175
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';
180
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']);
187
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();
191 } else {
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();
200 }
201
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', '');
209 }
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();
215 }
216 }
217 }
218 break;
219
221 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch'));
222
223 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
225
226 $is_owner = $entry->isOwner();
227 $user_entry = ($cat_info[
'obj_id'] ==
$ilUser->getId());
228
229 if ($user_entry && !$is_owner) {
230
231 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
233 $ref_event = $apps[0];
234 } else {
235 $ref_event = $a_app['event']->getEntryId();
236 }
237
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();
242
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();
247
248 if (!$is_owner) {
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();
257 }
258 }
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();
267 }
268
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();
273 } else {
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();
283 }
284 if ($obj_ids) {
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();
288 }
289
290 $link_users = true;
292 $link_users = false;
293 }
294
295 include_once './Services/Link/classes/class.ilLink.php';
296 $bookings = array();
297 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', 1);
298 foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
299 if ($link_users) {
300 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $user_id);
301 $bookings[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' .
303 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
304 } else {
306 }
307 }
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();
313 }
314 break;
315
317 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_booking'));
318
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();
325 break;
326 }
327
328 $this->tpl->setVariable('PANEL_TXT_CAL_NAME', $this->lng->txt('cal_calendar_name'));
329 $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']);
330
331
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'));
335
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'));
341
342 $this->tpl->setCurrentBlock('panel_delete_link');
343 $this->tpl->setVariable('TXT_PANEL_DELETE', $this->lng->txt('delete'));
344
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();
351 }
352 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
359
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);
368 }
369
370 return $this->tpl->get();
371 }
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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.