ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBookingProcessWithoutScheduleGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 book ()
 
 assignParticipants ()
 
 displayPostInfo ()
 
 back ()
 

Protected Member Functions

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

Protected Attributes

ILIAS BookingManager Access AccessManager $access
 
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
 
ilTabsGUI $tabs_gui
 
ilObjUser $user
 
int $book_obj_id
 
array $rsv_ids = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Booking process ui class

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

Definition at line 23 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 48 of file class.ilBookingProcessWithoutScheduleGUI.php.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ assignParticipants()

ilBookingProcessWithoutScheduleGUI::assignParticipants ( )

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

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

223 : void
224 {
225 $this->util_gui->assignParticipants($this->book_obj_id);
226 }

◆ back()

ilBookingProcessWithoutScheduleGUI::back ( )

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

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

377 : void
378 {
379 $this->ctrl->redirectByClass(\ilObjBookingPoolGUI::class, 'render');
380 }

References ILIAS\Repository\ctrl().

Referenced by showNoPermission().

+ Here is the call graph for this function:
+ Here is the caller 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 144 of file class.ilBookingProcessWithoutScheduleGUI.php.

144 : void // ok
145 {
147
148 $this->tabs_gui->clearTargets();
149 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
150
151 $this->util_gui->setHelpId("book");
152
153 $obj = new ilBookingObject($this->book_obj_id);
154
155 $this->lng->loadLanguageModule("dateplaner");
156 $this->ctrl->setParameter($this, 'object_id', $obj->getId());
157 $this->ctrl->setParameter($this, 'returnCmd', "back");
158
159 if ($this->user_id_to_book !== $this->user_id_assigner) {
160 $this->ctrl->setParameter($this, 'bkusr', $this->user_id_to_book);
161 }
162
163 if (!$this->access->canManageReservationForUser($this->book_request->getRefId(), $this->user_id_to_book)) {
164 return;
165 }
166
167 if ($this->pool->usesMessages()) {
168 $this->showMessageForm();
169 } else {
170 $this->showConfirmation();
171 }
172 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ bookMultipleParticipants()

ilBookingProcessWithoutScheduleGUI::bookMultipleParticipants ( )

Create reservations for a bunch of booking pool participants.

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

231 : void
232 {
233 $participants = $this->book_request->getParticipants();
234 if (count($participants) === 0) {
235 $this->util_gui->back();
236 return;
237 }
238
239 $this->tabs_gui->clearTargets();
240 $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, 'assignparticipants'));
241
242 $conf = new ilConfirmationGUI();
243 $conf->setFormAction($this->ctrl->getFormAction($this));
244
245 //add user list as items.
246 foreach ($participants as $id) {
247 if (!$this->access->canManageReservationForUser($this->pool->getRefId(), $id)) {
248 $this->showNoPermission();
249 return;
250 }
252 $conf->addItem("participants[]", $id, $name);
253 }
254
255 $available = ilBookingReservation::numAvailableFromObjectNoSchedule($this->book_obj_id);
256 if (count($participants) > $available) {
257 $obj = new ilBookingObject($this->book_obj_id);
258 $this->tpl->setOnScreenMessage("failure", sprintf(
259 $this->lng->txt('book_limit_objects_available'),
260 count($participants),
261 $obj->getTitle(),
262 $available
263 ), true);
264 $this->ctrl->redirect($this, "redirectToParticipantsList");
265 } else {
266 $conf->setHeaderText($this->lng->txt('book_confirm_booking_for_users'));
267 $conf->addHiddenItem("object_id", $this->book_obj_id);
268 $conf->setConfirm($this->lng->txt("assign"), "saveMultipleBookings");
269 }
270
271 $conf->setCancel($this->lng->txt("cancel"), 'redirectToParticipantsList');
272 $this->tpl->setContent($conf->getHTML());
273 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static numAvailableFromObjectNoSchedule(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupFullname(int $a_user_id)

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

+ Here is the call graph for this function:

◆ confirmedBooking()

ilBookingProcessWithoutScheduleGUI::confirmedBooking (   $message = "")

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

322 : bool
323 {
324 $success = false;
325 $rsv_ids = array();
326
327 if ($this->book_obj_id > 0) {
328 $object_id = $this->book_obj_id;
329 if ($object_id) {
331 count(ilBookingReservation::getObjectReservationForUser($object_id, $this->user_id_to_book)) === 0) { // #18304
332 $rsv_ids[] = $this->process->bookSingle(
333 $object_id,
334 $this->user_id_to_book,
335 $this->user_id_assigner,
336 $this->context_obj_id,
337 null,
338 null,
339 null,
341 );
342 $success = $object_id;
343 } else {
344 // #11852
345 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed_overbooked'), true);
346 $this->ctrl->redirect($this, 'back');
347 }
348 }
349 }
350
351 if ($success) {
352 $this->util_gui->handleBookingSuccess($success, "displayPostInfo", $rsv_ids);
353 } else {
354 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed'), true);
355 $this->ctrl->redirect($this, 'book');
356 }
357 return true;
358 }
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
static isObjectAvailableNoSchedule(int $a_obj_id)
$message
Definition: xapiexit.php:31

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

