ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 20 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 42 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().

43  {
44  global $DIC;
45 
46  $this->ui_factory = $DIC->ui()->factory();
47  $this->ui_renderer = $DIC->ui()->renderer();
48  $this->ctrl = $DIC->ctrl();
49  $this->lng = $DIC->language();
50 
51  $this->parent_object = $parent_object;
52  $this->entry = $entry;
53  $this->booking = $booking;
54  $this->type = $type;
55 
56  $this->init();
57  }
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:

Member Function Documentation

◆ getActionButton()

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

Definition at line 129 of file BookingCancellationGUI.php.

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

129  : \ILIAS\UI\Component\Button\Button
130  {
131  switch ($this->type) {
132  case self::TYPE_CANCEL:
133  return $this->ui_factory->button()->primary(
134  $this->lng->txt('cal_cancel_booking'),
135  $this->ctrl->getLinkTarget($this->parent_object, 'cancelBooking')
136  );
137  case self::TYPE_DELETE:
138  return $this->ui_factory->button()->primary(
139  $this->lng->txt('cal_ch_delete_booking'),
140  $this->ctrl->getLinkTarget($this->parent_object, 'deleteBooking')
141  );
142  }
143  }
+ Here is the call graph for this function:

◆ getAppointmentTitle()

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

Definition at line 184 of file BookingCancellationGUI.php.

References ilDatePresentation\formatDate().

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

184  : string
185  {
186  return
187  $this->entry->getTitle() . ', ' .
188  \ilDatePresentation::formatDate($this->entry->getStart());
189  }
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 145 of file BookingCancellationGUI.php.

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

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

145  : \ILIAS\UI\Component\Component
146  {
147  $user_info = [];
148  foreach ($this->booking->getCurrentBookings($this->entry->getEntryId()) as $booking_user_id) {
149  $user_info[] =
150  $this->getAppointmentTitle() . ': ' .
151  \ilObjUser::_lookupFullname($booking_user_id);
152 
153  }
154  return $this->ui_factory->legacy(implode('<br/', $user_info));
155  }
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 101 of file BookingCancellationGUI.php.

References ILIAS\Repository\lng().

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

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

References ILIAS\Repository\lng().

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

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

158  {
159  $section_title = '';
160  $inputs = [];
161  if ($this->has_multiple_bookings) {
162  $section_title = $this->getAppointmentTitle();
163  foreach ($this->booking->getCurrentBookings($this->entry->getEntryId()) as $bookuser) {
164  $inputs[(string) $bookuser] =
165  $this->ui_factory->input()->field()->checkbox(
166  \ilObjUser::_lookupFullname($bookuser)
167  )->withValue(true);
168  }
169  } else {
170  $section_title = '';
171  foreach ($this->booking->getCurrentBookings($this->entry->getEntryId()) as $bookuser) {
172  $inputs[(string) $bookuser] =
173  $this->ui_factory->input()->field()->hidden(
174  )->withValue(true);
175  }
176  }
177 
178  return $this->ui_factory->input()->field()->section(
179  $inputs,
180  $section_title
181  );
182  }
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 91 of file BookingCancellationGUI.php.

References ILIAS\Repository\lng().

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

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

References ILIAS\Repository\lng().

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

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

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

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

◆ renderModal()

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

Definition at line 59 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().

59  : \ILIAS\UI\Component\Modal\RoundTrip
60  {
61  $modal_title = $this->getTitle();
62  $components[] = $this->getConfirmationBox();
63  $components[] = $this->getInfoBox();
64  if (!$this->has_multiple_bookings) {
65  $components[] = $this->getBookingInfo();
66  }
67  return $this->ui_factory->modal()->roundtrip(
68  $modal_title,
70  [
71  'bookings' => $this->getInputs()
72  ],
73  $this->ctrl->getLinkTarget(
74  $this->parent_object,
75  $this->type == self::TYPE_CANCEL ? 'cancelBooking' : 'deleteBooking'
76  )
77  )->withCancelButtonLabel($this->lng->txt('close'))
78  ->withSubmitLabel($this->getSubmitLabel());
79  }
$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 37 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 33 of file BookingCancellationGUI.php.

◆ $lng

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

Definition at line 39 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 35 of file BookingCancellationGUI.php.

◆ $ui_renderer

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

Definition at line 36 of file BookingCancellationGUI.php.

◆ TYPE_CANCEL

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

Definition at line 22 of file BookingCancellationGUI.php.

◆ TYPE_DELETE

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

Definition at line 23 of file BookingCancellationGUI.php.


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