ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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.

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().

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
+ 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.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

130  : \ILIAS\UI\Component\Button\Button
131  {
132  switch ($this->type) {
133  case self::TYPE_CANCEL:
134  return $this->ui_factory->button()->primary(
135  $this->lng->txt('cal_cancel_booking'),
136  $this->ctrl->getLinkTarget($this->parent_object, 'cancelBooking')
137  );
138  case self::TYPE_DELETE:
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  }
+ Here is the call graph for this function:

◆ getAppointmentTitle()

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

Definition at line 185 of file BookingCancellationGUI.php.

References ilDatePresentation\formatDate().

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

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,)
+ 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.

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

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

146  : \ILIAS\UI\Component\Component
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)
+ 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.

References ILIAS\Repository\lng().

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

102  : \ILIAS\UI\Component\Component
103  {
104  switch ($this->type) {
105  case self::TYPE_CANCEL:
106  return $this->ui_factory->messageBox()->confirmation(
107  $this->lng->txt('cal_ch_cancel_booking_sure')
108  );
109  case self::TYPE_DELETE:
110  return $this->ui_factory->messageBox()->confirmation(
111  $this->lng->txt('cal_ch_delete_booking_sure')
112  );
113  }
114  }
+ 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.

References ILIAS\Repository\lng().

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

116  : \ILIAS\UI\Component\Component
117  {
118  switch ($this->type) {
119  case self::TYPE_CANCEL:
120  return $this->ui_factory->messageBox()->info(
121  $this->lng->txt('cal_ch_cancel_booking_info')
122  );
123  case self::TYPE_DELETE:
124  return $this->ui_factory->messageBox()->info(
125  $this->lng->txt('cal_ch_delete_booking_info')
126  );
127  }
128  }
+ 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.

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

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

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(
167  \ilObjUser::_lookupFullname($bookuser)
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  }
static _lookupFullname(int $a_user_id)
+ 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.

References ILIAS\Repository\lng().

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

92  : string
93  {
94  switch ($this->type) {
95  case self::TYPE_CANCEL:
96  return $this->lng->txt('cal_cancel_booking');
97  case self::TYPE_DELETE:
98  return $this->lng->txt('cal_ch_delete_booking');
99  }
100  }
+ 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.

References ILIAS\Repository\lng().

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

82  : string
83  {
84  switch ($this->type) {
85  case self::TYPE_CANCEL:
86  return $this->lng->txt('cal_cancel_booking');
87  case self::TYPE_DELETE:
88  return $this->lng->txt('cal_ch_delete_booking');
89  }
90  }
+ 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.

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

192  : void
193  {
194  $this->has_multiple_bookings = $this->booking->getCurrentNumberOfBookings($this->entry->getEntryId()) > 1;
195  }
+ Here is the caller graph for this function:

◆ renderModal()

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

Definition at line 60 of file BookingCancellationGUI.php.

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().

60  : \ILIAS\UI\Component\Modal\RoundTrip
61  {
62  $modal_title = $this->getTitle();
63  $components[] = $this->getConfirmationBox();
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
+ 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

const ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::TYPE_CANCEL = 1

Definition at line 23 of file BookingCancellationGUI.php.

◆ TYPE_DELETE

const ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::TYPE_DELETE = 2

Definition at line 24 of file BookingCancellationGUI.php.


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