ILIAS  release_8 Revision v8.24
ilBookingReservationsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilBookingReservationsGUI:

Public Member Functions

 __construct (ilObjBookingPool $pool, ilBookingHelpAdapter $help, int $context_obj_id=0)
 
 executeCommand ()
 
 log ()
 List reservations. More...
 
 logDetails ()
 
 changeStatusObject ()
 Change status of given reservations. More...
 
 applyLogFilter ()
 
 resetLogFilter ()
 
 rsvConfirmCancelUser ()
 (C1) Confirmation screen for canceling booking without schedule from booking objects screen or from participants screen, if only one object has been selected. More...
 
 rsvCancelUser ()
 (C1.a) Confirmed (C1) More...
 
 rsvConfirmCancel ()
 (C2) Confirmation screen for canceling booking from reservations screen (with and without schedule) More...
 
 rsvConfirmCancelAggregation (array $a_ids=null)
 (C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2) More...
 
 rsvConfirmCancelAggregationForm (array $a_ids)
 Form being used in (C2.a) More...
 
 rsvCancel ()
 (C2.b) Cancel reservations (coming from C2 or C2.a) More...
 
 rsvConfirmDelete ()
 
 rsvDelete ()
 

Protected Member Functions

 getLogReservationIds ()
 Reservations IDs as currently provided from. More...
 
 setHelpId (string $a_id)
 
 getReservationsTable (?string $reservation_id=null)
 Get reservationsTable. More...
 
 checkPermissionBool (string $a_perm)
 
 back ()
 Back to reservation list. More...
 
 showRerunPreferenceAssignment ()
 
 confirmResetRun ()
 
 resetRun ()
 

Protected Attributes

ilToolbarGUI $toolbar
 
ILIAS DI UIServices $ui
 
ILIAS BookingManager InternalService $service
 
array $raw_post_data
 
ILIAS BookingManager StandardGUIRequest $book_request
 
ilBookingHelpAdapter $help
 
int $context_obj_id
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccessHandler $access
 
ilTabsGUI $tabs_gui
 
ilObjUser $user
 
ilObjBookingPool $pool
 
int $ref_id
 
int $book_obj_id
 
int $pbooked_user
 
string $reservation_id
 
int $booked_user
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Reservations screen

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilBookingReservationsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingReservationsGUI::__construct ( ilObjBookingPool  $pool,
ilBookingHelpAdapter  $help,
int  $context_obj_id = 0 
)

Definition at line 45 of file class.ilBookingReservationsGUI.php.

