30 protected \ILIAS\BookingManager\Reservations\ReservationManager
$reservation;
31 protected \ILIAS\BookingManager\BookingProcess\ProcessUtilGUI
$util_gui;
32 protected \ILIAS\BookingManager\InternalRepoService
$repo;
33 protected \ILIAS\BookingManager\BookingProcess\BookingProcessManager
$process;
34 protected \ILIAS\HTTP\Services
$http;
35 protected \ILIAS\BookingManager\InternalGUIService
$gui;
56 int $booking_object_id,
58 int $context_obj_id = 0
62 $this->
ctrl = $DIC->ctrl();
63 $this->tpl = $DIC[
"tpl"];
64 $this->
lng = $DIC->language();
65 $this->
access = $DIC->access();
66 $this->tabs_gui = $DIC->tabs();
67 $this->
user = $DIC->user();
68 $this->
http = $DIC->http();
77 $internal_service = $DIC->bookingManager()->internal();
78 $this->gui = $internal_service->gui();
79 $domain = $internal_service->domain();
80 $this->book_request = $this->gui->standardRequest();
81 $this->
help = $this->gui->bookingHelp($pool);
82 $this->log = $domain->log();
84 $this->repo = $internal_service->repo();
86 $this->object_manager = $domain->objects($pool->
getId());
87 $this->object_selection = $domain->objectSelection($pool->
getId());
89 $this->rsv_ids = $this->book_request->getReservationIdsFromString();
91 $this->raw_post_data = $DIC->http()->request()->getParsedBody();
93 $this->user_id_assigner = $this->
user->getId();
94 if ($this->book_request->getBookedUser() > 0) {
95 $this->user_id_to_book = $this->book_request->getBookedUser();
99 $this->
ctrl->saveParameter($this, [
"bkusr",
"returnCmd"]);
100 $this->
ctrl->setParameter($this,
"seed", $this->seed);
102 $this->process = $DIC->bookingManager()->internal()->domain()->process();
103 $this->reservation = $DIC->bookingManager()->internal()->domain()->reservations();
104 $this->util_gui = $DIC->bookingManager()->internal()->gui()->process()->ProcessUtilGUI(
115 $cmd = $ctrl->
getCmd(
"show");
116 switch ($next_class) {
118 if (in_array($cmd, array(
"book",
"back",
"week",
119 "assignParticipants",
120 "bookMultipleParticipants",
121 "saveMultipleBookings",
126 "bookAvailableItems",
129 "redirectToParticipantsList" 147 $this->log->debug(
"Step 0, week");
152 $this->util_gui->setHelpId(
"week");
153 $this->
ctrl->setParameter($this,
'returnCmd',
"week");
155 if ($this->user_id_to_book !== $this->user_id_assigner) {
156 $this->
ctrl->setParameter($this,
'bkusr', $this->user_id_to_book);
160 $week_gui = new \ILIAS\BookingManager\BookingProcess\WeekGUI(
163 $this->object_selection->getSelectedObjects(),
164 $this->pool->getId(),
166 $user_settings->getWeekStart()
170 $bar = $this->gui->toolbar();
171 $list_link = $this->
ctrl->getLinkTargetByClass(
"ilObjBookingPoolGUI",
"render");
172 $week_link = $this->
ctrl->getLinkTargetByClass(
"ilBookingProcessWithScheduleGUI",
"week");
173 $mode_control = $this->gui->ui()->factory()->viewControl()->mode([
174 $this->
lng->txt(
"book_list") => $list_link,
175 $this->
lng->txt(
"book_week") => $week_link
176 ], $this->
lng->txt(
"book_view"))->withActive($this->
lng->txt(
"book_week"));
177 $bar->addComponent($mode_control);
179 $list_gui = new \ILIAS\BookingManager\BookingProcess\ObjectSelectionListGUI(
180 $this->pool->getId(),
181 $this->
ctrl->getFormAction($this,
"selectObjects")
188 $this->log->debug(
"selectObjects");
189 $obj_ids = $this->book_request->getObjectIds();
190 $this->object_selection->setSelectedObjects($obj_ids);
191 $this->
ctrl->redirect($this,
"week");
207 $this->log->debug(
"Step 1, book");
210 $this->tabs_gui->clearTargets();
211 $this->tabs_gui->setBackTarget($this->
lng->txt(
'book_back_to_list'), $this->
ctrl->getLinkTarget($this,
'back'));
213 $this->util_gui->setHelpId(
"book");
217 $this->
lng->loadLanguageModule(
"dateplaner");
218 $this->
ctrl->setParameter($this,
'object_id', $obj->getId());
221 if ($this->user_id_to_book !== $this->user_id_assigner) {
222 $this->
ctrl->setParameter($this,
'bkusr', $this->user_id_to_book);
227 $week_gui = new \ILIAS\BookingManager\BookingProcess\WeekGUI(
231 $this->pool->getId(),
233 $user_settings->getWeekStart()
241 $this->util_gui->assignParticipants($this->book_obj_id);
246 $this->log->debug(
"showNumberForm");
248 $from = $this->book_request->getSlotFrom();
249 $to = $this->book_request->getSlotTo() - 1;
250 $this->tabs_gui->clearTargets();
251 $this->tabs_gui->setBackTarget(
252 $this->
lng->txt(
'book_back_to_list'),
253 $this->
ctrl->getLinkTarget($this,
'back')
274 ): \
ILIAS\Repository\Form\FormAdapterGUI {
275 $counter = $this->reservation->getAvailableNr($this->book_request->getObjectId(), $from, $to);
280 $this->
ctrl->setParameter($this,
"slot", $from .
"_" . $to);
281 $form = $this->gui->form([self::class],
"processNumberForm")
285 $this->
lng->txt(
"book_confirm_booking_schedule_number_of_objects"),
286 $this->
lng->txt(
"book_confirm_booking_schedule_number_of_objects_info")
288 ->number(
"nr", $period,
"", 1, 1, $counter)
289 ->radio(
"recurrence", $this->
lng->txt(
"book_recurrence"),
"",
"0")
290 ->radioOption(
"0", $this->
lng->txt(
"book_no_recurrence"))
291 ->radioOption(
"1", $this->
lng->txt(
"book_book_recurrence"));
292 if ($this->pool->usesMessages()) {
293 $form = $form->textarea(
295 $this->
lng->txt(
"book_message"),
296 $this->
lng->txt(
"book_message_info")
304 $this->log->debug(
"processNumberForm");
306 if ($this->book_request->getBookedUser() > 0) {
307 $this->user_id_to_book = $this->book_request->getBookedUser();
309 $slot = $this->book_request->getSlot();
310 $from = $this->book_request->getSlotFrom();
311 $to = $this->book_request->getSlotTo();
312 $obj_id = $this->book_request->getObjectId();
314 if ($this->user_id_assigner !== $this->user_id_to_book) {
315 $this->
ctrl->setParameterByClass(self::class,
"bkusr", $this->user_id_to_book);
317 $this->
ctrl->setParameterByClass(self::class,
"slot", $slot);
321 if (!$form->isValid()) {
327 $message = $this->pool->usesMessages()
328 ? $form->getData(
"message")
332 $recurrence = $form->getData(
"recurrence");
333 if ($recurrence ===
"1") {
334 if ($this->pool->usesMessages()) {
335 $this->
ctrl->setParameterByClass(
341 $this->
ctrl->setParameterByClass(self::class,
"object_id", $this->book_request->getObjectId());
342 $this->
ctrl->setParameterByClass(self::class,
"nr", (
int) $form->getData(
"nr"));
350 $form->getData(
"nr"),
358 $this->
lng->loadLanguageModule(
"dateplaner");
360 $form = $this->gui->form([self::class],
"checkAvailability")
363 $this->
lng->txt(
"book_confirm_booking_schedule_number_of_objects"),
364 $this->
lng->txt(
"book_confirm_booking_schedule_number_of_objects_info")
366 ->
switch(
"recurrence", $this->
lng->txt(
"cal_recurrences"),
"",
"1")
367 ->group(
"1", $this->
lng->txt(
"cal_weekly"))
368 ->date(
"until1", $this->
lng->txt(
"cal_repeat_until"),
"", $today)
369 ->group(
"2", $this->
lng->txt(
"r_14"))
370 ->date(
"until2", $this->
lng->txt(
"cal_repeat_until"),
"", $today)
371 ->group(
"4", $this->
lng->txt(
"r_4_weeks"))
372 ->date(
"until4", $this->
lng->txt(
"cal_repeat_until"),
"", $today)
378 bool $incl_recurrence =
true,
382 $this->log->debug(
"checkAvailability");
383 $obj_id = $this->book_request->getObjectId();
384 $from = $this->book_request->getSlotFrom();
385 $to = $this->book_request->getSlotTo();
387 $nr = $this->book_request->getNr();
389 if (
$message ===
"" && $this->pool->usesMessages()) {
390 $message = $this->book_request->getMessage();
394 if ($incl_recurrence) {
397 if (!$form->isValid()) {
403 $recurrence = (
int) $form->getData(
"recurrence");
404 $until = $form->getData(
"until" . $recurrence);
408 $this->
ctrl->saveParameter($this, [
"object_id",
"slot",
"nr"]);
409 if ($this->pool->usesMessages()) {
410 $this->
ctrl->setParameter(
416 $this->
ctrl->setParameter($this,
"recurrence", $recurrence);
417 $this->
ctrl->setParameter($this,
"until", $until_ts);
420 $this->book_request->getSlot(),
426 if ($incl_recurrence) {
428 $missing = $this->process->getRecurrenceMissingAvailability(
438 if (count($missing) > 0) {
443 $this->
lng->txt(
"book_book_available"),
444 $book_available_target,
450 $this->gui->send(
"<script>window.location.href = '" . $book_available_target .
"';</script>");
455 $f = $this->gui->ui()->factory();
456 $box =
$f->messageBox()->failure($this->
lng->txt(
"book_missing_availability"));
457 $items = array_map(
function ($i) {
460 return $from .
" - " . $to .
" : " . str_replace(
"$1", $i[
"missing"], $this->
lng->txt(
"book_missing_items"));
463 $list =
$f->listing()->unordered($items);
464 return $this->gui->ui()->renderer()->render([$box, $list]);
469 $this->log->debug(
"bookAvailableItems");
470 $obj_id = $this->book_request->getObjectId();
471 $from = $this->book_request->getSlotFrom();
472 $to = $this->book_request->getSlotTo();
473 $nr = $this->book_request->getNr();
474 $message = $this->pool->usesMessages()
475 ? $this->book_request->getMessage()
477 if (is_null($recurrence)) {
478 $recurrence = (
int) $this->book_request->getRecurrence();
480 if (is_null($until)) {
481 if ($this->book_request->getUntil() > 0) {
486 $booked = $this->process->bookAvailableObjects(
488 $this->user_id_to_book,
489 $this->user_id_assigner,
490 $this->context_obj_id,
498 if (count($booked) > 0) {
499 $this->util_gui->handleBookingSuccess($obj_id,
"displayPostInfo", $booked);
501 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'book_reservation_failed'),
true);
502 $this->util_gui->back();
513 $this->
ctrl->setParameter($this,
"obj_id", $obj_id);
514 $this->
ctrl->setParameter($this,
"slot", $slot);
515 $this->
ctrl->setParameter($this,
"recurrence", $recurrence);
516 $this->
ctrl->setParameter($this,
"nr", $nr);
517 $this->
ctrl->setParameter($this,
"until", $until);
518 return $this->
ctrl->getLinkTarget($this,
"bookAvailableItems");
523 $this->util_gui->displayPostInfo(
525 $this->user_id_assigner,
532 $this->util_gui->deliverPostFile(
534 $this->user_id_assigner
540 $this->util_gui->back();
getBookAvailableTarget(int $obj_id, string $slot, int $recurrence, int $nr, int $until)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjBookingPool $pool, int $booking_object_id, string $seed="", int $context_obj_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCmd(string $fallback_command=null)
ILIAS BookingManager InternalRepoService $repo
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
bookAvailableItems(?int $recurrence=null, ?ilDateTime $until=null)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
checkAvailability(bool $incl_recurrence=true, int $nr=0, string $message="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByUserId(int $a_user_id)
ilGlobalTemplateInterface $tpl
book()
Triggered from object list week view for booking a single object / confirmation for.
ILIAS BookingManager BookingProcess BookingProcessManager $process
getNextClass($a_gui_class=null)
static http()
Fetches the global http state from ILIAS.
setContent(string $a_html)
Sets content for standard template.
ILIAS BookingManager StandardGUIRequest $book_request
ILIAS BookingManager BookingProcess ProcessUtilGUI $util_gui
ILIAS BookingManager Objects ObjectsManager $object_manager
ILIAS HTTP Services $http
ILIAS BookingManager Reservations ReservationManager $reservation
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
ILIAS BookingManager InternalGUIService $gui
setRightContent(string $a_html)
Sets content of right column.
ilBookingHelpAdapter $help
getMissingAvailabilityMessage(array $missing)
ILIAS BookingManager BookingProcess ObjectSelectionManager $object_selection
getNumberForm(int $from, int $to)
catch(ilCmiXapiException $e) send($response)
Booking process ui class.
week()
First step in booking process.