ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilAppointmentPresentationConsultationHoursGUI Class Reference
+ Inheritance diagram for ilAppointmentPresentationConsultationHoursGUI:
+ Collaboration diagram for ilAppointmentPresentationConsultationHoursGUI:

Public Member Functions

 collectPropertiesAndActions ()
 
- Public Member Functions inherited from ilAppointmentPresentationGUI
 __construct (array $a_appointment, ?ilInfoScreenGUI $a_info_screen, ?ilToolbarGUI $a_toolbar, ?Item $a_list_item)
 
 getObjIdForAppointment ()
 
 getToolbar ()
 
 getListItem ()
 Get list item. More...
 
 getInfoScreen ()
 
 getCatId (int $a_entry_id)
 
 getCatInfo ()
 
 executeCommand ()
 
 getHTML ()
 
 addContainerInfo (int $a_obj_id)
 Add course/group container info. More...
 
 addInfoSection (string $a_txt)
 Add info section. More...
 
 addInfoProperty (string $a_txt, string $a_val)
 Add info property. More...
 
 addListItemProperty (string $a_txt, string $a_val)
 Add list item property. More...
 
 addAction (string $a_txt, string $a_link)
 Add action. More...
 
 collectPropertiesAndActions ()
 Collect properties and actions. More...
 
 collectStandardPropertiesAndActions ()
 Collect standard properties and actions. More...
 
 addObjectLinks (int $obj_id, ?array $a_appointment=null)
 Add object link. More...
 
 getReadableRefIds (int $a_obj_id)
 
 addEventDescription (array $a_app)
 Add event description. More...
 
 addEventLocation (array $a_app)
 Add event location. More...
 
 addLastUpdate (array $a_app)
 Add last update. More...
 
 addCalendarInfo (array $cat_info)
 
 addCommonSection (array $a_app, int $a_obj_id=0, ?array $cat_info=null, bool $a_container_info=false)
 
 addMetaData (string $a_obj_type, int $a_obj_id, ?string $a_sub_obj_type=null, ?int $a_sub_obj_id=null)
 
 getUserName (int $a_user_id, bool $a_force_name=false)
 Get (linked if possible) user name. More...
 
 downloadFiles ()
 Download files from an appointment ( Modals ) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAppointmentPresentationGUI
static getInstance (array $a_appointment, ?ilInfoScreenGUI $a_info_screen, ?ilToolbarGUI $a_toolbar, ?Item $a_list_item)
 
- Protected Member Functions inherited from ilAppointmentPresentationGUI
 readObjIdForAppointment ()
 read obj_id for appointment More...
 
 buildDirectLinkForAppointment (int $a_ref_id, ?array $a_appointment=null)
 Build direct link for appointment. More...
 
- Protected Attributes inherited from ilAppointmentPresentationGUI
array $appointment
 
ilToolbarGUI $toolbar
 
ilInfoScreenGUI $infoscreen
 
ilLanguage $lng
 
ilTree $tree
 
UIServices $ui
 
ilCtrlInterface $ctrl
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
RefineryFactory $refinery
 
HttpServices $http
 
Item $list_item = null
 
array $info_items = []
 
array $list_properties = []
 
array $actions = []
 
array $readable_ref_ids
 
bool $has_files = false
 
int $obj_id = 0
 
- Static Protected Attributes inherited from ilAppointmentPresentationGUI
static self $instance
 

Detailed Description

Member Function Documentation

◆ collectPropertiesAndActions()

ilAppointmentPresentationConsultationHoursGUI::collectPropertiesAndActions ( )

Definition at line 28 of file class.ilAppointmentPresentationConsultationHoursGUI.php.

References ilAppointmentPresentationGUI\$appointment, $comment, $GLOBALS, ilAppointmentPresentationGUI\$obj_id, $ref_id, $user_id, ilDateTime\_after(), ilCalendarCategories\_getInstance(), ilLink\_getStaticLink(), ilObjUser\_lookupFullname(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilAppointmentPresentationGUI\addAction(), ilAppointmentPresentationGUI\addCommonSection(), ilAppointmentPresentationGUI\addInfoProperty(), ilAppointmentPresentationGUI\addListItemProperty(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilConsultationHourAppointments\getAppointmentIds(), ilAppointmentPresentationGUI\getCatId(), ilAppointmentPresentationGUI\getCatInfo(), ilConsultationHourAppointments\getManager(), ilAppointmentPresentationGUI\getReadableRefIds(), ilAppointmentPresentationGUI\getUserName(), IL_CAL_UNIX, ILIAS\Repository\lng(), ilBookingEntry\lookupBookingMessage(), ilCalendarCategories\MODE_PORTFOLIO_CONSULTATION, ILIAS\Repository\ui(), and ILIAS\Repository\user().

28  : void
29  {
30  $a_app = $this->appointment;
31 
32  $cat_id = $this->getCatId($a_app['event']->getEntryId());
33  $cat_info = $this->getCatInfo();
34  $context_id = $a_app['event']->getContextId();
35 
36  $this->addCommonSection($a_app, $cat_info['obj_id']);
37 
38  //objects
39  $booking = new ilBookingEntry($context_id);
40 
41  if ($manager = ilConsultationHourAppointments::getManager(true, true, $booking->getObjId())) {
42  $this->addInfoProperty($this->lng->txt("cal_ch_manager"), $manager);
43  }
44 
45  if ($booking->isOwner($this->user->getId())) {
46  $buttons = array();
47  foreach ($booking->getTargetObjIds() as $obj_id) {
48  //$this->addObjectLinks($obj_id, $this->appointment);
49 
51  $refs = $this->getReadableRefIds($obj_id);
52  reset($refs);
53 
54  foreach ($refs as $ref_id) {
55  $link_title = $title;
56  if (count($refs) > 1) {
57  $par_ref = $this->tree->getParentId($ref_id);
58  $link_title .= " (" . ilObject::_lookupTitle(ilObject::_lookupObjId($par_ref)) . ")";
59  }
60  $buttons[] = $this->ui->renderer()->render(
61  $this->ui->factory()->button()->shy($link_title, ilLink::_getStaticLink($ref_id))
62  );
63  }
64  }
65  if (count($buttons) > 0) {
66  $this->addInfoProperty($this->lng->txt("cal_repo_obj"), implode("<br>", $buttons));
67  }
68  }
69 
70  // owner
71  $this->addInfoProperty(
72  $this->lng->txt('cal_ch_booking_owner'),
73  ilObjUser::_lookupFullname($booking->getObjId())
74  );
75 
76  if ($deadline = $booking->getDeadlineHours()) {
77  $limit = $a_app['dstart'] - ($deadline * 60 * 60);
78 
79  if (time() > $limit) {
80  $this->addInfoProperty($this->lng->txt("cal_ch_deadline"), $this->lng->txt("exc_time_over_short"));
81  //$this->addListItemProperty($this->lng->txt("cal_ch_deadline"),$this->lng->txt("exc_time_over_short"));
82  } else {
83  //appointment starts at -> $a_app['dstart']
84  //limit registration -> $a_app['dstart'] - $deadline
85 
86  //$string = ilUtil::period2String(new ilDateTime($limit, IL_CAL_UNIX));
88 
89  $this->addInfoProperty($this->lng->txt("cal_ch_deadline"), $string);
90  $this->addListItemProperty($this->lng->txt("cal_ch_deadline"), $string);
91  }
92  }
93 
94  $free = $booking->getNumberOfBookings() - $booking->getCurrentNumberOfBookings($a_app['event']->getEntryId());
95  $this->addInfoProperty(
96  $this->lng->txt('cal_ch_booking_num_available'),
97  sprintf($this->lng->txt('cal_ch_free_of_available'), $free, $booking->getNumberOfBookings())
98  );
99  $this->addListItemProperty(
100  $this->lng->txt('cal_ch_booking_num_available'),
101  sprintf($this->lng->txt('cal_ch_free_of_available'), $free, $booking->getNumberOfBookings())
102  );
103 
104  // for the following code
105  // see ilCalendarAppointmentPanelGUI in ILIAS 5.2 (getHTML())
106  $is_owner = $booking->isOwner($this->user->getId());
107  $user_entry = ($cat_info['obj_id'] == $this->user->getId());
108 
109  if ($user_entry && !$is_owner) {
110  // find source calendar entry in owner calendar
112  $booking->getObjId(),
113  $a_app['event']->getContextId(),
114  $a_app['event']->getStart()
115  );
116  $ref_event = $apps[0];
117  } else {
118  $ref_event = $a_app['event']->getEntryId();
119  }
120 
121  $cb = $booking->getCurrentNumberOfBookings($ref_event);
122  if (!$is_owner) {
123  if ($booking->hasBooked($ref_event)) {
124  if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
125  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
126  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
127  $this->addAction(
128  $this->lng->txt('cal_ch_cancel_booking'),
129  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking')
130  );
131  }
132  } elseif ($booking->isAppointmentBookableForUser($ref_event, $GLOBALS['DIC']['ilUser']->getId())) {
133  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
134  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
135  $this->addAction(
136  $this->lng->txt('cal_ch_book'),
137  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book')
138  );
139  }
140  } else {
141  // current user is owner of booking
142  if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
143  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
144  $this->addAction(
145  $this->lng->txt('cal_ch_cancel_booking'),
146  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking')
147  );
148  $this->addAction(
149  $this->lng->txt('cal_ch_delete_booking'),
150  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'deleteBooking')
151  );
152  }
153  $link_users = true;
155  $link_users = false;
156  }
157  $users = [];
158  $booking_comments = [];
159  foreach ($booking->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
160 
161  $booking_comments[$user_id] = ilBookingEntry::lookupBookingMessage(
162  $a_app['event']->getEntryId(),
163  $user_id
164  );
165  if ($link_users) {
166  $users[$user_id] = $this->getUserName($user_id);
167  } else {
168  $users[$user_id] = ilObjUser::_lookupFullname($user_id);
169  }
170  }
171  if ($users) {
172  foreach ($booking_comments as $user_id => $comment) {
173  $this->addInfoProperty($this->lng->txt('cal_ch_current_bookings'), $users[$user_id]);
174  $this->addInfoProperty($this->lng->txt('cal_ch_current_booking_comment'), $comment);
175  }
176  $this->addListItemProperty($this->lng->txt('cal_ch_current_bookings'), implode(' ', $users));
177  }
178  }
179  }
addListItemProperty(string $a_txt, string $a_val)
Add list item property.
static _lookupFullname(int $a_user_id)
static getAppointmentIds(int $a_user_id, ?int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
const IL_CAL_UNIX
static getManager(bool $a_as_name=false, bool $a_full_name=false, ?int $a_user_id=null)
Get consultation hour manager for current user or specific user.
addInfoProperty(string $a_txt, string $a_val)
Add info property.
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:65
static _lookupTitle(int $obj_id)
$GLOBALS["DIC"]
Definition: wac.php:54
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
getUserName(int $a_user_id, bool $a_force_name=false)
Get (linked if possible) user name.
static _getInstance($a_usr_id=0)
get singleton instance
$comment
Definition: buildRTE.php:72
addCommonSection(array $a_app, int $a_obj_id=0, ?array $cat_info=null, bool $a_container_info=false)
addAction(string $a_txt, string $a_link)
Add action.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static lookupBookingMessage(int $a_entry_id, int $a_usr_id)
+ Here is the call graph for this function:

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