49 {
50 global $DIC;
51
52 $this->tpl = $DIC->ui()->mainTemplate();
53 $this->pool = $pool;
54 $this->ctrl = $DIC->ctrl();
55 $this->ref_id = $pool->getRefId();
56 $this->lng = $DIC->language();
57 $this->access = $DIC->access();
58 $this->tabs_gui = $DIC->tabs();
59 $this->help = $help;
60 $this->user = $DIC->user();
61 $this->book_request = $DIC->bookingManager()
62 ->internal()
63 ->gui()
64 ->standardRequest();
65 $this->service = $DIC->bookingManager()->internal();
66 $this->ui = $DIC->ui();
67 $this->toolbar = $DIC->toolbar();
68
69 $this->book_obj_id = $this->book_request->getObjectId();
70
71 $this->context_obj_id = $context_obj_id;
72
73 // user who's reservation is being tackled (e.g. canceled)
74 $this->booked_user = $this->book_request->getBookedUser();
75 if ($this->booked_user === 0) {
76 $this->booked_user = $DIC->user()->getId();
77 }
78 // we get this from the reservation screen
79 $this->reservation_id = $this->book_request->getReservationId();
80
81 $this->ctrl->saveParameter($this, ["object_id", "bkusr"]);
82
83 if ($this->book_request->getObjectId() > 0 && ilBookingObject::lookupPoolId($this->book_request->getObjectId()) !== $this->pool->getId()) {
84 throw new ilException("Booking Object ID does not match Booking Pool.");
85 }
86
87 $this->raw_post_data = $DIC->http()->request()->getParsedBody();
88 }
static lookupPoolId(int $object_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

References $context_obj_id, $DIC, $help, $pool, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObject\getRefId(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilBookingObject\lookupPoolId(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyLogFilter()

ilBookingReservationsGUI::applyLogFilter ( )

Definition at line 206 of file class.ilBookingReservationsGUI.php.

206 : void
207 {
208 $table = $this->getReservationsTable();
209 $table->resetOffset();
210 $table->writeFilterToSession();
211 $this->log();
212 }
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.

◆ back()

ilBookingReservationsGUI::back ( )
protected

Back to reservation list.

Definition at line 296 of file class.ilBookingReservationsGUI.php.

296 : void
297 {
298 $this->ctrl->redirect($this, "log");
299 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ changeStatusObject()

ilBookingReservationsGUI::changeStatusObject ( )

Change status of given reservations.

Definition at line 187 of file class.ilBookingReservationsGUI.php.

187 : void
188 {
189 $rsv_ids = $this->book_request->getReservationIds();
190 if (count($rsv_ids) === 0) {
191 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
192 $this->log();
193 }
194
195 if ($this->checkPermissionBool('write')) {
197 $rsv_ids,
198 $this->book_request->getStatus()
199 );
200 }
201
202 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
203 $this->ctrl->redirect($this, 'log');
204 }
static changeStatus(array $a_ids, int $a_status)
Batch update reservation status.

References ilBookingReservation\changeStatus(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ checkPermissionBool()

ilBookingReservationsGUI::checkPermissionBool ( string  $a_perm)
protected

Definition at line 222 of file class.ilBookingReservationsGUI.php.

222 : bool
223 {
224 return $this->access->checkAccess($a_perm, "", $this->ref_id);
225 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ confirmResetRun()

ilBookingReservationsGUI::confirmResetRun ( )
protected

Definition at line 651 of file class.ilBookingReservationsGUI.php.

652 {
653 if (!$this->checkPermissionBool('write')) {
654 return;
655 }
656 $this->tabs_gui->activateTab("log");
657 $mess = $this->ui->factory()->messageBox()->confirmation($this->lng->txt("book_rerun_confirmation"))->withButtons(
658 [
659 $this->ui->factory()->button()->standard(
660 $this->lng->txt("book_rerun_assignments"),
661 $this->ctrl->getLinkTarget($this, "resetRun")
662 ),
663 $this->ui->factory()->button()->standard(
664 $this->lng->txt("cancel"),
665 $this->ctrl->getLinkTarget($this, "log")
666 )
667 ]
668 );
669 $this->tpl->setContent(
670 $this->ui->renderer()->render($mess)
671 );
672 }

References ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingReservationsGUI::executeCommand ( )

Definition at line 105 of file class.ilBookingReservationsGUI.php.

105 : void
106 {
108
109 $next_class = $ctrl->getNextClass($this);
110 $cmd = $ctrl->getCmd("log");
111
112 switch ($next_class) {
113 default:
114 if (in_array($cmd, array("log", "logDetails", "changeStatusObject", "rsvConfirmCancelUser", "rsvCancelUser",
115 "applyLogFilter", "resetLogFilter", "rsvConfirmCancel", "rsvCancel", "back", "rsvConfirmDelete", "rsvDelete", "confirmResetRun", "resetRun"))) {
116 $this->$cmd();
117 }
118 }
119 }
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

+ Here is the call graph for this function:

◆ getLogReservationIds()

ilBookingReservationsGUI::getLogReservationIds ( )
protected

Reservations IDs as currently provided from.

Definition at line 93 of file class.ilBookingReservationsGUI.php.

93 : array
94 {
95 $mrsv = $this->book_request->getReservationIds();
96 if (count($mrsv) > 0) {
97 return $mrsv;
98 }
99 if ($this->reservation_id > 0) {
100 return array($this->reservation_id);
101 }
102 return [];
103 }

◆ getReservationsTable()

ilBookingReservationsGUI::getReservationsTable ( ?string  $reservation_id = null)
protected

Get reservationsTable.

Definition at line 140 of file class.ilBookingReservationsGUI.php.

143 $show_all = ($this->checkPermissionBool('write') || $this->pool->hasPublicLog());
144
145 $filter = null;
146 if ($this->book_obj_id > 0) {
147 $filter["object"] = $this->book_obj_id;
148 }
149 // coming from participants tab to cancel reservations.
150 if ($this->book_request->getUserId() > 0) {
151 $filter["user_id"] = $this->book_request->getUserId();
152 }
153 $context_filter = ($this->context_obj_id > 0)
154 ? [$this->context_obj_id]
155 : null;
156
158 $this,
159 'log',
160 $this->ref_id,
161 $this->pool->getId(),
162 $show_all,
163 ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE),
164 $filter,
166 $context_filter
167 );
168 }

References $book_obj_id.

Referenced by log().

+ Here is the caller graph for this function:

◆ log()

ilBookingReservationsGUI::log ( )

List reservations.

Definition at line 129 of file class.ilBookingReservationsGUI.php.

129 : void
130 {
133 $table = $this->getReservationsTable();
134 $tpl->setContent($table->getHTML());
135 }
setContent(string $a_html)
Sets content for standard template.

References $tpl, getReservationsTable(), ilGlobalTemplateInterface\setContent(), and showRerunPreferenceAssignment().

+ Here is the call graph for this function:

◆ logDetails()

ilBookingReservationsGUI::logDetails ( )

Definition at line 170 of file class.ilBookingReservationsGUI.php.

170 : void
171 {
173
174 $this->tabs_gui->clearTargets();
175 $this->tabs_gui->setBackTarget(
176 $this->lng->txt("back"),
177 $this->ctrl->getLinkTarget($this, "log")
178 );
179
180 $table = $this->getReservationsTable($this->reservation_id);
181 $tpl->setContent($table->getHTML());
182 }

References $tpl, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ resetLogFilter()

ilBookingReservationsGUI::resetLogFilter ( )

Definition at line 214 of file class.ilBookingReservationsGUI.php.

214 : void
215 {
216 $table = $this->getReservationsTable();
217 $table->resetOffset();
218 $table->resetFilter();
219 $this->log();
220 }

◆ resetRun()

ilBookingReservationsGUI::resetRun ( )
protected

Definition at line 674 of file class.ilBookingReservationsGUI.php.

675 {
676 if (!$this->checkPermissionBool('write')) {
677 return;
678 }
679 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES
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())
686 );
687 }
688 $this->ctrl->redirect($this, "log");
689 }

