ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 ()
 
 displayPostInfo ()
 
 deliverPostFile ()
 
 redirectMailToBooker ()
 

Protected Member Functions

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

Protected Attributes

ILIAS BookingManager BookingProcess ProcessUtilGUI $util_gui
 
ILIAS BookingManager Access AccessManager $access
 
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
 
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 46 of file class.ilBookingReservationsGUI.php.

50 {
51 global $DIC;
52
53 $this->tpl = $DIC->ui()->mainTemplate();
54 $this->pool = $pool;
55 $this->ctrl = $DIC->ctrl();
56 $this->ref_id = $pool->getRefId();
57 $this->lng = $DIC->language();
58 $this->access = $DIC->bookingManager()->internal()->domain()->access();
59 $this->tabs_gui = $DIC->tabs();
60 $this->help = $help;
61 $this->user = $DIC->user();
62 $this->book_request = $DIC->bookingManager()
63 ->internal()
64 ->gui()
65 ->standardRequest();
66 $this->service = $DIC->bookingManager()->internal();
67 $this->ui = $DIC->ui();
68 $this->toolbar = $DIC->toolbar();
69
70 $this->book_obj_id = $this->book_request->getObjectId();
71
72 $this->context_obj_id = $context_obj_id;
73
74 // user who's reservation is being tackled (e.g. canceled)
75 $this->booked_user = $this->book_request->getBookedUser();
76 if ($this->booked_user === 0) {
77 $this->booked_user = $DIC->user()->getId();
78 }
79 // we get this from the reservation screen
80 $this->reservation_id = $this->book_request->getReservationId();
81
82 $this->ctrl->saveParameter($this, ["object_id", "bkusr"]);
83
84 if ($this->book_request->getObjectId() > 0 && ilBookingObject::lookupPoolId($this->book_request->getObjectId()) !== $this->pool->getId()) {
85 throw new ilException("Booking Object ID does not match Booking Pool.");
86 }
87
88 $this->raw_post_data = $DIC->http()->request()->getParsedBody();
89 $this->util_gui = $DIC->bookingManager()->internal()->gui()->process()->ProcessUtilGUI(
90 $this->pool,
91 $this
92 );
93 }
static lookupPoolId(int $object_id)
Base class for ILIAS Exception handling.
global $DIC
Definition: shib_login.php:26

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 204 of file class.ilBookingReservationsGUI.php.

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

References getReservationsTable(), and log().

+ Here is the call graph for this function:

◆ back()

ilBookingReservationsGUI::back ( )
protected

Back to reservation list.

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

289 : void
290 {
291 $this->ctrl->redirect($this, "log");
292 }

References ILIAS\Repository\ctrl().

Referenced by rsvCancelUser(), and rsvConfirmCancel().

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

◆ changeStatusObject()

ilBookingReservationsGUI::changeStatusObject ( )

Change status of given reservations.

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

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

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

+ Here is the call graph for this function:

◆ confirmResetRun()

ilBookingReservationsGUI::confirmResetRun ( )
protected

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

643 {
644 if (!$this->access->canManageAllReservations($this->ref_id)) {
645 return;
646 }
647 $this->tabs_gui->activateTab("log");
648 $mess = $this->ui->factory()->messageBox()->confirmation($this->lng->txt("book_rerun_confirmation"))->withButtons(
649 [
650 $this->ui->factory()->button()->standard(
651 $this->lng->txt("book_rerun_assignments"),
652 $this->ctrl->getLinkTarget($this, "resetRun")
653 ),
654 $this->ui->factory()->button()->standard(
655 $this->lng->txt("cancel"),
656 $this->ctrl->getLinkTarget($this, "log")
657 )
658 ]
659 );
660 $this->tpl->setContent(
661 $this->ui->renderer()->render($mess)
662 );
663 }

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

+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingReservationsGUI::deliverPostFile ( )

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

692 : void
693 {
694 $this->util_gui->deliverPostFile(
695 $this->book_obj_id,
696 $this->user->getId()
697 );
698 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingReservationsGUI::displayPostInfo ( )

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

682 : void
683 {
684 $this->ctrl->saveParameter($this, "object_id");
685 $this->util_gui->displayPostInfo(
686 $this->book_obj_id,
687 0,
688 "deliverPostFile"
689 );
690 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingReservationsGUI::executeCommand ( )

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

110 : void
111 {
113
114 $next_class = $ctrl->getNextClass($this);
115 $cmd = $ctrl->getCmd("log");
116
117 switch ($next_class) {
118 default:
119 if (in_array($cmd, array("log", "logDetails", "changeStatusObject", "rsvConfirmCancelUser", "rsvCancelUser",
120 "applyLogFilter", "resetLogFilter", "rsvConfirmCancel", "rsvCancel", "back", "rsvConfirmDelete", "rsvDelete", "confirmResetRun", "resetRun", "displayPostInfo", "deliverPostFile", "redirectMailToBooker"))) {
121 $this->$cmd();
122 }
123 }
124 }
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 98 of file class.ilBookingReservationsGUI.php.

98 : array
99 {
100 $mrsv = $this->book_request->getReservationIds();
101 if (count($mrsv) > 0) {
102 return $mrsv;
103 }
104 if ($this->reservation_id > 0) {
105 return array($this->reservation_id);
106 }
107 return [];
108 }

Referenced by rsvConfirmCancel().

+ Here is the caller graph for this function:

◆ getReservationsTable()

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

Get reservationsTable.

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

144 {
145 $show_all = $this->access->canManageAllReservations($this->ref_id) || $this->pool->hasPublicLog();
146
147 $filter = [];
148 if ($this->book_obj_id > 0) {
149 $filter['object'] = $this->book_obj_id;
150 }
151 // coming from participants tab to cancel reservations.
152 if ($this->book_request->getUserId() > 0) {
153 $filter['user_id'] = $this->book_request->getUserId();
154 }
155
157 $this,
158 'log',
159 $this->ref_id,
160 $this->pool,
161 $show_all,
162 $filter,
164 $this->context_obj_id > 0 ? [$this->context_obj_id] : null
165 );
166 }

References $book_obj_id, $reservation_id, and ILIAS\Repository\access().

Referenced by applyLogFilter(), log(), logDetails(), and resetLogFilter().

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

◆ log()

ilBookingReservationsGUI::log ( )

List reservations.

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

134 : void
135 {
137 $this->tpl->setContent($this->getReservationsTable()->getHTML());
138 }

References getReservationsTable(), and showRerunPreferenceAssignment().

Referenced by applyLogFilter(), changeStatusObject(), and resetLogFilter().

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

◆ logDetails()

ilBookingReservationsGUI::logDetails ( )

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

168 : void
169 {
171
172 $this->tabs_gui->clearTargets();
173 $this->tabs_gui->setBackTarget(
174 $this->lng->txt("back"),
175 $this->ctrl->getLinkTarget($this, "log")
176 );
177
178 $table = $this->getReservationsTable($this->reservation_id);
179 $tpl->setContent($table->getHTML());
180 }
setContent(string $a_html)
Sets content for standard template.

References $tpl, getReservationsTable(), ILIAS\Repository\lng(), and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ redirectMailToBooker()

ilBookingReservationsGUI::redirectMailToBooker ( )

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

700 : void
701 {
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');
705 }
706
707 $ids = $this->getLogReservationIds();
708 if (count($ids) === 0) {
709 $this->back();
710 }
711
712 $users = [];
713 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
714 foreach ($ids as $idx => $id) {
715 [$obj_id, $user_id, $from, $to] = explode("_", $id);
716 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
717 $rsv_id = $rsv_ids[0];
718 $rsv = new ilBookingReservation($rsv_id);
719 $users[$rsv->getUserId()] = ilObjUser::_lookupLogin($rsv->getUserId());
720 }
721 } else {
722 foreach ($ids as $idx => $rsv_id) {
723 $rsv = new ilBookingReservation($rsv_id);
724 $users[$rsv->getUserId()] = ilObjUser::_lookupLogin($rsv->getUserId());
725 }
726 }
727 $logins = implode(",", $users);
728 // #16530 - see ilObjCourseGUI::createMailSignature
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));
734
737 $this,
738 "log",
739 array(),
740 array(
741 'type' => 'new',
742 'rcp_to' => $logins,
744 )
745 ));
746 }
$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...
static getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
getLogReservationIds()
Reservations IDs as currently provided from.
final const string SIGNATURE_KEY
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static setRecipients(array $recipients, string $type='to')
static _lookupLogin(int $a_user_id)
static redirect(string $a_script)

References $id, $user_id, ilObjUser\_lookupLogin(), ILIAS\Repository\access(), ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\ctrl(), ilBookingReservation\getCancelDetails(), ilMailFormCall\getRedirectTarget(), ILIAS\Repository\lng(), ilUtil\redirect(), ilMailFormCall\setRecipients(), ilMailFormCall\SIGNATURE_KEY, and ilObjBookingPool\TYPE_FIX_SCHEDULE.

+ Here is the call graph for this function:

◆ resetLogFilter()

ilBookingReservationsGUI::resetLogFilter ( )

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

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

References getReservationsTable(), and log().

+ Here is the call graph for this function:

◆ resetRun()

ilBookingReservationsGUI::resetRun ( )
protected

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

666 {
667 if (!$this->access->canManageAllReservations($this->ref_id)) {
668 return;
669 }
670 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES
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())
677 );
678 }
679 $this->ctrl->redirect($this, "log");
680 }

References ILIAS\Repository\access(), 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 471 of file class.ilBookingReservationsGUI.php.

471 : void
472 {
473 $ilUser = $this->user;
476 $ilCtrl = $this->ctrl;
477
478 // simple version of reservation id
479 $ids = $this->book_request->getReservationIds();
480
481 $rsv_aggr = $this->raw_post_data["rsv_aggr"] ?? null;
482 // aggregated version: determine reservation ids
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(
488 $lng->txt("back"),
489 $ilCtrl->getLinkTarget($this, "log")
490 );
491
492 $tpl->setContent($form->getHTML());
493 return;
494 }
495
496 $ids = array();
497 foreach ($rsv_aggr as $idx => $aggr_ids) {
498 $max = $this->book_request->getCancelNr($idx);
499 if ($max) {
500 if (!is_array($aggr_ids)) {
501 $ids[] = $aggr_ids;
502 } else {
503 $aggr_ids = array_slice($aggr_ids, 0, $max);
504 $ids = array_merge($ids, $aggr_ids);
505 }
506 }
507 }
508 }
509
510 // for all reservation ids -> set reservation status to cancelled (and remove calendar entry)
511 if ($ids) {
512 foreach ($ids as $id) {
514
515 // either write permission or own booking
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');
519 }
520
522 $res->update();
523
524 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
525 // remove user calendar entry (#11086)
526 $cal_entry_id = $res->getCalendarEntry();
527 if ($cal_entry_id) {
528 $entry = new ilCalendarEntry($cal_entry_id);
529 $entry->delete();
530 }
531 }
532 }
533 }
534
535 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
536 $this->log();
537 }
rsvConfirmCancelAggregationForm(array $a_ids)
Form being used in (C2.a)
Model for a calendar entry.
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...
$res
Definition: ltiservices.php:69

References $id, $lng, $res, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\setContent(), 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 260 of file class.ilBookingReservationsGUI.php.

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

References $book_obj_id, $booked_user, $id, $lng, $user_id, back(), ilBookingReservation\getObjectReservationForUser(), ilBookingReservation\STATUS_CANCELLED, and ilLanguage\txt().

+ 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 297 of file class.ilBookingReservationsGUI.php.

297 : void
298 {
299 $ilCtrl = $this->ctrl;
302 $ilUser = $this->user;
303
304 $ids = $this->getLogReservationIds();
305 if (count($ids) === 0) {
306 $this->back();
307 }
308 $max = array();
309 foreach ($ids as $idx => $id) {
310 if (!is_numeric($id)) {
311 [$obj_id, $user_id, $from, $to] = explode("_", $id);
312
313 $valid_ids = array();
314 foreach (ilBookingObject::getList($this->pool->getId()) as $item) {
315 $valid_ids[$item["booking_object_id"]] = $item["title"];
316 }
317 if (array_key_exists($obj_id, $valid_ids) && $from > time() && ($this->access->canManageAllReservations($this->ref_id) || (int) $user_id === $ilUser->getId())) {
318 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
319 if (!count($rsv_ids)) {
320 unset($ids[$idx]);
321 }
322 if (count($rsv_ids) > 1) {
323 $max[$id] = count($rsv_ids);
324 $ids[$idx] = $rsv_ids;
325 } else {
326 // only 1 in group? treat as normal reservation
327 $ids[$idx] = array_shift($rsv_ids);
328 }
329 } else {
330 unset($ids[$idx]);
331 }
332 }
333 }
334
335 if (!is_array($ids) || !count($ids)) {
336 $this->ctrl->redirect($this, 'log');
337 }
338
339 // show form instead
340 if (count($max) && max($max) > 1) {
341 $this->rsvConfirmCancelAggregation($ids);
342 return;
343 }
344
345 $this->tabs_gui->clearTargets();
346 $this->tabs_gui->setBackTarget(
347 $lng->txt("back"),
348 $ilCtrl->getLinkTargetByClass("ilBookingReservationsGUI", "")
349 );
350
351 $this->setHelpId("cancel_booking");
352
353 $conf = new ilConfirmationGUI();
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');
358
359 foreach ($ids as $id) {
360 $rsv = new ilBookingReservation($id);
361 $obj = new ilBookingObject($rsv->getObjectId());
362
363 $details = $obj->getTitle();
364 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
365 $details .= ", " . ilDatePresentation::formatPeriod(
366 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
367 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
368 );
369 }
370
371 $conf->addItem('rsv_id[]', $id, $details);
372 }
373
374 $tpl->setContent($conf->getHTML());
375 }
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.
rsvConfirmCancelAggregation(?array $a_ids=null)
(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2)
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, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling

References $ctrl, $id, $lng, $tpl, $user, $user_id, ILIAS\Repository\access(), back(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), getLogReservationIds(), IL_CAL_UNIX, rsvConfirmCancelAggregation(), ILIAS\UICore\GlobalTemplate\setContent(), setHelpId(), ilLanguage\txt(), 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 382 of file class.ilBookingReservationsGUI.php.

382 : void
383 {
385 $ilCtrl = $this->ctrl;
387
388 $this->tabs_gui->clearTargets();
389 $this->tabs_gui->setBackTarget(
390 $lng->txt("back"),
391 $ilCtrl->getLinkTarget($this, "log")
392 );
393
394 $this->setHelpId("cancel_booking");
395
396 // #13511
397 $this->tpl->setOnScreenMessage('question', $lng->txt("book_confirm_cancel"));
398
399 $form = $this->rsvConfirmCancelAggregationForm($a_ids);
400
401 $tpl->setContent($form->getHTML());
402 }

References $ctrl, $lng, $tpl, rsvConfirmCancelAggregationForm(), ILIAS\UICore\GlobalTemplate\setContent(), setHelpId(), and ilLanguage\txt().

Referenced by rsvConfirmCancel().

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

◆ rsvConfirmCancelAggregationForm()

ilBookingReservationsGUI::rsvConfirmCancelAggregationForm ( array  $a_ids)

Form being used in (C2.a)

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

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

Referenced by rsvConfirmCancelAggregation().

+ Here is the caller graph for this function:

◆ 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 233 of file class.ilBookingReservationsGUI.php.

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

References $book_obj_id, $ctrl, $id, $lng, $tpl, ILIAS\UICore\GlobalTemplate\setContent(), setHelpId(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ rsvConfirmDelete()

ilBookingReservationsGUI::rsvConfirmDelete ( )

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

539 : void
540 {
541 global $DIC;
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');
545 }
546
547 $ids = $this->getLogReservationIds();
548 if (count($ids) === 0) {
549 $this->back();
550 }
551
552 $this->tabs_gui->clearTargets();
553 $this->tabs_gui->setBackTarget(
554 $this->lng->txt("back"),
555 $this->ctrl->getLinkTarget($this, "log")
556 );
557
558 $conf = new ilConfirmationGUI();
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');
563
564 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
565 foreach ($ids as $idx => $id) {
566 [$obj_id, $user_id, $from, $to] = explode("_", $id);
567 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
568 $rsv_id = $rsv_ids[0];
569
570 $rsv = new ilBookingReservation($rsv_id);
571 $obj = new ilBookingObject($rsv->getObjectId());
572
573 $details = sprintf($this->lng->txt('X_reservations_of'), count($rsv_ids)) . ' ' . $obj->getTitle();
574 $details .= ", " . ilDatePresentation::formatPeriod(
575 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
576 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
577 );
578 $conf->addItem('mrsv[]', $id, $details);
579 }
580 } else {
581 foreach ($ids as $idx => $rsv_id) {
582 $rsv = new ilBookingReservation($rsv_id);
583 $obj = new ilBookingObject($rsv->getObjectId());
584 $details = sprintf($this->lng->txt('X_reservations_of'), 1) . ' ' . $obj->getTitle();
585 $conf->addItem('mrsv[]', $rsv_id, $details);
586 }
587 }
588 $this->tpl->setContent($conf->getHTML());
589 }

References $DIC, $id, $user_id, ILIAS\Repository\access(), 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 591 of file class.ilBookingReservationsGUI.php.

591 : void
592 {
593 global $DIC;
594 $get = $DIC->http()->request()->getParsedBody()['mrsv'];
595 if ($get) {
596 foreach ($get as $id) {
597 if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
598 list($obj_id, $user_id, $from, $to) = explode("_", $id);
599 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
600 } else {
601 $rsv_ids = [$id];
602 }
603
604 foreach ($rsv_ids as $rsv_id) {
605 $res = new ilBookingReservation($rsv_id);
606 $obj = new ilBookingObject($res->getObjectId());
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');
610 }
611 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
612 $cal_entry_id = $res->getCalendarEntry();
613 if ($cal_entry_id) {
614 $entry = new ilCalendarEntry($cal_entry_id);
615 $entry->delete();
616 }
617 }
618 $res->delete();
619 }
620 }
621 }
622 $this->tpl->setOnScreenMessage('success', $this->lng->txt('reservation_deleted'), true);
623 $this->ctrl->redirect($this, 'log');
624 }

References $DIC, $id, $res, $user_id, ILIAS\Repository\access(), 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 126 of file class.ilBookingReservationsGUI.php.

126 : void
127 {
128 $this->help->setHelpId($a_id);
129 }

References ILIAS\Repository\help().

Referenced by rsvConfirmCancel(), rsvConfirmCancelAggregation(), and rsvConfirmCancelUser().

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

◆ showRerunPreferenceAssignment()

ilBookingReservationsGUI::showRerunPreferenceAssignment ( )
protected

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

626 : void
627 {
628 if (!$this->access->canManageAllReservations($this->ref_id)) {
629 return;
630 }
631 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
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")
637 ));
638 }
639 }
640 }

References ILIAS\Repository\access(), 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

ILIAS BookingManager Access AccessManager ilBookingReservationsGUI::$access
protected

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

◆ $book_obj_id

int ilBookingReservationsGUI::$book_obj_id
protected

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingReservationsGUI::$book_request
protected

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

◆ $booked_user

int ilBookingReservationsGUI::$booked_user
protected

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

Referenced by rsvCancelUser().

◆ $context_obj_id

int ilBookingReservationsGUI::$context_obj_id
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrl ilBookingReservationsGUI::$ctrl
protected

◆ $help

ilBookingHelpAdapter ilBookingReservationsGUI::$help
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilBookingReservationsGUI::$lng
protected

◆ $pbooked_user

int ilBookingReservationsGUI::$pbooked_user
protected

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

◆ $pool

ilObjBookingPool ilBookingReservationsGUI::$pool
protected

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

Referenced by __construct().

◆ $raw_post_data

array ilBookingReservationsGUI::$raw_post_data
protected

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

◆ $ref_id

int ilBookingReservationsGUI::$ref_id
protected

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

◆ $reservation_id

string ilBookingReservationsGUI::$reservation_id
protected

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

Referenced by getReservationsTable().

◆ $service

ILIAS BookingManager InternalService ilBookingReservationsGUI::$service
protected

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

◆ $tabs_gui

ilTabsGUI ilBookingReservationsGUI::$tabs_gui
protected

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

◆ $toolbar

ilToolbarGUI ilBookingReservationsGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilBookingReservationsGUI::$tpl
protected

◆ $ui

ILIAS DI UIServices ilBookingReservationsGUI::$ui
protected

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

◆ $user

ilObjUser ilBookingReservationsGUI::$user
protected

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

Referenced by rsvConfirmCancel().

◆ $util_gui

ILIAS BookingManager BookingProcess ProcessUtilGUI ilBookingReservationsGUI::$util_gui
protected

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


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