ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Calendar\ConsultationHours\BookingCancellationGUI Class Reference
+ Collaboration diagram for ILIAS\Calendar\ConsultationHours\BookingCancellationGUI:

Public Member Functions

 __construct (object $parent_object, \ilCalendarEntry $entry, \ilBookingEntry $booking, int $type)
 
 renderModal ()
 

Data Fields

const TYPE_CANCEL = 1
 
const TYPE_DELETE = 2
 

Protected Member Functions

 getInputs ()
 

Private Member Functions

 getTitle ()
 
 getSubmitLabel ()
 
 getConfirmationBox ()
 
 getInfoBox ()
 
 getActionButton ()
 
 getBookingInfo ()
 
 getAppointmentTitle ()
 
 init ()
 

Private Attributes

ilCalendarEntry $entry
 
ilBookingEntry $booking
 
int $type
 
 $parent_object
 
bool $has_multiple_bookings = false
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $ui_renderer
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 

Detailed Description

Definition at line 21 of file BookingCancellationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::__construct ( object  $parent_object,
\ilCalendarEntry  $entry,
\ilBookingEntry  $booking,
int  $type 
)

Definition at line 43 of file BookingCancellationGUI.php.

44 {
45 global $DIC;
46
47 $this->ui_factory = $DIC->ui()->factory();
48 $this->ui_renderer = $DIC->ui()->renderer();
49 $this->ctrl = $DIC->ctrl();
50 $this->lng = $DIC->language();
51
52 $this->parent_object = $parent_object;
53 $this->entry = $entry;
54 $this->booking = $booking;
55 $this->type = $type;
56
57 $this->init();
58 }
global $DIC
Definition: shib_login.php:26

References ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\$booking, $DIC, ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\$entry, ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\$parent_object, ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\$type, ILIAS\Repository\ctrl(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\init(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getActionButton()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getActionButton ( )
private

Definition at line 130 of file BookingCancellationGUI.php.

131 {
132 switch ($this->type) {
134 return $this->ui_factory->button()->primary(
135 $this->lng->txt('cal_cancel_booking'),
136 $this->ctrl->getLinkTarget($this->parent_object, 'cancelBooking')
137 );
139 return $this->ui_factory->button()->primary(
140 $this->lng->txt('cal_ch_delete_booking'),
141 $this->ctrl->getLinkTarget($this->parent_object, 'deleteBooking')
142 );
143 }
144 }
This describes commonalities between standard and primary buttons.
Definition: Button.php:34

References ILIAS\Repository\lng(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_CANCEL, and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_DELETE.

+ Here is the call graph for this function:

◆ getAppointmentTitle()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getAppointmentTitle ( )
private

Definition at line 185 of file BookingCancellationGUI.php.

185 : string
186 {
187 return
188 $this->entry->getTitle() . ', ' .
189 \ilDatePresentation::formatDate($this->entry->getStart());
190 }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)

References ilDatePresentation\formatDate().

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getBookingInfo(), and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getInputs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBookingInfo()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getBookingInfo ( )
private

Definition at line 146 of file BookingCancellationGUI.php.

147 {
148 $user_info = [];
149 foreach ($this->booking->getCurrentBookings($this->entry->getEntryId()) as $booking_user_id) {
150 $user_info[] =
151 $this->getAppointmentTitle() . ': ' .
152 \ilObjUser::_lookupFullname($booking_user_id);
153
154 }
155 return $this->ui_factory->legacy()->content(implode('<br/', $user_info));
156 }
static _lookupFullname(int $a_user_id)
A component is the most general form of an entity in the UI.
Definition: Component.php:28

References ilObjUser\_lookupFullname(), and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getAppointmentTitle().

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\renderModal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getConfirmationBox()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getConfirmationBox ( )
private

Definition at line 102 of file BookingCancellationGUI.php.

103 {
104 switch ($this->type) {
106 return $this->ui_factory->messageBox()->confirmation(
107 $this->lng->txt('cal_ch_cancel_booking_sure')
108 );
110 return $this->ui_factory->messageBox()->confirmation(
111 $this->lng->txt('cal_ch_delete_booking_sure')
112 );
113 }
114 }

References ILIAS\Repository\lng(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_CANCEL, and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_DELETE.

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\renderModal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInfoBox()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getInfoBox ( )
private

Definition at line 116 of file BookingCancellationGUI.php.

117 {
118 switch ($this->type) {
120 return $this->ui_factory->messageBox()->info(
121 $this->lng->txt('cal_ch_cancel_booking_info')
122 );
124 return $this->ui_factory->messageBox()->info(
125 $this->lng->txt('cal_ch_delete_booking_info')
126 );
127 }
128 }

References ILIAS\Repository\lng(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_CANCEL, and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_DELETE.

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\renderModal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInputs()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getInputs ( )
protected

Definition at line 158 of file BookingCancellationGUI.php.

159 {
160 $section_title = '';
161 $inputs = [];
162 if ($this->has_multiple_bookings) {
163 $section_title = $this->getAppointmentTitle();
164 foreach ($this->booking->getCurrentBookings($this->entry->getEntryId()) as $bookuser) {
165 $inputs[(string) $bookuser] =
166 $this->ui_factory->input()->field()->checkbox(
168 )->withValue(true);
169 }
170 } else {
171 $section_title = '';
172 foreach ($this->booking->getCurrentBookings($this->entry->getEntryId()) as $bookuser) {
173 $inputs[(string) $bookuser] =
174 $this->ui_factory->input()->field()->hidden(
175 )->withValue(true);
176 }
177 }
178
179 return $this->ui_factory->input()->field()->section(
180 $inputs,
181 $section_title
182 );
183 }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61

References ILIAS\UI\Implementation\Component\Input\$inputs, ilObjUser\_lookupFullname(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getAppointmentTitle(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\renderModal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubmitLabel()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getSubmitLabel ( )
private

Definition at line 92 of file BookingCancellationGUI.php.

92 : string
93 {
94 switch ($this->type) {
96 return $this->lng->txt('cal_cancel_booking');
98 return $this->lng->txt('cal_ch_delete_booking');
99 }
100 }

References ILIAS\Repository\lng(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_CANCEL, and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_DELETE.

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\renderModal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::getTitle ( )
private

Definition at line 82 of file BookingCancellationGUI.php.

82 : string
83 {
84 switch ($this->type) {
86 return $this->lng->txt('cal_cancel_booking');
88 return $this->lng->txt('cal_ch_delete_booking');
89 }
90 }

References ILIAS\Repository\lng(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_CANCEL, and ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\TYPE_DELETE.

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\renderModal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::init ( )
private

Definition at line 192 of file BookingCancellationGUI.php.

192 : void
193 {
194 $this->has_multiple_bookings = $this->booking->getCurrentNumberOfBookings($this->entry->getEntryId()) > 1;
195 }

Referenced by ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\__construct().

+ Here is the caller graph for this function:

◆ renderModal()

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::renderModal ( )

Definition at line 60 of file BookingCancellationGUI.php.

61 {
62 $modal_title = $this->getTitle();
64 $components[] = $this->getInfoBox();
65 if (!$this->has_multiple_bookings) {
66 $components[] = $this->getBookingInfo();
67 }
68 return $this->ui_factory->modal()->roundtrip(
69 $modal_title,
71 [
72 'bookings' => $this->getInputs()
73 ],
74 $this->ctrl->getLinkTarget(
75 $this->parent_object,
76 $this->type == self::TYPE_CANCEL ? 'cancelBooking' : 'deleteBooking'
77 )
78 )->withCancelButtonLabel($this->lng->txt('close'))
79 ->withSubmitLabel($this->getSubmitLabel());
80 }
$components

References $components, ILIAS\Repository\ctrl(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getBookingInfo(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getConfirmationBox(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getInfoBox(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getInputs(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getSubmitLabel(), ILIAS\Calendar\ConsultationHours\BookingCancellationGUI\getTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $booking

ilBookingEntry ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$booking
private

◆ $ctrl

ilCtrlInterface ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$ctrl
private

Definition at line 38 of file BookingCancellationGUI.php.

◆ $entry

ilCalendarEntry ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$entry
private

◆ $has_multiple_bookings

bool ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$has_multiple_bookings = false
private

Definition at line 34 of file BookingCancellationGUI.php.

◆ $lng

ilLanguage ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$lng
private

Definition at line 40 of file BookingCancellationGUI.php.

◆ $parent_object

ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$parent_object
private

◆ $type

int ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$type
private

◆ $ui_factory

ILIAS UI Factory ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$ui_factory
private

Definition at line 36 of file BookingCancellationGUI.php.

◆ $ui_renderer

ILIAS UI Renderer ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::$ui_renderer
private

Definition at line 37 of file BookingCancellationGUI.php.

◆ TYPE_CANCEL

◆ TYPE_DELETE


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