References ILIAS\Repository\ctrl(), and ilObjBookingPool\TYPE_NO_SCHEDULE_PREFERENCES.

+ Here is the call graph for this function:

◆ rsvCancel()

ilBookingReservationsGUI::rsvCancel ( )

(C2.b) Cancel reservations (coming from C2 or C2.a)

Definition at line 478 of file class.ilBookingReservationsGUI.php.

478 : void
479 {
483 $ilCtrl = $this->ctrl;
484
485 // simple version of reservation id
486 $ids = $this->book_request->getReservationIds();
487
488 $rsv_aggr = $this->raw_post_data["rsv_aggr"] ?? null;
489 // aggregated version: determine reservation ids
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(
495 $lng->txt("back"),
496 $ilCtrl->getLinkTarget($this, "log")
497 );
498
499 $tpl->setContent($form->getHTML());
500 return;
501 }
502
503 $ids = array();
504 foreach ($rsv_aggr as $idx => $aggr_ids) {
505 $max = $this->book_request->getCancelNr($idx);
506 if ($max) {
507 if (!is_array($aggr_ids)) {
508 $ids[] = $aggr_ids;
509 } else {
510 $aggr_ids = array_slice($aggr_ids, 0, $max);
511 $ids = array_merge($ids, $aggr_ids);
512 }
513 }
514 }
515 }
516
517 // for all reservation ids -> set reservation status to cancelled (and remove calendar entry)
518 if ($ids) {
519 foreach ($ids as $id) {
521
522 // either write permission or own booking
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');
528 }
529
531 $res->update();
532
533 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
534 // remove user calendar entry (#11086)
535 $cal_entry_id = $res->getCalendarEntry();
536 if ($cal_entry_id) {
537 $entry = new ilCalendarEntry($cal_entry_id);
538 $entry->delete();
539 }
540 }
541 }
542 }
543
544 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
545 $this->log();
546 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
rsvConfirmCancelAggregationForm(array $a_ids)
Form being used in (C2.a)
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...
$ilUser
Definition: imgupload.php:34
$res
Definition: ltiservices.php:69

References $id, $ilUser, $lng, $res, $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilBookingReservation\STATUS_CANCELLED, and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ rsvCancelUser()

ilBookingReservationsGUI::rsvCancelUser ( )

(C1.a) Confirmed (C1)

Definition at line 267 of file class.ilBookingReservationsGUI.php.

267 : void
268 {
270
272 $user_id = $this->booked_user;
273
274 if (!$id || !$user_id) {
275 return;
276 }
277
279 $id = current($ids);
280 $obj = new ilBookingReservation($id);
281 if ($obj->getUserId() !== $user_id) {
282 $this->tpl->setOnScreenMessage('failure', $lng->txt('permission_denied'), true);
283 $this->back();
284 }
285
287 $obj->update();
288
289 $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
290 $this->back();
291 }
static getObjectReservationForUser(int $a_object_id, int $a_user_id)

References $id, $lng, ILIAS\UI\examples\Symbol\Glyph\Back\back(), ilBookingReservation\getObjectReservationForUser(), and ilBookingReservation\STATUS_CANCELLED.

+ Here is the call graph for this function:

◆ rsvConfirmCancel()

ilBookingReservationsGUI::rsvConfirmCancel ( )

(C2) Confirmation screen for canceling booking from reservations screen (with and without schedule)

Definition at line 304 of file class.ilBookingReservationsGUI.php.

304 : void
305 {
306 $ilCtrl = $this->ctrl;
310
311 $ids = $this->getLogReservationIds();
312 if (count($ids) === 0) {
313 $this->back();
314 }
315 $max = array();
316 foreach ($ids as $idx => $id) {
317 if (!is_numeric($id)) {
318 [$obj_id, $user_id, $from, $to] = explode("_", $id);
319
320 $valid_ids = array();
321 foreach (ilBookingObject::getList($this->pool->getId()) as $item) {
322 $valid_ids[$item["booking_object_id"]] = $item["title"];
323 }
324 if (array_key_exists($obj_id, $valid_ids) && $from > time() && ($this->checkPermissionBool("write") || (int) $user_id === $ilUser->getId())) {
325 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
326 if (!count($rsv_ids)) {
327 unset($ids[$idx]);
328 }
329 if (count($rsv_ids) > 1) {
330 $max[$id] = count($rsv_ids);
331 $ids[$idx] = $rsv_ids;
332 } else {
333 // only 1 in group? treat as normal reservation
334 $ids[$idx] = array_shift($rsv_ids);
335 }
336 } else {
337 unset($ids[$idx]);
338 }
339 }
340 }
341
342 if (!is_array($ids) || !count($ids)) {
343 $this->ctrl->redirect($this, 'log');
344 }
345
346 // show form instead
347 if (count($max) && max($max) > 1) {
348 $this->rsvConfirmCancelAggregation($ids);
349 return;
350 }
351
352 $this->tabs_gui->clearTargets();
353 $this->tabs_gui->setBackTarget(
354 $lng->txt("back"),
355 $ilCtrl->getLinkTargetByClass("ilBookingReservationsGUI", "")
356 );
357
358 $this->setHelpId("cancel_booking");
359
360 $conf = new ilConfirmationGUI();
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');
365
366 foreach ($ids as $id) {
367 $rsv = new ilBookingReservation($id);
368 $obj = new ilBookingObject($rsv->getObjectId());
369
370 $details = $obj->getTitle();
371 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
373 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
374 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
375 );
376 }
377
378 $conf->addItem('rsv_id[]', $id, $details);
379 }
380
381 $tpl->setContent($conf->getHTML());
382 }
const IL_CAL_UNIX
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 getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
rsvConfirmCancelAggregation(array $a_ids=null)
(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2)
getLogReservationIds()
Reservations IDs as currently provided from.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
array $details
Details for error message relating to last request processed.
Definition: System.php:109

