ILIAS  release_8 Revision v8.23
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 12 of file class.ilAppointmentPresentationConsultationHoursGUI.php.

References ilAppointmentPresentationGUI\$appointment, $GLOBALS, ilAppointmentPresentationGUI\$obj_id, $ref_id, ilDateTime\_after(), ilCalendarCategories\_getInstance(), ilLink\_getStaticLink(), ilObjUser\_lookupFullname(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilAppointmentPresentationGUI\addAction(), ilAppointmentPresentationGUI\addCommonSection(), ilAppointmentPresentationGUI\addInfoProperty(), ilAppointmentPresentationGUI\addLastUpdate(), 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(), ilCalendarCategories\MODE_PORTFOLIO_CONSULTATION, ILIAS\Repository\ui(), and ILIAS\Repository\user().

12  : void
13  {
14  $a_app = $this->appointment;
15 
16  $cat_id = $this->getCatId($a_app['event']->getEntryId());
17  $cat_info = $this->getCatInfo();
18  $context_id = $a_app['event']->getContextId();
19 
20  $this->addCommonSection($a_app, $cat_info['obj_id']);
21 
22  //objects
23  $booking = new ilBookingEntry($context_id);
24 
25  if ($manager = ilConsultationHourAppointments::getManager(true, true, $booking->getObjId())) {
26  $this->addInfoProperty($this->lng->txt("cal_ch_manager"), $manager);
27  }
28 
29  if ($booking->isOwner()) {
30  $buttons = array();
31  foreach ($booking->getTargetObjIds() as $obj_id) {
32  //$this->addObjectLinks($obj_id, $this->appointment);
33 
35  $refs = $this->getReadableRefIds($obj_id);
36  reset($refs);
37 
38  foreach ($refs as $ref_id) {
39  $link_title = $title;
40  if (count($refs) > 1) {
41  $par_ref = $this->tree->getParentId($ref_id);
42  $link_title .= " (" . ilObject::_lookupTitle(ilObject::_lookupObjId($par_ref)) . ")";
43  }
44  $buttons[] = $this->ui->renderer()->render(
45  $this->ui->factory()->button()->shy($link_title, ilLink::_getStaticLink($ref_id))
46  );
47  }
48  }
49  if (count($buttons) > 0) {
50  $this->addInfoProperty($this->lng->txt("cal_repo_obj"), implode("<br>", $buttons));
51  }
52  }
53 
54  // owner
55  $this->addInfoProperty(
56  $this->lng->txt('cal_ch_booking_owner'),
57  ilObjUser::_lookupFullname($booking->getObjId())
58  );
59 
60  if ($deadline = $booking->getDeadlineHours()) {
61  $limit = $a_app['dstart'] - ($deadline * 60 * 60);
62 
63  if (time() > $limit) {
64  $this->addInfoProperty($this->lng->txt("cal_ch_deadline"), $this->lng->txt("exc_time_over_short"));
65  //$this->addListItemProperty($this->lng->txt("cal_ch_deadline"),$this->lng->txt("exc_time_over_short"));
66  } else {
67  //appointment starts at -> $a_app['dstart']
68  //limit registration -> $a_app['dstart'] - $deadline
69 
70  //$string = ilUtil::period2String(new ilDateTime($limit, IL_CAL_UNIX));
72 
73  $this->addInfoProperty($this->lng->txt("cal_ch_deadline"), $string);
74  $this->addListItemProperty($this->lng->txt("cal_ch_deadline"), $string);
75  }
76  }
77 
78  // max nr of bookings
79  $this->addInfoProperty($this->lng->txt('cal_ch_num_bookings'), (string) $booking->getNumberOfBookings());
80  $this->addListItemProperty($this->lng->txt('cal_ch_num_bookings'), (string) $booking->getNumberOfBookings());
81 
82  // for the following code
83  // see ilCalendarAppointmentPanelGUI in ILIAS 5.2 (getHTML())
84  $is_owner = $booking->isOwner();
85  $user_entry = ($cat_info['obj_id'] == $this->user->getId());
86 
87  if ($user_entry && !$is_owner) {
88  // find source calendar entry in owner calendar
90  $booking->getObjId(),
91  $a_app['event']->getContextId(),
92  $a_app['event']->getStart()
93  );
94  $ref_event = $apps[0];
95  } else {
96  $ref_event = $a_app['event']->getEntryId();
97  }
98 
99  $cb = $booking->getCurrentNumberOfBookings($ref_event);
100  if (!$is_owner) {
101  $this->addInfoProperty($this->lng->txt('cal_ch_current_bookings'), (string) $cb);
102  }
103  $this->addListItemProperty($this->lng->txt('cal_ch_current_bookings'), (string) $cb);
104 
105  if (!$is_owner) {
106  if ($booking->hasBooked($ref_event)) {
107  if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
108  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
109  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
110  $this->addAction(
111  $this->lng->txt('cal_ch_cancel_booking'),
112  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking')
113  );
114  }
115  } elseif ($booking->isAppointmentBookableForUser($ref_event, $GLOBALS['DIC']['ilUser']->getId())) {
116  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
117  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
118  $this->addAction(
119  $this->lng->txt('cal_ch_book'),
120  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book')
121  );
122  }
123  } else {
124  // list booking users
125  $link_users = true;
127  $link_users = false;
128  }
129  $users = array();
130  foreach ($booking->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
131  if ($link_users) {
132  $users[] = $this->getUserName($user_id);
133  } else {
134  $users[] = ilObjUser::_lookupFullname($user_id);
135  }
136  }
137  if ($users) {
138  $this->addInfoProperty($this->lng->txt('cal_ch_current_bookings'), implode('<br>', $users));
139  }
140  }
141 
142  // last edited
143  $this->addLastUpdate($a_app);
144  }
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.
addListItemProperty(string $a_txt, string $a_val)
Add list item property.
static _lookupFullname(int $a_user_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
addInfoProperty(string $a_txt, string $a_val)
Add info property.
static _lookupObjId(int $ref_id)
addLastUpdate(array $a_app)
Add last update.
static getAppointmentIds(int $a_user_id, int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
$ref_id
Definition: ltiauth.php:67
static _lookupTitle(int $obj_id)
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.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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
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.
+ Here is the call graph for this function:

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