Referenced by saveMessage().

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

◆ deliverPostFile()

ilBookingProcessWithoutScheduleGUI::deliverPostFile ( )

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

369 : void
370 {
371 $this->util_gui->deliverPostFile(
372 $this->book_obj_id,
373 $this->user_id_assigner
374 );
375 }

◆ displayPostInfo()

ilBookingProcessWithoutScheduleGUI::displayPostInfo ( )

Implements ILIAS\BookingManager\BookingProcess\BookingProcessGUI.

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

360 : void
361 {
362 $this->util_gui->displayPostInfo(
363 $this->book_obj_id,
364 $this->user_id_assigner,
365 "deliverPostFile"
366 );
367 }

◆ executeCommand()

ilBookingProcessWithoutScheduleGUI::executeCommand ( )

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

104 : void
105 {
107
108 $next_class = $ctrl->getNextClass($this);
109 $cmd = $ctrl->getCmd("show");
110 switch ($next_class) {
111 default:
112 if (in_array($cmd, array(
113 "book",
114 "back",
115 "assignParticipants",
116 "bookMultipleParticipants",
117 "saveMultipleBookings",
118 "confirmedBooking",
119 "displayPostInfo",
120 "deliverPostFile",
121 "redirectToParticipantsList",
122 "saveMessage"
123 ))) {
124 $this->$cmd();
125 }
126 }
127 }
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc

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

+ Here is the call graph for this function:

◆ getMessageForm()

ilBookingProcessWithoutScheduleGUI::getMessageForm ( )
protected

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

175 {
176 $obj = new ilBookingObject($this->book_obj_id);
177 return $this->gui->form([self::class], "saveMessage", $this->lng->txt("book_book"))
178 ->section("main", $this->lng->txt("book_booking") . ": " . $obj->getTitle())
179 ->textarea(
180 "message",
181 $this->lng->txt("book_message"),
182 $this->lng->txt("book_message_info")
183 );
184 }

References ILIAS\Repository\lng().

Referenced by saveMessage(), and showMessageForm().

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

◆ redirectToParticipantsList()

ilBookingProcessWithoutScheduleGUI::redirectToParticipantsList ( )

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

275 : void
276 {
277 $this->ctrl->redirect($this, 'assignParticipants');
278 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveMessage()

ilBookingProcessWithoutScheduleGUI::saveMessage ( )
protected

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

191 : void
192 {
193 $this->ctrl->saveParameter($this, ['object_id', 'returnCmd', 'bkusr']);
194 $form = $this->getMessageForm();
195 if (!$form->isValid()) {
196 $this->tabs_gui->clearTargets();
197 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
198 $this->tpl->setContent($form->render());
199 return;
200 }
201 $this->confirmedBooking($form->getData("message"));
202 }

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

+ 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 284 of file class.ilBookingProcessWithoutScheduleGUI.php.

284 : void
285 {
286 $participants = $this->book_request->getParticipants();
287 $object_id = $this->book_request->getObjectId();
288 if (count($participants) > 0 && $object_id > 0) {
289 $this->book_obj_id = $object_id;
290 } else {
291 $this->util_gui->back();
292 }
293 $rsv_ids = array();
294 foreach ($participants as $id) {
295 if (!$this->access->canManageReservationForUser($this->pool->getRefId(), $id)) {
296 $this->showNoPermission();
297 return;
298 }
299 $this->user_id_to_book = $id;
300 $rsv_ids[] = $this->process->bookSingle(
301 $this->book_obj_id,
302 $this->user_id_to_book,
303 $this->user_id_assigner,
304 $this->context_obj_id
305 );
306 }
307
308 if (count($rsv_ids)) {
309 $this->tpl->setOnScreenMessage('success', "booking_multiple_succesfully");
310 } else {
311 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed_overbooked'), true);
312 }
313 $this->util_gui->back();
314 }

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

+ Here is the call graph for this function:

◆ showConfirmation()

ilBookingProcessWithoutScheduleGUI::showConfirmation ( )
protected

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

204 : void
205 {
207
208 $obj = new ilBookingObject($this->book_obj_id);
209
210 $cgui = new ilConfirmationGUI();
211 $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
212
213 $cgui->setFormAction($this->ctrl->getFormAction($this));
214 $cgui->setCancel($this->lng->txt("cancel"), "back");
215 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
216
217 $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
218
219 $tpl->setContent($cgui->getHTML());
220 }
setContent(string $a_html)
Sets content for standard template.

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

Referenced by book().

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

◆ showMessageForm()

ilBookingProcessWithoutScheduleGUI::showMessageForm ( )
protected

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

186 : void
187 {
188 $this->tpl->setContent($this->getMessageForm()->render());
189 }

References getMessageForm().

Referenced by book().

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

◆ showNoPermission()

ilBookingProcessWithoutScheduleGUI::showNoPermission ( )
protected

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

129 : void
130 {
131 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
132 $this->back();
133 }

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

Referenced by bookMultipleParticipants(), and saveMultipleBookings().

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

Field Documentation

◆ $access

ILIAS BookingManager Access AccessManager ilBookingProcessWithoutScheduleGUI::$access
protected

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

◆ $book_obj_id

int ilBookingProcessWithoutScheduleGUI::$book_obj_id
protected

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

Referenced by confirmedBooking().

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingProcessWithoutScheduleGUI::$book_request
protected

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

◆ $booking_object_id

int ilBookingProcessWithoutScheduleGUI::$booking_object_id
protected

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

Referenced by __construct().

◆ $context_obj_id

int ilBookingProcessWithoutScheduleGUI::$context_obj_id
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrl ilBookingProcessWithoutScheduleGUI::$ctrl
protected

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

Referenced by executeCommand().

◆ $gui

ILIAS BookingManager InternalGUIService ilBookingProcessWithoutScheduleGUI::$gui
protected

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

◆ $help

ilBookingHelpAdapter ilBookingProcessWithoutScheduleGUI::$help
protected

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

◆ $http

ILIAS HTTP Services ilBookingProcessWithoutScheduleGUI::$http
protected

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

◆ $lng

ilLanguage ilBookingProcessWithoutScheduleGUI::$lng
protected

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

◆ $pool

ilObjBookingPool ilBookingProcessWithoutScheduleGUI::$pool
protected

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

Referenced by __construct().

◆ $process

ILIAS BookingManager BookingProcess BookingProcessManager ilBookingProcessWithoutScheduleGUI::$process
protected

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

◆ $raw_post_data

array ilBookingProcessWithoutScheduleGUI::$raw_post_data
protected

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

◆ $repo

ILIAS BookingManager InternalRepoService ilBookingProcessWithoutScheduleGUI::$repo
protected

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

◆ $reservation

ILIAS BookingManager Reservations ReservationManager ilBookingProcessWithoutScheduleGUI::$reservation
protected

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

◆ $rsv_ids

array ilBookingProcessWithoutScheduleGUI::$rsv_ids = []
protected

◆ $tabs_gui

ilTabsGUI ilBookingProcessWithoutScheduleGUI::$tabs_gui
protected

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

◆ $tpl

ilGlobalTemplateInterface ilBookingProcessWithoutScheduleGUI::$tpl
protected

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

Referenced by book(), and showConfirmation().

◆ $user

ilObjUser ilBookingProcessWithoutScheduleGUI::$user
protected

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

◆ $user_id_assigner

int ilBookingProcessWithoutScheduleGUI::$user_id_assigner
protected

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

Referenced by __construct().

◆ $user_id_to_book

int ilBookingProcessWithoutScheduleGUI::$user_id_to_book
protected

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

◆ $util_gui

ILIAS BookingManager BookingProcess ProcessUtilGUI ilBookingProcessWithoutScheduleGUI::$util_gui
protected

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


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