References ILIAS\LTI\ToolProvider\$details, $id, $ilUser, $lng, $tpl, ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), IL_CAL_UNIX, and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ rsvConfirmCancelAggregation()

ilBookingReservationsGUI::rsvConfirmCancelAggregation ( array  $a_ids = null)

(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2)

Definition at line 389 of file class.ilBookingReservationsGUI.php.

389 : void
390 {
392 $ilCtrl = $this->ctrl;
394
395 $this->tabs_gui->clearTargets();
396 $this->tabs_gui->setBackTarget(
397 $lng->txt("back"),
398 $ilCtrl->getLinkTarget($this, "log")
399 );
400
401 $this->setHelpId("cancel_booking");
402
403 // #13511
404 $this->tpl->setOnScreenMessage('question', $lng->txt("book_confirm_cancel"));
405
406 $form = $this->rsvConfirmCancelAggregationForm($a_ids);
407
408 $tpl->setContent($form->getHTML());
409 }

References $lng, and $tpl.

◆ rsvConfirmCancelAggregationForm()

ilBookingReservationsGUI::rsvConfirmCancelAggregationForm ( array  $a_ids)

Form being used in (C2.a)

Definition at line 414 of file class.ilBookingReservationsGUI.php.

417 $form = new ilPropertyFormGUI();
418 $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
419 $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
420
422
423 foreach ($a_ids as $idx => $ids) {
424 $first = $ids;
425 if (is_array($ids)) {
426 $first = array_shift($first);
427 }
428
429 $rsv = new ilBookingReservation($first);
430 $obj = new ilBookingObject($rsv->getObjectId());
431
432 $caption = $obj->getTitle() . ", " . ilDatePresentation::formatPeriod(
433 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
434 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
435 );
436
437 // #17869
438 if (is_array($ids)) {
439 $caption .= " (" . count($ids) . ")";
440 }
441
442 $item = new ilNumberInputGUI($caption, "rsv_id_" . $idx);
443 $item->setRequired(true);
444 $item->setMinValue(0);
445 $item->setSize(4);
446 $form->addItem($item);
447
448 if (is_array($ids)) {
449 $item->setMaxValue(count($ids));
450
451 foreach ($ids as $id) {
452 $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "][]");
453 $hidden->setValue($id);
454 $form->addItem($hidden);
455 }
456 } else {
457 $item->setMaxValue(1);
458
459 $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "]");
460 $hidden->setValue($ids);
461 $form->addItem($hidden);
462 }
463
464 if ($this->book_request->getCancelNr($idx)) {
465 $item->setValue($this->book_request->getCancelNr($idx));
466 }
467 }
468
469 $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
470 $form->addCommandButton("log", $this->lng->txt("cancel"));
471
472 return $form;
473 }
static setUseRelativeDates(bool $a_status)
set use relative dates
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a number property in a property form.
This class represents a property form user interface.

◆ rsvConfirmCancelUser()

ilBookingReservationsGUI::rsvConfirmCancelUser ( )

(C1) Confirmation screen for canceling booking without schedule from booking objects screen or from participants screen, if only one object has been selected.

If the process is started form the booking objects screen, the current user is the owner of the reservation.

From the participants screen the user id is provided as bkusr

Definition at line 240 of file class.ilBookingReservationsGUI.php.

240 : void
241 {
242 $ilCtrl = $this->ctrl;
246 if (!$id) {
247 return;
248 }
249
250 $this->setHelpId("cancel_booking");
251
252 $conf = new ilConfirmationGUI();
253 $conf->setFormAction($ilCtrl->getFormAction($this));
254 $conf->setHeaderText($lng->txt('book_confirm_cancel'));
255
257 $conf->addItem('object_id', $id, $type->getTitle());
258 $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
259 $conf->setCancel($lng->txt('cancel'), 'back');
260
261 $tpl->setContent($conf->getHTML());
262 }
$type

References $id, $lng, $tpl, and $type.

◆ rsvConfirmDelete()

ilBookingReservationsGUI::rsvConfirmDelete ( )

Definition at line 548 of file class.ilBookingReservationsGUI.php.

548 : void
549 {
550 global $DIC;
551 if (!$this->checkPermissionBool("write")) {
552 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
553 $this->ctrl->redirect($this, 'log');
554 }
555
556 $ids = $this->getLogReservationIds();
557 if (count($ids) === 0) {
558 $this->back();
559 }
560
561 $this->tabs_gui->clearTargets();
562 $this->tabs_gui->setBackTarget(
563 $this->lng->txt("back"),
564 $this->ctrl->getLinkTarget($this, "log")
565 );
566
567 $conf = new ilConfirmationGUI();
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');
572
573 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
574 foreach ($ids as $idx => $id) {
575 [$obj_id, $user_id, $from, $to] = explode("_", $id);
576 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
577 $rsv_id = $rsv_ids[0];
578
579 $rsv = new ilBookingReservation($rsv_id);
580 $obj = new ilBookingObject($rsv->getObjectId());
581
582 $details = sprintf($this->lng->txt('X_reservations_of'), count($rsv_ids)) . ' ' . $obj->getTitle();
584 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
585 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
586 );
587 $conf->addItem('mrsv[]', $id, $details);
588 }
589 } else {
590 foreach ($ids as $idx => $rsv_id) {
591 $rsv = new ilBookingReservation($rsv_id);
592 $obj = new ilBookingObject($rsv->getObjectId());
593 $details = sprintf($this->lng->txt('X_reservations_of'), 1) . ' ' . $obj->getTitle();
594 $conf->addItem('mrsv[]', $rsv_id, $details);
595 }
596 }
597 $this->tpl->setContent($conf->getHTML());
598 }

References ILIAS\LTI\ToolProvider\$details, $DIC, $id, ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

+ Here is the call graph for this function:

◆ rsvDelete()

ilBookingReservationsGUI::rsvDelete ( )

Definition at line 600 of file class.ilBookingReservationsGUI.php.

600 : void
601 {
602 global $DIC;
603 $get = $DIC->http()->request()->getParsedBody()['mrsv'];
604 if ($get) {
605 foreach ($get as $id) {
606 if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
607 list($obj_id, $user_id, $from, $to) = explode("_", $id);
608 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
609 } else {
610 $rsv_ids = [$id];
611 }
612
613 foreach ($rsv_ids as $rsv_id) {
614 $res = new ilBookingReservation($rsv_id);
615 $obj = new ilBookingObject($res->getObjectId());
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');
619 }
620 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
621 $cal_entry_id = $res->getCalendarEntry();
622 if ($cal_entry_id) {
623 $entry = new ilCalendarEntry($cal_entry_id);
624 $entry->delete();
625 }
626 }
627 $res->delete();
628 }
629 }
630 }
631 $this->tpl->setOnScreenMessage('success', $this->lng->txt('reservation_deleted'), true);
632 $this->ctrl->redirect($this, 'log');
633 }

References $DIC, $id, $res, ILIAS\Repository\ctrl(), ilBookingReservation\getCancelDetails(), ILIAS\Repository\lng(), ilObjBookingPool\TYPE_FIX_SCHEDULE, and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ setHelpId()

ilBookingReservationsGUI::setHelpId ( string  $a_id)
protected

Definition at line 121 of file class.ilBookingReservationsGUI.php.

121 : void
122 {
123 $this->help->setHelpId($a_id);
124 }

References ILIAS\Repository\help().

+ Here is the call graph for this function:

◆ showRerunPreferenceAssignment()

ilBookingReservationsGUI::showRerunPreferenceAssignment ( )
protected

Definition at line 635 of file class.ilBookingReservationsGUI.php.

635 : void
636 {
637 if (!$this->checkPermissionBool('write')) {
638 return;
639 }
640 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
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")
646 ));
647 }
648 }
649 }

References ILIAS\Repository\toolbar(), ilObjBookingPool\TYPE_NO_SCHEDULE_PREFERENCES, and ILIAS\Repository\ui().

Referenced by log().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingReservationsGUI::$access
protected

Definition at line 35 of file class.ilBookingReservationsGUI.php.

◆ $book_obj_id

int ilBookingReservationsGUI::$book_obj_id
protected

Definition at line 40 of file class.ilBookingReservationsGUI.php.

Referenced by getReservationsTable().

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingReservationsGUI::$book_request
protected

Definition at line 29 of file class.ilBookingReservationsGUI.php.

◆ $booked_user

int ilBookingReservationsGUI::$booked_user
protected

Definition at line 43 of file class.ilBookingReservationsGUI.php.

◆ $context_obj_id

int ilBookingReservationsGUI::$context_obj_id
protected

Definition at line 31 of file class.ilBookingReservationsGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilBookingReservationsGUI::$ctrl
protected

Definition at line 32 of file class.ilBookingReservationsGUI.php.

Referenced by executeCommand().

◆ $help

ilBookingHelpAdapter ilBookingReservationsGUI::$help
protected

Definition at line 30 of file class.ilBookingReservationsGUI.php.

Referenced by __construct().

◆ $lng

ilLanguage ilBookingReservationsGUI::$lng
protected

Definition at line 34 of file class.ilBookingReservationsGUI.php.

◆ $pbooked_user

int ilBookingReservationsGUI::$pbooked_user
protected

Definition at line 41 of file class.ilBookingReservationsGUI.php.

◆ $pool

ilObjBookingPool ilBookingReservationsGUI::$pool
protected

Definition at line 38 of file class.ilBookingReservationsGUI.php.

Referenced by __construct().

◆ $raw_post_data

array ilBookingReservationsGUI::$raw_post_data
protected

Definition at line 28 of file class.ilBookingReservationsGUI.php.

◆ $ref_id

int ilBookingReservationsGUI::$ref_id
protected

Definition at line 39 of file class.ilBookingReservationsGUI.php.

◆ $reservation_id

string ilBookingReservationsGUI::$reservation_id
protected

Definition at line 42 of file class.ilBookingReservationsGUI.php.

◆ $service

ILIAS BookingManager InternalService ilBookingReservationsGUI::$service
protected

Definition at line 27 of file class.ilBookingReservationsGUI.php.

◆ $tabs_gui

ilTabsGUI ilBookingReservationsGUI::$tabs_gui
protected

Definition at line 36 of file class.ilBookingReservationsGUI.php.

◆ $toolbar

ilToolbarGUI ilBookingReservationsGUI::$toolbar
protected

Definition at line 25 of file class.ilBookingReservationsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilBookingReservationsGUI::$tpl
protected

Definition at line 33 of file class.ilBookingReservationsGUI.php.

Referenced by log().

◆ $ui

ILIAS DI UIServices ilBookingReservationsGUI::$ui
protected

Definition at line 26 of file class.ilBookingReservationsGUI.php.

◆ $user

ilObjUser ilBookingReservationsGUI::$user
protected

Definition at line 37 of file class.ilBookingReservationsGUI.php.


The documentation for this class was generated from the following file: