ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCalendarAppointmentPanelGUI Class Reference

GUI class for YUI appointment panels. More...

+ Collaboration diagram for ilCalendarAppointmentPanelGUI:

Public Member Functions

 getSeed ()
 Get seed date. More...
 
 getHTML ($a_app)
 get HTML More...
 

Static Public Member Functions

static _getInstance (ilDate $seed)
 get singleton instance More...
 

Protected Member Functions

 __construct (ilDate $seed=null)
 Singleton. More...
 

Protected Attributes

 $seed = null
 
 $settings = null
 
 $tpl = null
 
 $lng = null
 
 $ctrl = null
 

Static Protected Attributes

static $counter = 0
 
static $instance = null
 

Detailed Description

GUI class for YUI appointment panels.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 34 of file class.ilCalendarAppointmentPanelGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarAppointmentPanelGUI::__construct ( ilDate  $seed = null)
protected

Singleton.

@access public

Parameters

return

Definition at line 54 of file class.ilCalendarAppointmentPanelGUI.php.

55 {
56 global $lng,$ilCtrl;
57
58 $this->lng = $lng;
59 $this->ctrl = $ilCtrl;
60 $this->settings = ilCalendarSettings::_getInstance();
61
62 $this->seed = $seed;
63 }
static _getInstance()
get singleton instance
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, $seed, and ilCalendarSettings\_getInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilCalendarAppointmentPanelGUI::_getInstance ( ilDate  $seed)
static

get singleton instance

@access public

Parameters

return

Definition at line 73 of file class.ilCalendarAppointmentPanelGUI.php.

74 {
75 if(isset(self::$instance) and self::$instance)
76 {
77 return self::$instance;
78 }
79 return self::$instance = new ilCalendarAppointmentPanelGUI($seed);
80 }
GUI class for YUI appointment panels.

References $instance, and $seed.

Referenced by ilCalendarDayGUI\showAppointment(), ilCalendarWeekGUI\showAppointment(), ilCalendarMonthGUI\showEvents(), ilCalendarDayGUI\showFulldayAppointment(), and ilCalendarWeekGUI\showFulldayAppointment().

+ Here is the caller graph for this function:

◆ getHTML()

ilCalendarAppointmentPanelGUI::getHTML (   $a_app)

get HTML

@access public

Parameters

return

Definition at line 98 of file class.ilCalendarAppointmentPanelGUI.php.

99 {
100 global $tree,$lng,$ilUser;
101
102 self::$counter++;
103
104 $this->tpl = new ilTemplate('tpl.appointment_panel.html',true,true,'Services/Calendar');
105
106 // Panel variables
107 $this->tpl->setVariable('PANEL_NUM',self::$counter);
108 $this->tpl->setVariable('PANEL_TITLE', str_replace(' ()', '', $a_app['event']->getPresentationTitle(false)));
109 if ($a_app["event"]->isMilestone())
110 {
111 $this->tpl->setVariable('PANEL_DETAILS',$this->lng->txt('cal_ms_details'));
112 }
113 else
114 {
115 $this->tpl->setVariable('PANEL_DETAILS',$this->lng->txt('cal_details'));
116 }
117 $this->tpl->setVariable('PANEL_TXT_DATE',$this->lng->txt('date'));
118
119 if($a_app['fullday'])
120 {
121 $this->tpl->setVariable('PANEL_DATE',ilDatePresentation::formatPeriod(
122 new ilDate($a_app['dstart'],IL_CAL_UNIX),
123 new ilDate($a_app['dend'],IL_CAL_UNIX)));
124 }
125 else
126 {
127 $this->tpl->setVariable('PANEL_DATE',ilDatePresentation::formatPeriod(
128 new ilDateTime($a_app['dstart'],IL_CAL_UNIX),
129 new ilDateTime($a_app['dend'],IL_CAL_UNIX)));
130 }
131 if($a_app['event']->getLocation())
132 {
133 $this->tpl->setVariable('PANEL_TXT_WHERE',$this->lng->txt('cal_where'));
134 $this->tpl->setVariable('PANEL_WHERE',ilUtil::makeClickable($a_app['event']->getLocation()),true);
135 }
136 if($a_app['event']->getDescription())
137 {
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 {
144 $this->tpl->setVariable('PANEL_TXT_COMPL',$this->lng->txt('cal_task_completion'));
145 $this->tpl->setVariable('PANEL_COMPL',$a_app['event']->getCompletion()." %");
146 }
147
148 if ($a_app['event']->isMilestone())
149 {
150 // users responsible
151 $users = $a_app['event']->readResponsibleUsers();
152 $delim = "";
153 foreach($users as $r)
154 {
155 $value.= $delim.$r["lastname"].", ".$r["firstname"]." [".$r["login"]."]";
156 $delim = "<br />";
157 }
158 if (count($users) > 0)
159 {
160 $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible'));
161 $this->tpl->setVariable('PANEL_RESP', $value);
162 }
163 }
164
165 include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
166 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($a_app['event']->getEntryId());
167 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
168 $entry_obj_id = isset($cat_info['subitem_obj_ids'][$cat_id]) ?
169 $cat_info['subitem_obj_ids'][$cat_id] :
170 $cat_info['obj_id'];
171
172 $this->tpl->setVariable('PANEL_TXT_CAL_TYPE',$this->lng->txt('cal_cal_type'));
173 switch($cat_info['type'])
174 {
176 $this->tpl->setVariable('PANEL_CAL_TYPE',$this->lng->txt('cal_type_system'));
177 break;
178
180 $this->tpl->setVariable('PANEL_CAL_TYPE',$this->lng->txt('cal_type_personal'));
181 break;
182
184 $type = ilObject::_lookupType($cat_info['obj_id']);
185 $this->tpl->setVariable('PANEL_CAL_TYPE',$this->lng->txt('cal_type_'.$type));
186
187 // Course group appointment registration
188 if($this->settings->isCGRegistrationEnabled() and $type == 'crs' or $type == 'grp')
189 {
190 if(!$a_app['event']->isAutoGenerated())
191 {
192 include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
193 $reg = new ilCalendarRegistration($a_app['event']->getEntryId());
194
195 if($reg->isRegistered($ilUser->getId(),new ilDateTime($a_app['dstart'],IL_CAL_UNIX),new ilDateTime($a_app['dend'],IL_CAL_UNIX)))
196 {
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']);
202
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();
206 }
207 else
208 {
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();
217 }
218
219 include_once './Services/Link/classes/class.ilLink.php';
220 $registrations = array();
221 foreach($reg->getRegisteredUsers(new ilDateTime($a_app['dstart'],IL_CAL_UNIX),new ilDateTime($a_app['dend'],IL_CAL_UNIX)) as $usr_data)
222 {
223 $usr_id = $usr_data['usr_id'];
224 $this->ctrl->setParameterByClass('ilconsultationhoursgui','user',$usr_id);
225 $registrations[] = '<a href="'.$this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile').'">'.ilObjUser::_lookupFullname($usr_id);
226 $this->ctrl->setParameterByClass('ilconsultationhoursgui','user','');
227 }
228 if(count($registrations))
229 {
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();
234 }
235 }
236 }
237 break;
238
240 $this->tpl->setVariable('PANEL_CAL_TYPE',$this->lng->txt('cal_ch_ch'));
241
242 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
243 $entry = new ilBookingEntry($a_app['event']->getContextId());
244
245 $is_owner = $entry->isOwner();
246 $user_entry = ($cat_info['obj_id'] == $ilUser->getId());
247
248 if($user_entry && !$is_owner)
249 {
250 // find source calendar entry in owner calendar
251 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
252 $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart());
253 $ref_event = $apps[0];
254 }
255 else
256 {
257 $ref_event = $a_app['event']->getEntryId();
258 }
259
260 $this->tpl->setCurrentBlock('panel_booking_owner');
261 $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner'));
262 $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId()));
263 $this->tpl->parseCurrentBlock();
264
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();
269
270 if(!$is_owner)
271 {
272 if($entry->hasBooked($ref_event))
273 {
274 if(ilDateTime::_after($a_app['event']->getStart(),new ilDateTime(time(),IL_CAL_UNIX)))
275 {
276 $this->tpl->setCurrentBlock('panel_cancel_book_link');
277 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$ref_event);
278 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
279 $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
280 $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','cancelBooking'));
281 $this->tpl->parseCurrentBlock();
282 }
283 }
284 #else if(!$entry->isBookedOut($ref_event))
285 elseif($entry->isAppointmentBookableForUser($ref_event,$GLOBALS['ilUser']->getId()))
286 {
287 $this->tpl->setCurrentBlock('panel_book_link');
288 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$ref_event);
289 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
290 $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book'));
291 $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','book'));
292 $this->tpl->parseCurrentBlock();
293 }
294
295 $this->tpl->setCurrentBlock('panel_current_booking');
296 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
297 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
298 $this->tpl->parseCurrentBlock();
299 }
300 else
301 {
302
303 $obj_ids = $entry->getTargetObjIds();
304 foreach($obj_ids as $obj_id)
305 {
306 $title = ilObject::_lookupTitle($obj_id);
307 $refs = ilObject::_getAllReferences($obj_id);
308 include_once './Services/Link/classes/class.ilLink.php';
309 $this->tpl->setCurrentBlock('panel_booking_target_row');
310 $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE',$title);
311 $this->tpl->setVariable('PANEL_BOOKING_TARGET',ilLink::_getLink(end($refs)));
312 $this->tpl->parseCurrentBlock();
313 }
314 if($obj_ids)
315 {
316 $this->tpl->setCurrentBlock('panel_booking_target');
317 $this->tpl->setVariable('PANEL_TXT_BOOKING_TARGET', $this->lng->txt('cal_ch_target_object'));
318 $this->tpl->parseCurrentBlock();
319 }
320
321 $link_users = true;
323 {
324 $link_users = false;
325 }
326
327 include_once './Services/Link/classes/class.ilLink.php';
328 $bookings = array();
329 $this->ctrl->setParameterByClass('ilconsultationhoursgui','panel',1);
330 foreach($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id)
331 {
332 if($link_users)
333 {
334 $this->ctrl->setParameterByClass('ilconsultationhoursgui','user',$user_id);
335 $bookings[] = '<a href="'.$this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile').'">'.
336 ilObjUser::_lookupFullname($user_id).'</a>';
337 $this->ctrl->setParameterByClass('ilconsultationhoursgui','user','');
338 }
339 else
340 {
341 $bookings[] = ilObjUser::_lookupFullname($user_id);
342 }
343 }
344 $this->ctrl->setParameterByClass('ilconsultationhoursgui','panel','');
345 $this->tpl->setCurrentBlock('panel_current_booking');
346 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
347 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $bookings));
348 $this->tpl->parseCurrentBlock();
349 }
350 break;
351
353 $this->tpl->setVariable('PANEL_CAL_TYPE',$this->lng->txt('cal_ch_booking'));
354
355 $this->tpl->setCurrentBlock('panel_cancel_book_link');
356 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$a_app['event']->getEntryId());
357 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
358 $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
359 $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','cancelBooking'));
360 $this->tpl->parseCurrentBlock();
361 break;
362 }
363
364 $this->tpl->setVariable('PANEL_TXT_CAL_NAME',$this->lng->txt('cal_calendar_name'));
365 $this->tpl->setVariable('PANEL_CAL_NAME',$cat_info['title']);
366
367
368 if($cat_info['editable'] and !$a_app['event']->isAutoGenerated())
369 {
370 $this->tpl->setCurrentBlock('panel_edit_link');
371 $this->tpl->setVariable('TXT_PANEL_EDIT',$this->lng->txt('edit'));
372
373 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
374 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
375 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$a_app['event']->getEntryId());
376 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','dt',$a_app['dstart']);
377 $this->tpl->setVariable('PANEL_EDIT_HREF',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','askEdit'));
378
379 $this->tpl->setCurrentBlock('panel_delete_link');
380 $this->tpl->setVariable('TXT_PANEL_DELETE',$this->lng->txt('delete'));
381
382 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
383 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
384 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','app_id',$a_app['event']->getEntryId());
385 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','dt',$a_app['dstart']);
386 $this->tpl->setVariable('PANEL_DELETE_HREF',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','askdelete'));
387 $this->tpl->parseCurrentBlock();
388 }
389 include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
390 if($cat_info['type'] == ilCalendarCategory::TYPE_OBJ)
391 {
392 $refs = ilObject::_getAllReferences($entry_obj_id);
393 $type = ilObject::_lookupType($entry_obj_id);
394 $title = ilObject::_lookupTitle($entry_obj_id) ?
395 ilObject::_lookupTitle($entry_obj_id) :
396 $lng->txt('obj_'.$type);
397
398 include_once('./Services/Link/classes/class.ilLink.php');
399 $href = ilLink::_getStaticLink(current($refs),ilObject::_lookupType($entry_obj_id));
400 $parent = $tree->getParentId(current($refs));
401 $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent));
402 $this->tpl->setVariable('PANEL_TXT_LINK',$this->lng->txt('ext_link'));
403 $this->tpl->setVariable('PANEL_LINK_HREF',$href);
404 $this->tpl->setVariable('PANEL_LINK_NAME',$title);
405 $this->tpl->setVariable('PANEL_PARENT',$parent_title);
406 }
407
408 return $this->tpl->get();
409 }
const IL_CAL_DATE
const IL_CAL_UNIX
Booking definition.
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)
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.
Class for single dates.
_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
$r
Definition: example_031.php:79
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilUser
Definition: imgupload.php:15

References $GLOBALS, $ilUser, $lng, $r, ilDateTime\_after(), ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilLink\_getLink(), ilLink\_getStaticLink(), ilCalendarCategoryAssignments\_lookupCategory(), ilObjUser\_lookupFullname(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilDatePresentation\formatPeriod(), ilConsultationHourAppointments\getAppointmentIds(), getSeed(), IL_CAL_DATE, IL_CAL_UNIX, ilUtil\makeClickable(), ilCalendarCategories\MODE_PORTFOLIO_CONSULTATION, ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

+ Here is the call graph for this function:

◆ getSeed()

ilCalendarAppointmentPanelGUI::getSeed ( )

Get seed date.

Definition at line 85 of file class.ilCalendarAppointmentPanelGUI.php.

86 {
87 return $this->seed;
88 }

References $seed.

Referenced by getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $counter

ilCalendarAppointmentPanelGUI::$counter = 0
staticprotected

Definition at line 38 of file class.ilCalendarAppointmentPanelGUI.php.

◆ $ctrl

ilCalendarAppointmentPanelGUI::$ctrl = null
protected

Definition at line 45 of file class.ilCalendarAppointmentPanelGUI.php.

◆ $instance

ilCalendarAppointmentPanelGUI::$instance = null
staticprotected

Definition at line 39 of file class.ilCalendarAppointmentPanelGUI.php.

Referenced by _getInstance().

◆ $lng

ilCalendarAppointmentPanelGUI::$lng = null
protected

Definition at line 44 of file class.ilCalendarAppointmentPanelGUI.php.

Referenced by __construct(), and getHTML().

◆ $seed

ilCalendarAppointmentPanelGUI::$seed = null
protected

Definition at line 36 of file class.ilCalendarAppointmentPanelGUI.php.

Referenced by __construct(), _getInstance(), and getSeed().

◆ $settings

ilCalendarAppointmentPanelGUI::$settings = null
protected

Definition at line 41 of file class.ilCalendarAppointmentPanelGUI.php.

◆ $tpl

ilCalendarAppointmentPanelGUI::$tpl = null
protected

Definition at line 43 of file class.ilCalendarAppointmentPanelGUI.php.


The documentation for this class was generated from the following file: