26 protected \ILIAS\DI\UIServices
$ui;
27 protected \ILIAS\BookingManager\InternalService
$service;
52 $this->tpl =
$DIC->ui()->mainTemplate();
54 $this->
ctrl = $DIC->ctrl();
56 $this->
lng = $DIC->language();
57 $this->
access = $DIC->access();
58 $this->tabs_gui =
$DIC->tabs();
60 $this->
user = $DIC->user();
61 $this->book_request =
$DIC->bookingManager()
65 $this->service =
$DIC->bookingManager()->internal();
66 $this->
ui = $DIC->ui();
67 $this->
toolbar = $DIC->toolbar();
69 $this->book_obj_id = $this->book_request->getObjectId();
74 $this->booked_user = $this->book_request->getBookedUser();
75 if ($this->booked_user === 0) {
76 $this->booked_user =
$DIC->user()->getId();
79 $this->reservation_id = $this->book_request->getReservationId();
81 $this->
ctrl->saveParameter($this, [
"object_id",
"bkusr"]);
84 throw new ilException(
"Booking Object ID does not match Booking Pool.");
87 $this->raw_post_data =
$DIC->http()->request()->getParsedBody();
95 $mrsv = $this->book_request->getReservationIds();
96 if (count($mrsv) > 0) {
99 if ($this->reservation_id > 0) {
100 return array($this->reservation_id);
112 switch ($next_class) {
114 if (in_array($cmd, array(
"log",
"logDetails",
"changeStatusObject",
"rsvConfirmCancelUser",
"rsvCancelUser",
115 "applyLogFilter",
"resetLogFilter",
"rsvConfirmCancel",
"rsvCancel",
"back",
"rsvConfirmDelete",
"rsvDelete",
"confirmResetRun",
"resetRun"))) {
123 $this->
help->setHelpId($a_id);
129 public function log(): void
146 if ($this->book_obj_id > 0) {
150 if ($this->book_request->getUserId() > 0) {
151 $filter[
"user_id"] = $this->book_request->getUserId();
153 $context_filter = ($this->context_obj_id > 0)
154 ? [$this->context_obj_id]
161 $this->pool->getId(),
174 $this->tabs_gui->clearTargets();
175 $this->tabs_gui->setBackTarget(
176 $this->
lng->txt(
"back"),
177 $this->ctrl->getLinkTarget($this,
"log")
180 $table = $this->getReservationsTable($this->reservation_id);
181 $tpl->setContent($table->getHTML());
189 $rsv_ids = $this->book_request->getReservationIds();
190 if (count($rsv_ids) === 0) {
191 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
195 if ($this->checkPermissionBool(
'write')) {
198 $this->book_request->getStatus()
202 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
203 $this->
ctrl->redirect($this,
'log');
208 $table = $this->getReservationsTable();
209 $table->resetOffset();
210 $table->writeFilterToSession();
216 $table = $this->getReservationsTable();
217 $table->resetOffset();
218 $table->resetFilter();
224 return $this->
access->checkAccess($a_perm,
"", $this->ref_id);
242 $ilCtrl = $this->ctrl;
245 $id = $this->book_obj_id;
250 $this->setHelpId(
"cancel_booking");
253 $conf->setFormAction($ilCtrl->getFormAction($this));
254 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
257 $conf->addItem(
'object_id',
$id,
$type->getTitle());
258 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancelUser');
259 $conf->setCancel(
$lng->txt(
'cancel'),
'back');
261 $tpl->setContent($conf->getHTML());
271 $id = $this->book_obj_id;
272 $user_id = $this->booked_user;
274 if (!
$id || !$user_id) {
281 if ($obj->getUserId() !== $user_id) {
282 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
'permission_denied'),
true);
289 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
'settings_saved'),
true);
296 protected function back(): void
298 $this->
ctrl->redirect($this,
"log");
306 $ilCtrl = $this->ctrl;
311 $ids = $this->getLogReservationIds();
312 if (count($ids) === 0) {
316 foreach ($ids as $idx =>
$id) {
317 if (!is_numeric(
$id)) {
318 [$obj_id, $user_id, $from, $to] = explode(
"_",
$id);
320 $valid_ids = array();
322 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
324 if (array_key_exists($obj_id, $valid_ids) && $from > time() && ($this->checkPermissionBool(
"write") || (
int) $user_id ===
$ilUser->getId())) {
326 if (!count($rsv_ids)) {
329 if (count($rsv_ids) > 1) {
330 $max[
$id] = count($rsv_ids);
331 $ids[$idx] = $rsv_ids;
334 $ids[$idx] = array_shift($rsv_ids);
342 if (!is_array($ids) || !count($ids)) {
343 $this->
ctrl->redirect($this,
'log');
347 if (count($max) && max($max) > 1) {
348 $this->rsvConfirmCancelAggregation($ids);
352 $this->tabs_gui->clearTargets();
353 $this->tabs_gui->setBackTarget(
355 $ilCtrl->getLinkTargetByClass(
"ilBookingReservationsGUI",
"")
358 $this->setHelpId(
"cancel_booking");
361 $conf->setFormAction($ilCtrl->getFormAction($this,
'rsvCancel'));
362 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
363 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancel');
364 $conf->setCancel(
$lng->txt(
'cancel'),
'back');
366 foreach ($ids as
$id) {
381 $tpl->setContent($conf->getHTML());
392 $ilCtrl = $this->ctrl;
395 $this->tabs_gui->clearTargets();
396 $this->tabs_gui->setBackTarget(
398 $ilCtrl->getLinkTarget($this,
"log")
401 $this->setHelpId(
"cancel_booking");
404 $this->tpl->setOnScreenMessage(
'question',
$lng->txt(
"book_confirm_cancel"));
406 $form = $this->rsvConfirmCancelAggregationForm($a_ids);
408 $tpl->setContent($form->getHTML());
419 $form->setTitle($this->
lng->txt(
"book_confirm_cancel_aggregation"));
423 foreach ($a_ids as $idx => $ids) {
425 if (is_array($ids)) {
426 $first = array_shift($first);
438 if (is_array($ids)) {
439 $caption .=
" (" . count($ids) .
")";
443 $item->setRequired(
true);
444 $item->setMinValue(0);
446 $form->addItem($item);
448 if (is_array($ids)) {
449 $item->setMaxValue(count($ids));
451 foreach ($ids as
$id) {
453 $hidden->setValue(
$id);
454 $form->addItem($hidden);
457 $item->setMaxValue(1);
460 $hidden->setValue($ids);
461 $form->addItem($hidden);
464 if ($this->book_request->getCancelNr($idx)) {
465 $item->setValue($this->book_request->getCancelNr($idx));
469 $form->addCommandButton(
"rsvCancel", $this->
lng->txt(
"confirm"));
470 $form->addCommandButton(
"log", $this->
lng->txt(
"cancel"));
483 $ilCtrl = $this->ctrl;
486 $ids = $this->book_request->getReservationIds();
488 $rsv_aggr = $this->raw_post_data[
"rsv_aggr"] ??
null;
490 if (!is_null($rsv_aggr)) {
491 $form = $this->rsvConfirmCancelAggregationForm($rsv_aggr);
492 if (!$form->checkInput()) {
493 $this->tabs_gui->clearTargets();
494 $this->tabs_gui->setBackTarget(
496 $ilCtrl->getLinkTarget($this,
"log")
499 $tpl->setContent($form->getHTML());
504 foreach ($rsv_aggr as $idx => $aggr_ids) {
505 $max = $this->book_request->getCancelNr($idx);
507 if (!is_array($aggr_ids)) {
510 $aggr_ids = array_slice($aggr_ids, 0, $max);
511 $ids = array_merge($ids, $aggr_ids);
519 foreach ($ids as
$id) {
523 $cancel_allowed_per_read = ($this->checkPermissionBool(
"read") && (
$res->getUserId() ===
$ilUser->getId()));
524 $cancel_allowed_per_write = ($this->checkPermissionBool(
"write"));
525 if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
526 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
527 $this->
ctrl->redirect($this,
'log');
535 $cal_entry_id =
$res->getCalendarEntry();
544 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
551 if (!$this->checkPermissionBool(
"write")) {
552 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
553 $this->
ctrl->redirect($this,
'log');
556 $ids = $this->getLogReservationIds();
557 if (count($ids) === 0) {
561 $this->tabs_gui->clearTargets();
562 $this->tabs_gui->setBackTarget(
563 $this->
lng->txt(
"back"),
564 $this->ctrl->getLinkTarget($this,
"log")
568 $conf->setFormAction($this->
ctrl->getFormAction($this,
'rsvDelete'));
569 $conf->setHeaderText($this->
lng->txt(
'book_confirm_delete'));
570 $conf->setConfirm($this->
lng->txt(
'book_set_delete'),
'rsvDelete');
571 $conf->setCancel($this->
lng->txt(
'cancel'),
'log');
574 foreach ($ids as $idx =>
$id) {
575 [$obj_id, $user_id, $from, $to] = explode(
"_",
$id);
577 $rsv_id = $rsv_ids[0];
582 $details = sprintf($this->
lng->txt(
'X_reservations_of'), count($rsv_ids)) .
' ' . $obj->getTitle();
590 foreach ($ids as $idx => $rsv_id) {
593 $details = sprintf($this->
lng->txt(
'X_reservations_of'), 1) .
' ' . $obj->getTitle();
594 $conf->addItem(
'mrsv[]', $rsv_id,
$details);
597 $this->tpl->setContent($conf->getHTML());
603 $get =
$DIC->http()->request()->getParsedBody()[
'mrsv'];
605 foreach ($get as
$id) {
607 list($obj_id, $user_id, $from, $to) = explode(
"_",
$id);
613 foreach ($rsv_ids as $rsv_id) {
616 if (!$this->checkPermissionBool(
"write") || $obj->getPoolId() !== $this->pool->getId()) {
617 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
618 $this->
ctrl->redirect($this,
'log');
621 $cal_entry_id =
$res->getCalendarEntry();
631 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'reservation_deleted'),
true);
632 $this->
ctrl->redirect($this,
'log');
637 if (!$this->checkPermissionBool(
'write')) {
641 $pref_manager = $this->service->domain()->preferences($this->pool);
642 if ($pref_manager->hasRun()) {
643 $this->
toolbar->addComponent($this->
ui->factory()->button()->standard(
644 $this->lng->txt(
"book_rerun_assignments"),
645 $this->ctrl->getLinkTarget($this,
"confirmResetRun")
653 if (!$this->checkPermissionBool(
'write')) {
656 $this->tabs_gui->activateTab(
"log");
657 $mess = $this->
ui->factory()->messageBox()->confirmation($this->
lng->txt(
"book_rerun_confirmation"))->withButtons(
659 $this->
ui->factory()->button()->standard(
660 $this->lng->txt(
"book_rerun_assignments"),
661 $this->ctrl->getLinkTarget($this,
"resetRun")
663 $this->ui->factory()->button()->standard(
664 $this->lng->txt(
"cancel"),
665 $this->ctrl->getLinkTarget($this,
"log")
669 $this->tpl->setContent(
670 $this->
ui->renderer()->render($mess)
676 if (!$this->checkPermissionBool(
'write')) {
680 && $this->access->checkAccess(
"write",
"", $this->pool->getRefId())) {
681 $pref_manager = $this->service->domain()->preferences($this->pool);
682 $repo = $this->service->repo()->preferences();
683 $pref_manager->resetRun();
684 $pref_manager->storeBookings(
685 $repo->getPreferences($this->pool->getId())
688 $this->
ctrl->redirect($this,
"log");
$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 lookupPoolId(int $object_id)
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
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)
checkPermissionBool(string $a_perm)
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...
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)
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...
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static setUseRelativeDates(bool $a_status)
set use relative dates
@classDescription Date and time handling
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...
const TYPE_NO_SCHEDULE_PREFERENCES
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...
setContent(string $a_html)
Sets content for standard template.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl