ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
57
58 $lng = $DIC['lng'];
59 $ilCtrl = $DIC['ilCtrl'];
60
61 $this->lng = $lng;
62 $this->ctrl = $ilCtrl;
64
65 $this->seed = $seed;
66 }
static _getInstance()
get singleton instance
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

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

+ 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 76 of file class.ilCalendarAppointmentPanelGUI.php.

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

References $instance, and $seed.

◆ getHTML()

ilCalendarAppointmentPanelGUI::getHTML (   $a_app)

get HTML

@access public

Parameters

return

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

101 {
102 global $DIC;
103
104 $tree = $DIC['tree'];
105 $lng = $DIC['lng'];
106 $ilUser = $DIC['ilUser'];
107
108 self::$counter++;
109
110 $this->tpl = new ilTemplate('tpl.appointment_panel.html', true, true, 'Services/Calendar');
111
112 // Panel variables
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']) {
123 $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(
124 new ilDate($a_app['dstart'], IL_CAL_UNIX),
125 new ilDate($a_app['dend'], IL_CAL_UNIX)
126 ));
127 } else {
128 $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(
129 new ilDateTime($a_app['dstart'], IL_CAL_UNIX),
130 new ilDateTime($a_app['dend'], IL_CAL_UNIX)
131 ));
132 }
133 if ($a_app['event']->getLocation()) {
134 $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where'));
135 $this->tpl->setVariable('PANEL_WHERE', ilUtil::makeClickable($a_app['event']->getLocation()), true);
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 // users responsible
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');
162 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($a_app['event']->getEntryId());
163 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
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
179 $type = ilObject::_lookupType($cat_info['obj_id']);
180 $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_' . $type));
181
182 // Course group appointment registration
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';
186 $reg = new ilCalendarRegistration($a_app['event']->getEntryId());
187
188 if ($reg->isRegistered($ilUser->getId(), new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX))) {
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();
211 foreach ($reg->getRegisteredUsers(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)) as $usr_data) {
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';
231 $entry = new ilBookingEntry($a_app['event']->getContextId());
232
233 $is_owner = $entry->isOwner();
234 $user_entry = ($cat_info['obj_id'] == $ilUser->getId());
235
236 if ($user_entry && !$is_owner) {
237 // find source calendar entry in owner calendar
238 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
239 $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart());
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'));
247 $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId()));
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)) {
257 if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
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) {
284 $refs = ilObject::_getAllReferences($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') . '">' .
309 ilObjUser::_lookupFullname($user_id) . '</a>';
310 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
311 } else {
312 $bookings[] = ilObjUser::_lookupFullname($user_id);
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');
360 if ($cat_info['type'] == ilCalendarCategory::TYPE_OBJ) {
361 $refs = ilObject::_getAllReferences($entry_obj_id);
362 $type = ilObject::_lookupType($entry_obj_id);
363 $title = ilObject::_lookupTitle($entry_obj_id) ?
364 ilObject::_lookupTitle($entry_obj_id) :
365 $lng->txt('obj_' . $type);
366
367 include_once('./Services/Link/classes/class.ilLink.php');
368 $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($entry_obj_id));
369 $parent = $tree->getParentId(current($refs));
370 $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent));
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 }
$users
Definition: authpage.php:44
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, $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.
Class for single dates.
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
$r
Definition: example_031.php:79
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static getDescription()
Definition: Php.php:51
$type
$ilUser
Definition: imgupload.php:18

References $DIC, $GLOBALS, $ilUser, $lng, $r, $title, $tree, $type, $users, ilDateTime\_after(), ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilLink\_getLink(), ilLink\_getStaticLink(), ilCalendarCategoryAssignments\_lookupCategory(), ilObjUser\_lookupFullname(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilDatePresentation\formatPeriod(), ilConsultationHourAppointments\getAppointmentIds(), Gettext\Languages\Exporter\getDescription(), getSeed(), IL_CAL_DATE, IL_CAL_UNIX, ilUtil\makeClickable(), ilCalendarCategories\MODE_PORTFOLIO_CONSULTATION, settings(), 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 87 of file class.ilCalendarAppointmentPanelGUI.php.

88 {
89 return $this->seed;
90 }

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: