25 protected \ILIAS\BookingManager\Access\AccessManager
$access;
29 protected \ILIAS\BookingManager\Reservations\ReservationManager
$reservation;
30 protected \ILIAS\BookingManager\BookingProcess\ProcessUtilGUI
$util_gui;
31 protected \ILIAS\BookingManager\InternalRepoService
$repo;
32 protected \ILIAS\BookingManager\BookingProcess\BookingProcessManager
$process;
33 protected \ILIAS\HTTP\Services
$http;
34 protected \ILIAS\BookingManager\InternalGUIService
$gui;
61 $this->
ctrl = $DIC->ctrl();
62 $this->tpl =
$DIC[
"tpl"];
63 $this->
lng = $DIC->language();
64 $this->tabs_gui =
$DIC->tabs();
65 $this->
user = $DIC->user();
66 $this->
http = $DIC->http();
75 $internal_service =
$DIC->bookingManager()->internal();
76 $this->gui = $internal_service->gui();
77 $domain = $internal_service->domain();
78 $this->book_request = $this->gui->standardRequest();
79 $this->
help = $this->gui->bookingHelp(
$pool);
80 $this->log = $domain->log();
82 $this->repo = $internal_service->repo();
84 $this->object_manager = $domain->objects(
$pool->
getId());
85 $this->object_selection = $domain->objectSelection(
$pool->
getId());
87 $this->rsv_ids = $this->book_request->getReservationIdsFromString();
89 $this->raw_post_data =
$DIC->http()->request()->getParsedBody();
91 $this->user_id_assigner = $this->
user->getId();
92 if ($this->book_request->getBookedUser() > 0) {
93 $this->user_id_to_book = $this->book_request->getBookedUser();
97 $this->
ctrl->saveParameter($this, [
"bkusr",
"returnCmd"]);
98 $this->
ctrl->setParameter($this,
"seed", $this->seed);
100 $this->process =
$DIC->bookingManager()->internal()->domain()->process();
101 $this->reservation =
$DIC->bookingManager()->internal()->domain()->reservations();
102 $this->util_gui =
$DIC->bookingManager()->internal()->gui()->process()->ProcessUtilGUI(
106 $this->
access = $DIC->bookingManager()->internal()->domain()->access();
115 switch ($next_class) {
117 if (in_array($cmd, array(
"book",
"back",
"week",
118 "assignParticipants",
119 "bookMultipleParticipants",
120 "saveMultipleBookings",
125 "bookAvailableItems",
128 "redirectToParticipantsList"
137 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_permission"),
true);
151 $this->log->debug(
"Step 0, week");
156 $this->util_gui->setHelpId(
"week");
157 $this->
ctrl->setParameter($this,
'returnCmd',
"week");
159 if ($this->user_id_to_book !== $this->user_id_assigner) {
160 $this->
ctrl->setParameter($this,
'bkusr', $this->user_id_to_book);
164 $week_gui = new \ILIAS\BookingManager\BookingProcess\WeekGUI(
167 $this->object_selection->getSelectedObjects(),
168 $this->pool->getId(),
170 $user_settings->getWeekStart()
174 $bar = $this->gui->toolbar();
175 $list_link = $this->
ctrl->getLinkTargetByClass(
"ilObjBookingPoolGUI",
"render");
176 $week_link = $this->
ctrl->getLinkTargetByClass(
"ilBookingProcessWithScheduleGUI",
"week");
177 $mode_control = $this->gui->ui()->factory()->viewControl()->mode([
178 $this->
lng->txt(
"book_list") => $list_link,
179 $this->lng->txt(
"book_week") => $week_link
180 ], $this->lng->txt(
"book_view"))->withActive($this->
lng->txt(
"book_week"));
181 $bar->addComponent($mode_control);
183 $list_gui = new \ILIAS\BookingManager\BookingProcess\ObjectSelectionListGUI(
184 $this->pool->getId(),
185 $this->ctrl->getFormAction($this,
"selectObjects")
192 $this->log->debug(
"selectObjects");
193 $obj_ids = $this->book_request->getObjectIds();
194 $this->object_selection->setSelectedObjects($obj_ids);
195 $this->
ctrl->redirect($this,
"week");
211 $this->log->debug(
"Step 1, book");
214 $this->tabs_gui->clearTargets();
215 $this->tabs_gui->setBackTarget($this->
lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'back'));
217 $this->util_gui->setHelpId(
"book");
221 $this->
lng->loadLanguageModule(
"dateplaner");
222 $this->
ctrl->setParameter($this,
'object_id', $obj->getId());
223 $this->
ctrl->setParameter($this,
'returnCmd',
'week');
225 if ($this->user_id_to_book !== $this->user_id_assigner) {
226 $this->
ctrl->setParameter($this,
'bkusr', $this->user_id_to_book);
229 if (!$this->
access->canManageReservationForUser($this->book_request->getRefId(), $this->user_id_to_book)) {
235 $week_gui = new \ILIAS\BookingManager\BookingProcess\WeekGUI(
239 $this->pool->getId(),
241 $user_settings->getWeekStart()
249 $this->util_gui->assignParticipants($this->book_obj_id);
254 $this->log->debug(
"showNumberForm");
256 $from = $this->book_request->getSlotFrom();
257 $to = $this->book_request->getSlotTo() - 1;
258 $this->tabs_gui->clearTargets();
259 $this->tabs_gui->setBackTarget(
260 $this->
lng->txt(
'book_back_to_list'),
261 $this->ctrl->getLinkTarget($this,
'back')
282 ): \
ILIAS\Repository\Form\FormAdapterGUI {
283 $counter = $this->reservation->getAvailableNr($this->book_request->getObjectId(), $from, $to);
288 $this->
ctrl->setParameter($this,
"slot", $from .
"_" . $to);
289 $form = $this->gui->form([self::class],
"processNumberForm")
293 $this->
lng->txt(
"book_confirm_booking_schedule_number_of_objects"),
294 $this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info")
296 ->number(
"nr", $period,
"", 1, 1,
$counter)
297 ->radio(
"recurrence", $this->
lng->txt(
"book_recurrence"),
"",
"0")
298 ->radioOption(
"0", $this->
lng->txt(
"book_no_recurrence"))
299 ->radioOption(
"1", $this->
lng->txt(
"book_book_recurrence"))
300 ->hidden(
"origin_cmd", $this->book_request->getOriginCmd());
301 if ($this->pool->usesMessages()) {
302 $form = $form->textarea(
304 $this->
lng->txt(
"book_message"),
305 $this->lng->txt(
"book_message_info")
313 $this->log->debug(
"processNumberForm");
315 if ($this->book_request->getBookedUser() > 0) {
316 $this->user_id_to_book = $this->book_request->getBookedUser();
318 $slot = $this->book_request->getSlot();
319 $from = $this->book_request->getSlotFrom();
320 $to = $this->book_request->getSlotTo();
321 $obj_id = $this->book_request->getObjectId();
323 if ($this->user_id_assigner !== $this->user_id_to_book) {
324 $this->
ctrl->setParameterByClass(self::class,
"bkusr", $this->user_id_to_book);
326 $this->
ctrl->setParameterByClass(self::class,
"slot", $slot);
329 $form = $this->getNumberForm($from, $to);
330 if (!$form->isValid()) {
331 $this->gui->modal($this->getBookgingObjectTitle())
336 $origin_cmd = $form->getData(
"origin_cmd");
337 if (is_string($origin_cmd) && $origin_cmd !==
"") {
338 $this->origin_cmd = $origin_cmd;
341 $message = $this->pool->usesMessages()
342 ? $form->getData(
"message")
346 $recurrence = $form->getData(
"recurrence");
347 if ($recurrence ===
"1") {
348 if ($this->pool->usesMessages()) {
349 $this->
ctrl->setParameterByClass(
352 rawurlencode($message)
355 $this->
ctrl->setParameterByClass(self::class,
"object_id", $this->book_request->getObjectId());
356 $this->
ctrl->setParameterByClass(self::class,
"nr", (
int) $form->getData(
"nr"));
357 $form = $this->getRecurrenceForm();
358 $this->gui->modal($this->getBookgingObjectTitle())
362 $this->checkAvailability(
364 $form->getData(
"nr"),
372 $this->
lng->loadLanguageModule(
"dateplaner");
374 $form = $this->gui->form([self::class],
"checkAvailability")
377 $this->
lng->txt(
"book_confirm_booking_schedule_number_of_objects"),
378 $this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info")
380 ->switch(
"recurrence", $this->
lng->txt(
"cal_recurrences"),
"",
"1")
381 ->group(
"1", $this->
lng->txt(
"cal_weekly"))
382 ->date(
"until1", $this->
lng->txt(
"cal_repeat_until"),
"", $today)
383 ->group(
"2", $this->
lng->txt(
"r_14"))
384 ->date(
"until2", $this->
lng->txt(
"cal_repeat_until"),
"", $today)
385 ->group(
"4", $this->
lng->txt(
"r_4_weeks"))
386 ->date(
"until4", $this->
lng->txt(
"cal_repeat_until"),
"", $today)
392 bool $incl_recurrence =
true,
396 $this->log->debug(
"checkAvailability");
397 $obj_id = $this->book_request->getObjectId();
398 $from = $this->book_request->getSlotFrom();
399 $to = $this->book_request->getSlotTo();
401 $nr = $this->book_request->getNr();
403 if ($message ===
"" && $this->pool->usesMessages()) {
404 $message = $this->book_request->getMessage();
408 if ($incl_recurrence) {
409 $form = $this->getRecurrenceForm();
411 if (!$form->isValid()) {
412 $this->gui->modal($this->getBookgingObjectTitle())
417 $recurrence = (
int) $form->getData(
"recurrence");
418 $until = $form->getData(
"until" . $recurrence);
422 $this->
ctrl->saveParameter($this, [
"object_id",
"slot",
"nr"]);
423 if ($this->pool->usesMessages()) {
424 $this->
ctrl->setParameter(
427 rawurlencode($message)
430 $this->
ctrl->setParameter($this,
"recurrence", $recurrence);
431 $this->
ctrl->setParameter($this,
"until", $until_ts);
432 $book_available_target = $this->getBookAvailableTarget(
434 $this->book_request->getSlot(),
440 if ($incl_recurrence) {
442 $missing = $this->process->getRecurrenceMissingAvailability(
452 if (count($missing) > 0) {
453 $html = $this->getMissingAvailabilityMessage($missing);
454 $this->gui->modal($this->getBookgingObjectTitle())
457 $this->
lng->txt(
"book_book_available"),
458 $book_available_target,
464 $this->gui->send(
"<script>window.location.href = '" . $book_available_target .
"';</script>");
469 $f = $this->gui->ui()->factory();
470 $box =
$f->messageBox()->failure($this->
lng->txt(
"book_missing_availability"));
471 $items = array_map(
function ($i) {
474 return $from .
" - " . $to .
" : " . str_replace(
"$1", $i[
"missing"], $this->
lng->txt(
"book_missing_items"));
477 $list =
$f->listing()->unordered($items);
478 return $this->gui->ui()->renderer()->render([$box, $list]);
483 if (!$this->
access->canManageReservationForUser($this->pool->getRefId(), $this->user_id_to_book)) {
484 $this->showNoPermission();
487 $this->log->debug(
"bookAvailableItems");
488 $obj_id = $this->book_request->getObjectId();
489 $from = $this->book_request->getSlotFrom();
490 $to = $this->book_request->getSlotTo();
491 $nr = $this->book_request->getNr();
492 $message = $this->pool->usesMessages()
493 ? $this->book_request->getMessage()
495 if (is_null($recurrence)) {
496 $recurrence = (
int) $this->book_request->getRecurrence();
498 if (is_null($until)) {
499 if ($this->book_request->getUntil() > 0) {
504 $booked = $this->process->bookAvailableObjects(
506 $this->user_id_to_book,
507 $this->user_id_assigner,
508 $this->context_obj_id,
516 if (count($booked) > 0) {
517 $this->util_gui->handleBookingSuccess($obj_id,
"displayPostInfo", $booked);
519 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'book_reservation_failed'),
true);
520 $this->util_gui->back();
531 $this->
ctrl->setParameter($this,
"obj_id", $obj_id);
532 $this->
ctrl->setParameter($this,
"slot", $slot);
533 $this->
ctrl->setParameter($this,
"recurrence", $recurrence);
534 $this->
ctrl->setParameter($this,
"nr", $nr);
535 $this->
ctrl->setParameter($this,
"until", $until);
536 if (is_string($this->origin_cmd) && $this->origin_cmd !==
"") {
537 $this->
ctrl->setParameter($this,
"origin_cmd", $this->origin_cmd);
539 return $this->
ctrl->getLinkTarget($this,
"bookAvailableItems");
544 $this->util_gui->displayPostInfo(
546 $this->user_id_assigner,
553 $this->util_gui->deliverPostFile(
555 $this->user_id_assigner
561 $this->util_gui->back();
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS BookingManager StandardGUIRequest $book_request
ilBookingHelpAdapter $help
ILIAS BookingManager Access AccessManager $access
week()
First step in booking process.
ILIAS HTTP Services $http
ILIAS BookingManager InternalGUIService $gui
bookAvailableItems(?int $recurrence=null, ?ilDateTime $until=null)
ILIAS BookingManager BookingProcess BookingProcessManager $process
__construct(ilObjBookingPool $pool, int $booking_object_id, string $seed="", int $context_obj_id=0)
checkAvailability(bool $incl_recurrence=true, int $nr=0, string $message="")
getNumberForm(int $from, int $to)
getMissingAvailabilityMessage(array $missing)
ILIAS BookingManager InternalRepoService $repo
ILIAS BookingManager Objects ObjectsManager $object_manager
book()
Triggered from object list week view for booking a single object / confirmation for.
ILIAS BookingManager BookingProcess ObjectSelectionManager $object_selection
ilGlobalTemplateInterface $tpl
ILIAS BookingManager BookingProcess ProcessUtilGUI $util_gui
ILIAS BookingManager Reservations ReservationManager $reservation
getBookAvailableTarget(int $obj_id, string $slot, int $recurrence, int $nr, int $until)
static _getInstanceByUserId(int $a_user_id)
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRightContent(string $a_html)
Sets content of right column.
setContent(string $a_html)
Sets content for standard template.
static http()
Fetches the global http state from ILIAS.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.