19 declare(strict_types=1);
32 $cat_id = $this->
getCatId($a_app[
'event']->getEntryId());
34 $context_id = $a_app[
'event']->getContextId();
45 if ($booking->isOwner($this->user->getId())) {
47 foreach ($booking->getTargetObjIds() as
$obj_id) {
56 if (count($refs) > 1) {
57 $par_ref = $this->tree->getParentId($ref_id);
60 $buttons[] = $this->
ui->renderer()->render(
65 if (count($buttons) > 0) {
72 $this->
lng->txt(
'cal_ch_booking_owner'),
76 if ($deadline = $booking->getDeadlineHours()) {
77 $limit = $a_app[
'dstart'] - ($deadline * 60 * 60);
79 if (time() > $limit) {
94 $free = $booking->getNumberOfBookings() - $booking->getCurrentNumberOfBookings($a_app[
'event']->getEntryId());
96 $this->
lng->txt(
'cal_ch_booking_num_available'),
97 sprintf($this->
lng->txt(
'cal_ch_free_of_available'), $free, $booking->getNumberOfBookings())
100 $this->
lng->txt(
'cal_ch_booking_num_available'),
101 sprintf($this->
lng->txt(
'cal_ch_free_of_available'), $free, $booking->getNumberOfBookings())
106 $is_owner = $booking->isOwner($this->
user->getId());
107 $user_entry = ($cat_info[
'obj_id'] == $this->
user->getId());
109 if ($user_entry && !$is_owner) {
112 $booking->getObjId(),
113 $a_app[
'event']->getContextId(),
114 $a_app[
'event']->getStart()
116 $ref_event = $apps[0];
118 $ref_event = $a_app[
'event']->getEntryId();
121 $cb = $booking->getCurrentNumberOfBookings($ref_event);
123 if ($booking->hasBooked($ref_event)) {
125 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $ref_event);
128 $this->
lng->txt(
'cal_ch_cancel_booking'),
129 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking')
132 } elseif ($booking->isAppointmentBookableForUser($ref_event,
$GLOBALS[
'DIC'][
'ilUser']->getId())) {
133 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $ref_event);
136 $this->
lng->txt(
'cal_ch_book'),
137 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'book')
143 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
145 $this->
lng->txt(
'cal_ch_cancel_booking'),
146 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'cancelBooking')
149 $this->
lng->txt(
'cal_ch_delete_booking'),
150 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'deleteBooking')
158 $booking_comments = [];
159 foreach ($booking->getCurrentBookings($a_app[
'event']->getEntryId()) as
$user_id) {
162 $a_app[
'event']->getEntryId(),
172 foreach ($booking_comments as $user_id =>
$comment) {
collectPropertiesAndActions()
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)
getReadableRefIds(int $a_obj_id)
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)
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.
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
getUserName(int $a_user_id, bool $a_force_name=false)
Get (linked if possible) user name.
const MODE_PORTFOLIO_CONSULTATION
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.
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)
getCatId(int $a_entry_id)