25 protected \ILIAS\BookingManager\BookingProcess\ProcessUtilGUI
$util_gui;
26 protected \ILIAS\BookingManager\Access\AccessManager
$access;
28 protected \ILIAS\DI\UIServices
$ui;
29 protected \ILIAS\BookingManager\InternalService
$service;
53 $this->tpl =
$DIC->ui()->mainTemplate();
55 $this->
ctrl = $DIC->ctrl();
57 $this->
lng = $DIC->language();
58 $this->
access = $DIC->bookingManager()->internal()->domain()->access();
59 $this->tabs_gui =
$DIC->tabs();
61 $this->
user = $DIC->user();
62 $this->book_request =
$DIC->bookingManager()
66 $this->service =
$DIC->bookingManager()->internal();
67 $this->
ui = $DIC->ui();
68 $this->
toolbar = $DIC->toolbar();
70 $this->book_obj_id = $this->book_request->getObjectId();
75 $this->booked_user = $this->book_request->getBookedUser();
76 if ($this->booked_user === 0) {
77 $this->booked_user =
$DIC->user()->getId();
80 $this->reservation_id = $this->book_request->getReservationId();
82 $this->
ctrl->saveParameter($this, [
"object_id",
"bkusr"]);
85 throw new ilException(
"Booking Object ID does not match Booking Pool.");
88 $this->raw_post_data =
$DIC->http()->request()->getParsedBody();
89 $this->util_gui =
$DIC->bookingManager()->internal()->gui()->process()->ProcessUtilGUI(
100 $mrsv = $this->book_request->getReservationIds();
101 if (count($mrsv) > 0) {
104 if ($this->reservation_id > 0) {
105 return array($this->reservation_id);
117 switch ($next_class) {
119 if (in_array($cmd, array(
"log",
"logDetails",
"changeStatusObject",
"rsvConfirmCancelUser",
"rsvCancelUser",
120 "applyLogFilter",
"resetLogFilter",
"rsvConfirmCancel",
"rsvCancel",
"back",
"rsvConfirmDelete",
"rsvDelete",
"confirmResetRun",
"resetRun",
"displayPostInfo",
"deliverPostFile",
"redirectMailToBooker"))) {
128 $this->
help->setHelpId($a_id);
134 public function log(): void
145 $show_all = $this->
access->canManageAllReservations($this->ref_id) || $this->pool->hasPublicLog();
148 if ($this->book_obj_id > 0) {
152 if ($this->book_request->getUserId() > 0) {
153 $filter[
'user_id'] = $this->book_request->getUserId();
164 $this->context_obj_id > 0 ? [$this->context_obj_id] :
null
172 $this->tabs_gui->clearTargets();
173 $this->tabs_gui->setBackTarget(
174 $this->
lng->txt(
"back"),
175 $this->ctrl->getLinkTarget($this,
"log")
187 $rsv_ids = $this->book_request->getReservationIds();
188 if (count($rsv_ids) === 0) {
189 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
193 if ($this->
access->canManageAllReservations($this->ref_id)) {
196 $this->book_request->getStatus()
200 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
201 $this->
ctrl->redirect($this,
'log');
207 $table->resetOffset();
208 $table->writeFilterToSession();
215 $table->resetOffset();
216 $table->resetFilter();
246 $conf->setFormAction($ilCtrl->getFormAction($this));
247 $conf->setHeaderText(
$lng->
txt(
'book_confirm_cancel'));
250 $conf->addItem(
'object_id',
$id, $type->getTitle());
251 $conf->setConfirm(
$lng->
txt(
'book_set_cancel'),
'rsvCancelUser');
252 $conf->setCancel(
$lng->
txt(
'cancel'),
'back');
274 if ($obj->getUserId() !==
$user_id) {
275 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'permission_denied'),
true);
282 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
'settings_saved'),
true);
289 protected function back(): void
291 $this->
ctrl->redirect($this,
"log");
305 if (count($ids) === 0) {
309 foreach ($ids as $idx =>
$id) {
310 if (!is_numeric(
$id)) {
311 [$obj_id,
$user_id, $from, $to] = explode(
"_",
$id);
313 $valid_ids = array();
315 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
317 if (array_key_exists($obj_id, $valid_ids) && $from > time() && ($this->
access->canManageAllReservations($this->ref_id) || (
int)
$user_id === $ilUser->getId())) {
319 if (!count($rsv_ids)) {
322 if (count($rsv_ids) > 1) {
323 $max[
$id] = count($rsv_ids);
324 $ids[$idx] = $rsv_ids;
327 $ids[$idx] = array_shift($rsv_ids);
335 if (!is_array($ids) || !count($ids)) {
336 $this->
ctrl->redirect($this,
'log');
340 if (count($max) && max($max) > 1) {
345 $this->tabs_gui->clearTargets();
346 $this->tabs_gui->setBackTarget(
348 $ilCtrl->getLinkTargetByClass(
"ilBookingReservationsGUI",
"")
354 $conf->setFormAction($ilCtrl->getFormAction($this,
'rsvCancel'));
355 $conf->setHeaderText(
$lng->
txt(
'book_confirm_cancel'));
356 $conf->setConfirm(
$lng->
txt(
'book_set_cancel'),
'rsvCancel');
357 $conf->setCancel(
$lng->
txt(
'cancel'),
'back');
359 foreach ($ids as
$id) {
363 $details = $obj->getTitle();
371 $conf->addItem(
'rsv_id[]',
$id, $details);
388 $this->tabs_gui->clearTargets();
389 $this->tabs_gui->setBackTarget(
391 $ilCtrl->getLinkTarget($this,
"log")
397 $this->tpl->setOnScreenMessage(
'question',
$lng->
txt(
"book_confirm_cancel"));
412 $form->setTitle($this->
lng->txt(
"book_confirm_cancel_aggregation"));
416 foreach ($a_ids as $idx => $ids) {
418 if (is_array($ids)) {
419 $first = array_shift($first);
431 if (is_array($ids)) {
432 $caption .=
" (" . count($ids) .
")";
436 $item->setRequired(
true);
437 $item->setMinValue(0);
439 $form->addItem($item);
441 if (is_array($ids)) {
442 $item->setMaxValue(count($ids));
444 foreach ($ids as
$id) {
446 $hidden->setValue(
$id);
447 $form->addItem($hidden);
450 $item->setMaxValue(1);
453 $hidden->setValue($ids);
454 $form->addItem($hidden);
457 if ($this->book_request->getCancelNr($idx)) {
458 $item->setValue($this->book_request->getCancelNr($idx));
462 $form->addCommandButton(
"rsvCancel", $this->
lng->txt(
"confirm"));
463 $form->addCommandButton(
"log", $this->
lng->txt(
"cancel"));
473 $ilUser = $this->user;
476 $ilCtrl = $this->ctrl;
479 $ids = $this->book_request->getReservationIds();
481 $rsv_aggr = $this->raw_post_data[
"rsv_aggr"] ??
null;
483 if (!is_null($rsv_aggr)) {
484 $form = $this->rsvConfirmCancelAggregationForm($rsv_aggr);
485 if (!$form->checkInput()) {
486 $this->tabs_gui->clearTargets();
487 $this->tabs_gui->setBackTarget(
489 $ilCtrl->getLinkTarget($this,
"log")
497 foreach ($rsv_aggr as $idx => $aggr_ids) {
498 $max = $this->book_request->getCancelNr($idx);
500 if (!is_array($aggr_ids)) {
503 $aggr_ids = array_slice($aggr_ids, 0, $max);
504 $ids = array_merge($ids, $aggr_ids);
512 foreach ($ids as
$id) {
516 if (!$this->
access->canManageReservationForUser($this->ref_id,
$res->getUserId())) {
517 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
518 $this->
ctrl->redirect($this,
'log');
526 $cal_entry_id =
$res->getCalendarEntry();
535 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
542 if (!$this->
access->canManageAllReservations($this->ref_id)) {
543 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
544 $this->
ctrl->redirect($this,
'log');
547 $ids = $this->getLogReservationIds();
548 if (count($ids) === 0) {
552 $this->tabs_gui->clearTargets();
553 $this->tabs_gui->setBackTarget(
554 $this->
lng->txt(
"back"),
555 $this->ctrl->getLinkTarget($this,
"log")
559 $conf->setFormAction($this->
ctrl->getFormAction($this,
'rsvDelete'));
560 $conf->setHeaderText($this->
lng->txt(
'book_confirm_delete'));
561 $conf->setConfirm($this->
lng->txt(
'book_set_delete'),
'rsvDelete');
562 $conf->setCancel($this->
lng->txt(
'cancel'),
'log');
565 foreach ($ids as $idx =>
$id) {
566 [$obj_id,
$user_id, $from, $to] = explode(
"_",
$id);
568 $rsv_id = $rsv_ids[0];
573 $details = sprintf($this->
lng->txt(
'X_reservations_of'), count($rsv_ids)) .
' ' . $obj->getTitle();
578 $conf->addItem(
'mrsv[]',
$id, $details);
581 foreach ($ids as $idx => $rsv_id) {
584 $details = sprintf($this->
lng->txt(
'X_reservations_of'), 1) .
' ' . $obj->getTitle();
585 $conf->addItem(
'mrsv[]', $rsv_id, $details);
588 $this->tpl->setContent($conf->getHTML());
594 $get =
$DIC->http()->request()->getParsedBody()[
'mrsv'];
596 foreach ($get as
$id) {
598 list($obj_id,
$user_id, $from, $to) = explode(
"_",
$id);
604 foreach ($rsv_ids as $rsv_id) {
607 if (!$this->
access->canManageAllReservations($this->ref_id) || $obj->getPoolId() !== $this->pool->getId()) {
608 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
609 $this->
ctrl->redirect($this,
'log');
612 $cal_entry_id =
$res->getCalendarEntry();
622 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'reservation_deleted'),
true);
623 $this->
ctrl->redirect($this,
'log');
628 if (!$this->
access->canManageAllReservations($this->ref_id)) {
632 $pref_manager = $this->service->domain()->preferences($this->pool);
633 if ($pref_manager->hasRun()) {
634 $this->
toolbar->addComponent($this->
ui->factory()->button()->standard(
635 $this->lng->txt(
"book_rerun_assignments"),
636 $this->ctrl->getLinkTarget($this,
"confirmResetRun")
644 if (!$this->
access->canManageAllReservations($this->ref_id)) {
647 $this->tabs_gui->activateTab(
"log");
648 $mess = $this->
ui->factory()->messageBox()->confirmation($this->
lng->txt(
"book_rerun_confirmation"))->withButtons(
650 $this->
ui->factory()->button()->standard(
651 $this->lng->txt(
"book_rerun_assignments"),
652 $this->ctrl->getLinkTarget($this,
"resetRun")
654 $this->ui->factory()->button()->standard(
655 $this->lng->txt(
"cancel"),
656 $this->ctrl->getLinkTarget($this,
"log")
660 $this->tpl->setContent(
661 $this->
ui->renderer()->render($mess)
667 if (!$this->
access->canManageAllReservations($this->ref_id)) {
671 && $this->access->canManageAllReservations($this->pool->getRefId())) {
672 $pref_manager = $this->service->domain()->preferences($this->pool);
673 $repo = $this->service->repo()->preferences();
674 $pref_manager->resetRun();
675 $pref_manager->storeBookings(
676 $repo->getPreferences($this->pool->getId())
679 $this->
ctrl->redirect($this,
"log");
684 $this->
ctrl->saveParameter($this,
"object_id");
685 $this->util_gui->displayPostInfo(
694 $this->util_gui->deliverPostFile(
702 if (!$this->
access->canManageAllReservations($this->ref_id)) {
703 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
704 $this->
ctrl->redirect($this,
'log');
707 $ids = $this->getLogReservationIds();
708 if (count($ids) === 0) {
714 foreach ($ids as $idx =>
$id) {
715 [$obj_id,
$user_id, $from, $to] = explode(
"_",
$id);
717 $rsv_id = $rsv_ids[0];
722 foreach ($ids as $idx => $rsv_id) {
727 $logins = implode(
",", $users);
729 $sig = chr(13) . chr(10) . chr(13) . chr(10) . chr(13) . chr(10);
730 $sig .= $this->
lng->txt(
'book_mail_permanent_link') .
": ";
731 $sig .= chr(13) . chr(10);
732 $sig .= ilLink::_getLink($this->book_request->getRefId());
733 $sig = rawurlencode(base64_encode($sig));
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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...
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
static lookupPoolId(int $object_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
static getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
static changeStatus(array $a_ids, int $a_status)
Batch update reservation status.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
rsvCancel()
(C2.b) Cancel reservations (coming from C2 or C2.a)
rsvConfirmCancelAggregationForm(array $a_ids)
Form being used in (C2.a)
rsvConfirmCancelAggregation(?array $a_ids=null)
(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2)
ilGlobalTemplateInterface $tpl
ILIAS BookingManager InternalService $service
rsvCancelUser()
(C1.a) Confirmed (C1)
back()
Back to reservation list.
ILIAS BookingManager StandardGUIRequest $book_request
rsvConfirmCancelUser()
(C1) Confirmation screen for canceling booking without schedule from booking objects screen or from p...
ILIAS BookingManager Access AccessManager $access
getLogReservationIds()
Reservations IDs as currently provided from.
changeStatusObject()
Change status of given reservations.
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.
ilBookingHelpAdapter $help
rsvConfirmCancel()
(C2) Confirmation screen for canceling booking from reservations screen (with and without schedule)
showRerunPreferenceAssignment()
__construct(ilObjBookingPool $pool, ilBookingHelpAdapter $help, int $context_obj_id=0)
ILIAS BookingManager BookingProcess ProcessUtilGUI $util_gui
Model for a calendar entry.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc
static setUseRelativeDates(bool $a_status)
set use relative dates
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
Base class for ILIAS Exception handling.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NO_SCHEDULE_PREFERENCES
static _lookupLogin(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirect(string $a_script)
setContent(string $a_html)
Sets content for standard template.