25 protected \ILIAS\BookingManager\BookingProcess\ProcessUtilGUI
$util_gui;
27 protected \ILIAS\DI\UIServices
$ui;
28 protected \ILIAS\BookingManager\InternalService
$service;
49 int $context_obj_id = 0
53 $this->tpl = $DIC->ui()->mainTemplate();
55 $this->
ctrl = $DIC->ctrl();
57 $this->
lng = $DIC->language();
58 $this->
access = $DIC->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);
115 $cmd = $ctrl->
getCmd(
"log");
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
146 ?
string $reservation_id = null
151 if ($this->book_obj_id > 0) {
155 if ($this->book_request->getUserId() > 0) {
156 $filter[
"user_id"] = $this->book_request->getUserId();
158 $context_filter = ($this->context_obj_id > 0)
159 ? [$this->context_obj_id]
178 $this->tabs_gui->clearTargets();
179 $this->tabs_gui->setBackTarget(
180 $this->
lng->txt(
"back"),
181 $this->
ctrl->getLinkTarget($this,
"log")
193 $rsv_ids = $this->book_request->getReservationIds();
194 if (count($rsv_ids) === 0) {
195 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
202 $this->book_request->getStatus()
206 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
207 $this->
ctrl->redirect($this,
'log');
213 $table->resetOffset();
214 $table->writeFilterToSession();
221 $table->resetOffset();
222 $table->resetFilter();
228 return $this->
access->checkAccess($a_perm,
"", $this->ref_id);
257 $conf->setFormAction($ilCtrl->getFormAction($this));
258 $conf->setHeaderText($lng->
txt(
'book_confirm_cancel'));
261 $conf->addItem(
'object_id',
$id, $type->getTitle());
262 $conf->setConfirm($lng->
txt(
'book_set_cancel'),
'rsvCancelUser');
263 $conf->setCancel($lng->
txt(
'cancel'),
'back');
278 if (!
$id || !$user_id) {
285 if ($obj->getUserId() !== $user_id) {
286 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
'permission_denied'),
true);
293 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'settings_saved'),
true);
300 protected function back(): void
302 $this->
ctrl->redirect($this,
"log");
316 if (count($ids) === 0) {
320 foreach ($ids as $idx =>
$id) {
321 if (!is_numeric(
$id)) {
322 [$obj_id, $user_id, $from, $to] = explode(
"_",
$id);
324 $valid_ids = array();
326 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
328 if (array_key_exists($obj_id, $valid_ids) && $from > time() && ($this->
checkPermissionBool(
"write") || (
int) $user_id === $ilUser->getId())) {
330 if (!count($rsv_ids)) {
333 if (count($rsv_ids) > 1) {
334 $max[
$id] = count($rsv_ids);
335 $ids[$idx] = $rsv_ids;
338 $ids[$idx] = array_shift($rsv_ids);
346 if (!is_array($ids) || !count($ids)) {
347 $this->
ctrl->redirect($this,
'log');
351 if (count($max) && max($max) > 1) {
356 $this->tabs_gui->clearTargets();
357 $this->tabs_gui->setBackTarget(
359 $ilCtrl->getLinkTargetByClass(
"ilBookingReservationsGUI",
"")
365 $conf->setFormAction($ilCtrl->getFormAction($this,
'rsvCancel'));
366 $conf->setHeaderText($lng->
txt(
'book_confirm_cancel'));
367 $conf->setConfirm($lng->
txt(
'book_set_cancel'),
'rsvCancel');
368 $conf->setCancel($lng->
txt(
'cancel'),
'back');
370 foreach ($ids as
$id) {
382 $conf->addItem(
'rsv_id[]', $id, $details);
399 $this->tabs_gui->clearTargets();
400 $this->tabs_gui->setBackTarget(
402 $ilCtrl->getLinkTarget($this,
"log")
408 $this->tpl->setOnScreenMessage(
'question', $lng->
txt(
"book_confirm_cancel"));
422 $form->setFormAction($this->
ctrl->getFormAction($this,
"rsvCancel"));
423 $form->setTitle($this->
lng->txt(
"book_confirm_cancel_aggregation"));
427 foreach ($a_ids as $idx => $ids) {
429 if (is_array($ids)) {
430 $first = array_shift($first);
442 if (is_array($ids)) {
443 $caption .=
" (" . count($ids) .
")";
447 $item->setRequired(
true);
448 $item->setMinValue(0);
450 $form->addItem($item);
452 if (is_array($ids)) {
453 $item->setMaxValue(count($ids));
455 foreach ($ids as
$id) {
457 $hidden->setValue($id);
458 $form->addItem($hidden);
461 $item->setMaxValue(1);
464 $hidden->setValue($ids);
465 $form->addItem($hidden);
468 if ($this->book_request->getCancelNr($idx)) {
469 $item->setValue($this->book_request->getCancelNr($idx));
473 $form->addCommandButton(
"rsvCancel", $this->
lng->txt(
"confirm"));
474 $form->addCommandButton(
"log", $this->
lng->txt(
"cancel"));
490 $ids = $this->book_request->getReservationIds();
492 $rsv_aggr = $this->raw_post_data[
"rsv_aggr"] ?? null;
494 if (!is_null($rsv_aggr)) {
496 if (!$form->checkInput()) {
497 $this->tabs_gui->clearTargets();
498 $this->tabs_gui->setBackTarget(
500 $ilCtrl->getLinkTarget($this,
"log")
508 foreach ($rsv_aggr as $idx => $aggr_ids) {
509 $max = $this->book_request->getCancelNr($idx);
511 if (!is_array($aggr_ids)) {
514 $aggr_ids = array_slice($aggr_ids, 0, $max);
515 $ids = array_merge($ids, $aggr_ids);
523 foreach ($ids as
$id) {
529 if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
530 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
531 $this->
ctrl->redirect($this,
'log');
539 $cal_entry_id =
$res->getCalendarEntry();
548 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
556 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
557 $this->
ctrl->redirect($this,
'log');
561 if (count($ids) === 0) {
565 $this->tabs_gui->clearTargets();
566 $this->tabs_gui->setBackTarget(
567 $this->
lng->txt(
"back"),
568 $this->
ctrl->getLinkTarget($this,
"log")
572 $conf->setFormAction($this->
ctrl->getFormAction($this,
'rsvDelete'));
573 $conf->setHeaderText($this->
lng->txt(
'book_confirm_delete'));
574 $conf->setConfirm($this->
lng->txt(
'book_set_delete'),
'rsvDelete');
575 $conf->setCancel($this->
lng->txt(
'cancel'),
'log');
578 foreach ($ids as $idx =>
$id) {
579 [$obj_id, $user_id, $from, $to] = explode(
"_",
$id);
581 $rsv_id = $rsv_ids[0];
586 $details = sprintf($this->
lng->txt(
'X_reservations_of'), count($rsv_ids)) .
' ' . $obj->getTitle();
591 $conf->addItem(
'mrsv[]',
$id, $details);
594 foreach ($ids as $idx => $rsv_id) {
597 $details = sprintf($this->
lng->txt(
'X_reservations_of'), 1) .
' ' . $obj->getTitle();
598 $conf->addItem(
'mrsv[]', $rsv_id, $details);
601 $this->tpl->setContent($conf->getHTML());
607 $get = $DIC->http()->request()->getParsedBody()[
'mrsv'];
609 foreach ($get as
$id) {
611 list($obj_id, $user_id, $from, $to) = explode(
"_", $id);
617 foreach ($rsv_ids as $rsv_id) {
621 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
622 $this->
ctrl->redirect($this,
'log');
625 $cal_entry_id =
$res->getCalendarEntry();
635 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'reservation_deleted'),
true);
636 $this->
ctrl->redirect($this,
'log');
645 $pref_manager = $this->service->domain()->preferences($this->pool);
646 if ($pref_manager->hasRun()) {
647 $this->
toolbar->addComponent($this->
ui->factory()->button()->standard(
648 $this->
lng->txt(
"book_rerun_assignments"),
649 $this->
ctrl->getLinkTarget($this,
"confirmResetRun")
660 $this->tabs_gui->activateTab(
"log");
661 $mess = $this->
ui->factory()->messageBox()->confirmation($this->
lng->txt(
"book_rerun_confirmation"))->withButtons(
663 $this->
ui->factory()->button()->standard(
664 $this->
lng->txt(
"book_rerun_assignments"),
665 $this->
ctrl->getLinkTarget($this,
"resetRun")
667 $this->
ui->factory()->button()->standard(
668 $this->
lng->txt(
"cancel"),
669 $this->
ctrl->getLinkTarget($this,
"log")
673 $this->tpl->setContent(
674 $this->
ui->renderer()->render($mess)
684 && $this->
access->checkAccess(
"write",
"", $this->pool->getRefId())) {
685 $pref_manager = $this->service->domain()->preferences($this->pool);
686 $repo = $this->service->repo()->preferences();
687 $pref_manager->resetRun();
688 $pref_manager->storeBookings(
689 $repo->getPreferences($this->pool->getId())
692 $this->
ctrl->redirect($this,
"log");
697 $this->
ctrl->saveParameter($this,
"object_id");
698 $this->util_gui->displayPostInfo(
707 $this->util_gui->deliverPostFile(
716 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
717 $this->
ctrl->redirect($this,
'log');
721 if (count($ids) === 0) {
727 foreach ($ids as $idx =>
$id) {
728 [$obj_id, $user_id, $from, $to] = explode(
"_",
$id);
730 $rsv_id = $rsv_ids[0];
735 foreach ($ids as $idx => $rsv_id) {
740 $logins = implode(
",", $users);
742 $sig = chr(13) . chr(10) . chr(13) . chr(10) . chr(13) . chr(10);
743 $sig .= $this->
lng->txt(
'book_mail_permanent_link') .
": ";
744 $sig .= chr(13) . chr(10);
745 $sig .= ilLink::_getLink($this->book_request->getRefId());
746 $sig = rawurlencode(base64_encode($sig));
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 changeStatus(array $a_ids, int $a_status)
Batch update reservation status.
rsvCancelUser()
(C1.a) Confirmed (C1)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
getCmd(string $fallback_command=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS BookingManager InternalService $service
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
back()
Back to reservation list.
rsvConfirmCancel()
(C2) Confirmation screen for canceling booking from reservations screen (with and without schedule) ...
ilBookingHelpAdapter $help
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.
getLogReservationIds()
Reservations IDs as currently provided from.
showRerunPreferenceAssignment()
getNextClass($a_gui_class=null)
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
rsvConfirmCancelUser()
(C1) Confirmation screen for canceling booking without schedule from booking objects screen or from p...
static getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
__construct(ilObjBookingPool $pool, ilBookingHelpAdapter $help, int $context_obj_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirect(string $a_script)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
ILIAS BookingManager BookingProcess ProcessUtilGUI $util_gui
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
changeStatusObject()
Change status of given reservations.
ILIAS BookingManager StandardGUIRequest $book_request
rsvConfirmCancelAggregationForm(array $a_ids)
Form being used in (C2.a)
static lookupPoolId(int $object_id)
const TYPE_NO_SCHEDULE_PREFERENCES
static setUseRelativeDates(bool $a_status)
set use relative dates
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
checkPermissionBool(string $a_perm)
rsvCancel()
(C2.b) Cancel reservations (coming from C2 or C2.a)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
rsvConfirmCancelAggregation(array $a_ids=null)
(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2) ...
static _lookupLogin(int $a_user_id)