ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilBookingProcessWithoutScheduleGUI Class Reference

Booking process ui class. More...

+ Inheritance diagram for ilBookingProcessWithoutScheduleGUI:
+ Collaboration diagram for ilBookingProcessWithoutScheduleGUI:

Public Member Functions

 __construct (ilObjBookingPool $pool, int $booking_object_id, int $context_obj_id=0)
 
 executeCommand ()
 
 book ()
 Triggered from object list week view for booking a single object / confirmation for. More...
 
 assignParticipants ()
 
 bookMultipleParticipants ()
 Create reservations for a bunch of booking pool participants. More...
 
 redirectToParticipantsList ()
 
 saveMultipleBookings ()
 Save multiple users reservations for one booking pool object. More...
 
 confirmedBooking ($message="")
 
 displayPostInfo ()
 
 deliverPostFile ()
 
 back ()
 

Protected Member Functions

 getMessageForm ()
 
 showMessageForm ()
 
 saveMessage ()
 
 showConfirmation ()
 

Protected Attributes

ILIAS BookingManager Reservations ReservationManager $reservation
 
ILIAS BookingManager BookingProcess ProcessUtilGUI $util_gui
 
ILIAS BookingManager InternalRepoService $repo
 
ILIAS BookingManager BookingProcess BookingProcessManager $process
 
ILIAS HTTP Services $http
 
ILIAS BookingManager InternalGUIService $gui
 
array $raw_post_data
 
ILIAS BookingManager StandardGUIRequest $book_request
 
ilObjBookingPool $pool
 
int $booking_object_id
 
int $user_id_to_book
 
int $user_id_assigner
 
ilBookingHelpAdapter $help
 
int $context_obj_id
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccessHandler $access
 
ilTabsGUI $tabs_gui
 
ilObjUser $user
 
int $book_obj_id
 
array $rsv_ids = []
 

Detailed Description

Booking process ui class.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilBookingProcessWithoutScheduleGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingProcessWithoutScheduleGUI::__construct ( ilObjBookingPool  $pool,
int  $booking_object_id,
int  $context_obj_id = 0 
)

Definition at line 50 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $booking_object_id, $context_obj_id, $DIC, $pool, $user_id_assigner, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

54  {
55  global $DIC;
56 
57  $this->ctrl = $DIC->ctrl();
58  $this->tpl = $DIC["tpl"];
59  $this->lng = $DIC->language();
60  $this->access = $DIC->access();
61  $this->tabs_gui = $DIC->tabs();
62  $this->user = $DIC->user();
63  $this->help = $DIC->bookingManager()->internal()
64  ->gui()->bookingHelp($pool);
65  $this->http = $DIC->http();
66 
67  $this->context_obj_id = $context_obj_id;
68 
69  $this->book_obj_id = $booking_object_id;
70 
71  $this->pool = $pool;
72 
73  $this->book_request = $DIC->bookingManager()
74  ->internal()
75  ->gui()
76  ->standardRequest();
77 
78  $this->gui = $DIC->bookingManager()
79  ->internal()
80  ->gui();
81 
82  $this->repo = $DIC->bookingManager()
83  ->internal()
84  ->repo();
85 
86  $this->rsv_ids = $this->book_request->getReservationIdsFromString();
87 
88  $this->raw_post_data = $DIC->http()->request()->getParsedBody();
89 
90  $this->user_id_assigner = $this->user->getId();
91  if ($this->book_request->getBookedUser() > 0) {
92  $this->user_id_to_book = $this->book_request->getBookedUser();
93  } else {
94  $this->user_id_to_book = $this->user_id_assigner; // by default user books his own booking objects.
95  }
96  $this->ctrl->saveParameter($this, ["bkusr", "returnCmd"]);
97 
98  $this->process = $DIC->bookingManager()->internal()->domain()->process();
99  $this->reservation = $DIC->bookingManager()->internal()->domain()->reservations();
100  $this->util_gui = $DIC->bookingManager()->internal()->gui()->process()->ProcessUtilGUI(
101  $this->pool,
102  $this
103  );
104  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ assignParticipants()

ilBookingProcessWithoutScheduleGUI::assignParticipants ( )

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

Definition at line 215 of file class.ilBookingProcessWithoutScheduleGUI.php.

215  : void
216  {
217  $this->util_gui->assignParticipants($this->book_obj_id);
218  }

◆ back()

ilBookingProcessWithoutScheduleGUI::back ( )

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

Definition at line 361 of file class.ilBookingProcessWithoutScheduleGUI.php.

References ILIAS\Repository\ctrl().

361  : void
362  {
363  $this->ctrl->redirectByClass(\ilObjBookingPoolGUI::class, 'render');
364  }
+ Here is the call graph for this function:

◆ book()

ilBookingProcessWithoutScheduleGUI::book ( )

Triggered from object list week view for booking a single object / confirmation for.

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

Definition at line 140 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), showConfirmation(), and showMessageForm().

140  : void // ok
141  {
142  $tpl = $this->tpl;
143 
144  $this->tabs_gui->clearTargets();
145  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
146 
147  $this->util_gui->setHelpId("book");
148 
149  $obj = new ilBookingObject($this->book_obj_id);
150 
151  $this->lng->loadLanguageModule("dateplaner");
152  $this->ctrl->setParameter($this, 'object_id', $obj->getId());
153  $this->ctrl->setParameter($this, 'returnCmd', "back");
154 
155  if ($this->user_id_to_book !== $this->user_id_assigner) {
156  $this->ctrl->setParameter($this, 'bkusr', $this->user_id_to_book);
157  }
158 
159  if ($this->pool->usesMessages()) {
160  $this->showMessageForm();
161  } else {
162  $this->showConfirmation();
163  }
164  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ bookMultipleParticipants()

ilBookingProcessWithoutScheduleGUI::bookMultipleParticipants ( )

Create reservations for a bunch of booking pool participants.

Definition at line 223 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $id, ilObjUser\_lookupFullname(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilBookingReservation\numAvailableFromObjectNoSchedule().

223  : void
224  {
225  $participants = $this->book_request->getParticipants();
226  if (count($participants) === 0) {
227  $this->util_gui->back();
228  return;
229  }
230 
231  $this->tabs_gui->clearTargets();
232  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, 'assignparticipants'));
233 
234  $conf = new ilConfirmationGUI();
235  $conf->setFormAction($this->ctrl->getFormAction($this));
236 
237  //add user list as items.
238  foreach ($participants as $id) {
239  $name = ilObjUser::_lookupFullname($id);
240  $conf->addItem("participants[]", $id, $name);
241  }
242 
243  $available = ilBookingReservation::numAvailableFromObjectNoSchedule($this->book_obj_id);
244  if (count($participants) > $available) {
245  $obj = new ilBookingObject($this->book_obj_id);
246  $this->tpl->setOnScreenMessage("failure", sprintf(
247  $this->lng->txt('book_limit_objects_available'),
248  count($participants),
249  $obj->getTitle(),
250  $available
251  ), true);
252  $this->ctrl->redirect($this, "redirectToParticipantsList");
253  } else {
254  $conf->setHeaderText($this->lng->txt('book_confirm_booking_no_schedule'));
255  $conf->addHiddenItem("object_id", $this->book_obj_id);
256  $conf->setConfirm($this->lng->txt("assign"), "saveMultipleBookings");
257  }
258 
259  $conf->setCancel($this->lng->txt("cancel"), 'redirectToParticipantsList');
260  $this->tpl->setContent($conf->getHTML());
261  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupFullname(int $a_user_id)
static numAvailableFromObjectNoSchedule(int $a_obj_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ confirmedBooking()

ilBookingProcessWithoutScheduleGUI::confirmedBooking (   $message = "")

Definition at line 306 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $book_obj_id, $message, ILIAS\Repository\ctrl(), ilBookingReservation\getObjectReservationForUser(), ilBookingReservation\isObjectAvailableNoSchedule(), and ILIAS\Repository\lng().

Referenced by saveMessage().

306  : bool
307  {
308  $success = false;
309  $rsv_ids = array();
310 
311  if ($this->book_obj_id > 0) {
312  $object_id = $this->book_obj_id;
313  if ($object_id) {
315  count(ilBookingReservation::getObjectReservationForUser($object_id, $this->user_id_to_book)) === 0) { // #18304
316  $rsv_ids[] = $this->process->bookSingle(
317  $object_id,
318  $this->user_id_to_book,
319  $this->user_id_assigner,
320  $this->context_obj_id,
321  null,
322  null,
323  null,
324  $message
325  );
326  $success = $object_id;
327  } else {
328  // #11852
329  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed_overbooked'), true);
330  $this->ctrl->redirect($this, 'back');
331  }
332  }
333  }
334 
335  if ($success) {
336  $this->util_gui->handleBookingSuccess($success, "displayPostInfo", $rsv_ids);
337  } else {
338  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed'), true);
339  $this->ctrl->redirect($this, 'book');
340  }
341  return true;
342  }
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
static isObjectAvailableNoSchedule(int $a_obj_id)
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverPostFile()

ilBookingProcessWithoutScheduleGUI::deliverPostFile ( )

Definition at line 353 of file class.ilBookingProcessWithoutScheduleGUI.php.

353  : void
354  {
355  $this->util_gui->deliverPostFile(
356  $this->book_obj_id,
357  $this->user_id_assigner
358  );
359  }

◆ displayPostInfo()

ilBookingProcessWithoutScheduleGUI::displayPostInfo ( )

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

Definition at line 344 of file class.ilBookingProcessWithoutScheduleGUI.php.

344  : void
345  {
346  $this->util_gui->displayPostInfo(
347  $this->book_obj_id,
348  $this->user_id_assigner,
349  "deliverPostFile"
350  );
351  }

◆ executeCommand()

ilBookingProcessWithoutScheduleGUI::executeCommand ( )

Definition at line 106 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

106  : void
107  {
108  $ctrl = $this->ctrl;
109 
110  $next_class = $ctrl->getNextClass($this);
111  $cmd = $ctrl->getCmd("show");
112  switch ($next_class) {
113  default:
114  if (in_array($cmd, array(
115  "book",
116  "back",
117  "assignParticipants",
118  "bookMultipleParticipants",
119  "saveMultipleBookings",
120  "confirmedBooking",
121  "displayPostInfo",
122  "deliverPostFile",
123  "redirectToParticipantsList",
124  "saveMessage"
125  ))) {
126  $this->$cmd();
127  }
128  }
129  }
getCmd(string $fallback_command=null)
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ getMessageForm()

ilBookingProcessWithoutScheduleGUI::getMessageForm ( )
protected

Definition at line 166 of file class.ilBookingProcessWithoutScheduleGUI.php.

References ILIAS\Repository\lng().

Referenced by saveMessage(), and showMessageForm().

167  {
168  $obj = new ilBookingObject($this->book_obj_id);
169  return $this->gui->form([self::class], "saveMessage", $this->lng->txt("book_book"))
170  ->section("main", $this->lng->txt("book_booking") . ": " . $obj->getTitle())
171  ->textarea(
172  "message",
173  $this->lng->txt("book_message"),
174  $this->lng->txt("book_message_info")
175  );
176  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToParticipantsList()

ilBookingProcessWithoutScheduleGUI::redirectToParticipantsList ( )

Definition at line 263 of file class.ilBookingProcessWithoutScheduleGUI.php.

References ILIAS\Repository\ctrl().

263  : void
264  {
265  $this->ctrl->redirect($this, 'assignParticipants');
266  }
+ Here is the call graph for this function:

◆ saveMessage()

ilBookingProcessWithoutScheduleGUI::saveMessage ( )
protected

Definition at line 183 of file class.ilBookingProcessWithoutScheduleGUI.php.

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

183  : void
184  {
185  $this->ctrl->saveParameter($this, ['object_id', 'returnCmd', 'bkusr']);
186  $form = $this->getMessageForm();
187  if (!$form->isValid()) {
188  $this->tabs_gui->clearTargets();
189  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
190  $this->tpl->setContent($form->render());
191  return;
192  }
193  $this->confirmedBooking($form->getData("message"));
194  }
+ Here is the call graph for this function:

◆ saveMultipleBookings()

ilBookingProcessWithoutScheduleGUI::saveMultipleBookings ( )

Save multiple users reservations for one booking pool object.

Todo:
check if object/user exist in the DB,

Definition at line 272 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $id, and ILIAS\Repository\lng().

272  : void
273  {
274  $participants = $this->book_request->getParticipants();
275  $object_id = $this->book_request->getObjectId();
276  if (count($participants) > 0 && $object_id > 0) {
277  $this->book_obj_id = $object_id;
278  } else {
279  $this->util_gui->back();
280  }
281  $rsv_ids = array();
282  foreach ($participants as $id) {
283  $this->user_id_to_book = $id;
284  $rsv_ids[] = $this->process->bookSingle(
285  $this->book_obj_id,
286  $this->user_id_to_book,
287  $this->user_id_assigner,
288  $this->context_obj_id
289  );
290  }
291 
292  if (count($rsv_ids)) {
293  $this->tpl->setOnScreenMessage('success', "booking_multiple_succesfully");
294  } else {
295  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed_overbooked'), true);
296  }
297  $this->util_gui->back();
298  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ showConfirmation()

ilBookingProcessWithoutScheduleGUI::showConfirmation ( )
protected

Definition at line 196 of file class.ilBookingProcessWithoutScheduleGUI.php.

References $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setContent().

Referenced by book().

196  : void
197  {
198  $tpl = $this->tpl;
199 
200  $obj = new ilBookingObject($this->book_obj_id);
201 
202  $cgui = new ilConfirmationGUI();
203  $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
204 
205  $cgui->setFormAction($this->ctrl->getFormAction($this));
206  $cgui->setCancel($this->lng->txt("cancel"), "back");
207  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
208 
209  $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
210 
211  $tpl->setContent($cgui->getHTML());
212  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMessageForm()

ilBookingProcessWithoutScheduleGUI::showMessageForm ( )
protected

Definition at line 178 of file class.ilBookingProcessWithoutScheduleGUI.php.

References getMessageForm().

Referenced by book().

178  : void
179  {
180  $this->tpl->setContent($this->getMessageForm()->render());
181  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingProcessWithoutScheduleGUI::$access
protected

Definition at line 44 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $book_obj_id

int ilBookingProcessWithoutScheduleGUI::$book_obj_id
protected

Definition at line 47 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by confirmedBooking().

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingProcessWithoutScheduleGUI::$book_request
protected

Definition at line 34 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $booking_object_id

int ilBookingProcessWithoutScheduleGUI::$booking_object_id
protected

Definition at line 36 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by __construct().

◆ $context_obj_id

int ilBookingProcessWithoutScheduleGUI::$context_obj_id
protected

Definition at line 40 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilBookingProcessWithoutScheduleGUI::$ctrl
protected

Definition at line 41 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by executeCommand().

◆ $gui

ILIAS BookingManager InternalGUIService ilBookingProcessWithoutScheduleGUI::$gui
protected

Definition at line 32 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $help

ilBookingHelpAdapter ilBookingProcessWithoutScheduleGUI::$help
protected

Definition at line 39 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $http

ILIAS HTTP Services ilBookingProcessWithoutScheduleGUI::$http
protected

Definition at line 31 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $lng

ilLanguage ilBookingProcessWithoutScheduleGUI::$lng
protected

Definition at line 43 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $pool

ilObjBookingPool ilBookingProcessWithoutScheduleGUI::$pool
protected

Definition at line 35 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by __construct().

◆ $process

ILIAS BookingManager BookingProcess BookingProcessManager ilBookingProcessWithoutScheduleGUI::$process
protected

Definition at line 30 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $raw_post_data

array ilBookingProcessWithoutScheduleGUI::$raw_post_data
protected

Definition at line 33 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $repo

ILIAS BookingManager InternalRepoService ilBookingProcessWithoutScheduleGUI::$repo
protected

Definition at line 29 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $reservation

ILIAS BookingManager Reservations ReservationManager ilBookingProcessWithoutScheduleGUI::$reservation
protected

Definition at line 27 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $rsv_ids

array ilBookingProcessWithoutScheduleGUI::$rsv_ids = []
protected

Definition at line 48 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $tabs_gui

ilTabsGUI ilBookingProcessWithoutScheduleGUI::$tabs_gui
protected

Definition at line 45 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilBookingProcessWithoutScheduleGUI::$tpl
protected

Definition at line 42 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by book(), and showConfirmation().

◆ $user

ilObjUser ilBookingProcessWithoutScheduleGUI::$user
protected

Definition at line 46 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $user_id_assigner

int ilBookingProcessWithoutScheduleGUI::$user_id_assigner
protected

Definition at line 38 of file class.ilBookingProcessWithoutScheduleGUI.php.

Referenced by __construct().

◆ $user_id_to_book

int ilBookingProcessWithoutScheduleGUI::$user_id_to_book
protected

Definition at line 37 of file class.ilBookingProcessWithoutScheduleGUI.php.

◆ $util_gui

ILIAS BookingManager BookingProcess ProcessUtilGUI ilBookingProcessWithoutScheduleGUI::$util_gui
protected

Definition at line 28 of file class.ilBookingProcessWithoutScheduleGUI.php.


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