ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 210 of file class.ilBookingReservationsGUI.php.

210 : void
211 {
212 $table = $this->getReservationsTable();
213 $table->resetOffset();
214 $table->writeFilterToSession();
215 $this->log();
216 }
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.

◆ back()

ilBookingReservationsGUI::back ( )
protected

Back to reservation list.

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

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

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ changeStatusObject()

ilBookingReservationsGUI::changeStatusObject ( )

Change status of given reservations.

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

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

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

+ Here is the call graph for this function:

◆ confirmResetRun()

ilBookingReservationsGUI::confirmResetRun ( )
protected

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

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

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

698 : void
699 {
700 $this->util_gui->deliverPostFile(
701 $this->book_obj_id,
702 $this->user->getId()
703 );
704 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingReservationsGUI::displayPostInfo ( )

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

688 : void
689 {
690 $this->ctrl->saveParameter($this, "object_id");
691 $this->util_gui->displayPostInfo(
692 $this->book_obj_id,
693 0,
694 "deliverPostFile"
695 );
696 }

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 }

◆ getReservationsTable()

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

Get reservationsTable.

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

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

References $book_obj_id.

Referenced by log().

+ 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 {
138 $table = $this->getReservationsTable();
139 $tpl->setContent($table->getHTML());
140 }
setContent(string $a_html)
Sets content for standard template.

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

+ Here is the call graph for this function:

◆ logDetails()

ilBookingReservationsGUI::logDetails ( )

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

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

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

+ Here is the call graph for this function:

◆ redirectMailToBooker()

ilBookingReservationsGUI::redirectMailToBooker ( )

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

706 : void
707 {
708 if (!$this->access->canManageAllReservations($this->ref_id)) {
709 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
710 $this->ctrl->redirect($this, 'log');
711 }
712
713 $ids = $this->getLogReservationIds();
714 if (count($ids) === 0) {
715 $this->back();
716 }
717
718 $users = [];
719 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
720 foreach ($ids as $idx => $id) {
721 [$obj_id, $user_id, $from, $to] = explode("_", $id);
722 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
723 $rsv_id = $rsv_ids[0];
724 $rsv = new ilBookingReservation($rsv_id);
725 $users[$rsv->getUserId()] = ilObjUser::_lookupLogin($rsv->getUserId());
726 }
727 } else {
728 foreach ($ids as $idx => $rsv_id) {
729 $rsv = new ilBookingReservation($rsv_id);
730 $users[$rsv->getUserId()] = ilObjUser::_lookupLogin($rsv->getUserId());
731 }
732 }
733 $logins = implode(",", $users);
734 // #16530 - see ilObjCourseGUI::createMailSignature
735 $sig = chr(13) . chr(10) . chr(13) . chr(10) . chr(13) . chr(10);
736 $sig .= $this->lng->txt('book_mail_permanent_link') . ": ";
737 $sig .= chr(13) . chr(10);
738 $sig .= ilLink::_getLink($this->book_request->getRefId());
739 $sig = rawurlencode(base64_encode($sig));
740
743 $this,
744 "log",
745 array(),
746 array(
747 'type' => 'new',
748 'rcp_to' => $logins,
750 )
751 ));
752 }
$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 218 of file class.ilBookingReservationsGUI.php.

218 : void
219 {
220 $table = $this->getReservationsTable();
221 $table->resetOffset();
222 $table->resetFilter();
223 $this->log();
224 }

◆ resetRun()

ilBookingReservationsGUI::resetRun ( )
protected

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

672 {
673 if (!$this->access->canManageAllReservations($this->ref_id)) {
674 return;
675 }
676 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES
677 && $this->access->canManageAllReservations($this->pool->getRefId())) {
678 $pref_manager = $this->service->domain()->preferences($this->pool);
679 $repo = $this->service->repo()->preferences();
680 $pref_manager->resetRun();
681 $pref_manager->storeBookings(
682 $repo->getPreferences($this->pool->getId())
683 );
684 }
685 $this->ctrl->redirect($this, "log");
686 }

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

477 : void
478 {
479 $ilUser = $this->user;
482 $ilCtrl = $this->ctrl;
483
484 // simple version of reservation id
485 $ids = $this->book_request->getReservationIds();
486
487 $rsv_aggr = $this->raw_post_data["rsv_aggr"] ?? null;
488 // aggregated version: determine reservation ids
489 if (!is_null($rsv_aggr)) {
490 $form = $this->rsvConfirmCancelAggregationForm($rsv_aggr);
491 if (!$form->checkInput()) {
492 $this->tabs_gui->clearTargets();
493 $this->tabs_gui->setBackTarget(
494 $lng->txt("back"),
495 $ilCtrl->getLinkTarget($this, "log")
496 );
497
498 $tpl->setContent($form->getHTML());
499 return;
500 }
501
502 $ids = array();
503 foreach ($rsv_aggr as $idx => $aggr_ids) {
504 $max = $this->book_request->getCancelNr($idx);
505 if ($max) {
506 if (!is_array($aggr_ids)) {
507 $ids[] = $aggr_ids;
508 } else {
509 $aggr_ids = array_slice($aggr_ids, 0, $max);
510 $ids = array_merge($ids, $aggr_ids);
511 }
512 }
513 }
514 }
515
516 // for all reservation ids -> set reservation status to cancelled (and remove calendar entry)
517 if ($ids) {
518 foreach ($ids as $id) {
520
521 // either write permission or own booking
522 if (!$this->access->canManageReservationForUser($this->ref_id, $res->getUserId())) {
523 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
524 $this->ctrl->redirect($this, 'log');
525 }
526
528 $res->update();
529
530 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
531 // remove user calendar entry (#11086)
532 $cal_entry_id = $res->getCalendarEntry();
533 if ($cal_entry_id) {
534 $entry = new ilCalendarEntry($cal_entry_id);
535 $entry->delete();
536 }
537 }
538 }
539 }
540
541 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
542 $this->log();
543 }
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 266 of file class.ilBookingReservationsGUI.php.

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

References $id, $lng, $user_id, 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 303 of file class.ilBookingReservationsGUI.php.

303 : void
304 {
305 $ilCtrl = $this->ctrl;
308 $ilUser = $this->user;
309
310 $ids = $this->getLogReservationIds();
311 if (count($ids) === 0) {
312 $this->back();
313 }
314 $max = array();
315 foreach ($ids as $idx => $id) {
316 if (!is_numeric($id)) {
317 [$obj_id, $user_id, $from, $to] = explode("_", $id);
318
319 $valid_ids = array();
320 foreach (ilBookingObject::getList($this->pool->getId()) as $item) {
321 $valid_ids[$item["booking_object_id"]] = $item["title"];
322 }
323 if (array_key_exists($obj_id, $valid_ids) && $from > time() && ($this->access->canManageAllReservations($this->ref_id) || (int) $user_id === $ilUser->getId())) {
324 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
325 if (!count($rsv_ids)) {
326 unset($ids[$idx]);
327 }
328 if (count($rsv_ids) > 1) {
329 $max[$id] = count($rsv_ids);
330 $ids[$idx] = $rsv_ids;
331 } else {
332 // only 1 in group? treat as normal reservation
333 $ids[$idx] = array_shift($rsv_ids);
334 }
335 } else {
336 unset($ids[$idx]);
337 }
338 }
339 }
340
341 if (!is_array($ids) || !count($ids)) {
342 $this->ctrl->redirect($this, 'log');
343 }
344
345 // show form instead
346 if (count($max) && max($max) > 1) {
347 $this->rsvConfirmCancelAggregation($ids);
348 return;
349 }
350
351 $this->tabs_gui->clearTargets();
352 $this->tabs_gui->setBackTarget(
353 $lng->txt("back"),
354 $ilCtrl->getLinkTargetByClass("ilBookingReservationsGUI", "")
355 );
356
357 $this->setHelpId("cancel_booking");
358
359 $conf = new ilConfirmationGUI();
360 $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
361 $conf->setHeaderText($lng->txt('book_confirm_cancel'));
362 $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
363 $conf->setCancel($lng->txt('cancel'), 'back');
364
365 foreach ($ids as $id) {
366 $rsv = new ilBookingReservation($id);
367 $obj = new ilBookingObject($rsv->getObjectId());
368
369 $details = $obj->getTitle();
370 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
371 $details .= ", " . ilDatePresentation::formatPeriod(
372 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
373 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
374 );
375 }
376
377 $conf->addItem('rsv_id[]', $id, $details);
378 }
379
380 $tpl->setContent($conf->getHTML());
381 }
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 $id, $lng, $user_id, ILIAS\Repository\access(), ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), IL_CAL_UNIX, ILIAS\UICore\GlobalTemplate\setContent(), 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 388 of file class.ilBookingReservationsGUI.php.

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

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

+ Here is the call graph for this function:

◆ rsvConfirmCancelAggregationForm()

ilBookingReservationsGUI::rsvConfirmCancelAggregationForm ( array  $a_ids)

Form being used in (C2.a)

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

416 $form = new ilPropertyFormGUI();
417 $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
418 $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
419
421
422 foreach ($a_ids as $idx => $ids) {
423 $first = $ids;
424 if (is_array($ids)) {
425 $first = array_shift($first);
426 }
427
428 $rsv = new ilBookingReservation($first);
429 $obj = new ilBookingObject($rsv->getObjectId());
430
431 $caption = $obj->getTitle() . ", " . ilDatePresentation::formatPeriod(
432 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
433 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
434 );
435
436 // #17869
437 if (is_array($ids)) {
438 $caption .= " (" . count($ids) . ")";
439 }
440
441 $item = new ilNumberInputGUI($caption, "rsv_id_" . $idx);
442 $item->setRequired(true);
443 $item->setMinValue(0);
444 $item->setSize(4);
445 $form->addItem($item);
446
447 if (is_array($ids)) {
448 $item->setMaxValue(count($ids));
449
450 foreach ($ids as $id) {
451 $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "][]");
452 $hidden->setValue($id);
453 $form->addItem($hidden);
454 }
455 } else {
456 $item->setMaxValue(1);
457
458 $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "]");
459 $hidden->setValue($ids);
460 $form->addItem($hidden);
461 }
462
463 if ($this->book_request->getCancelNr($idx)) {
464 $item->setValue($this->book_request->getCancelNr($idx));
465 }
466 }
467
468 $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
469 $form->addCommandButton("log", $this->lng->txt("cancel"));
470
471 return $form;
472 }
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.

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

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

References $id, $lng, and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ rsvConfirmDelete()

ilBookingReservationsGUI::rsvConfirmDelete ( )

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

545 : void
546 {
547 global $DIC;
548 if (!$this->access->canManageAllReservations($this->ref_id)) {
549 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
550 $this->ctrl->redirect($this, 'log');
551 }
552
553 $ids = $this->getLogReservationIds();
554 if (count($ids) === 0) {
555 $this->back();
556 }
557
558 $this->tabs_gui->clearTargets();
559 $this->tabs_gui->setBackTarget(
560 $this->lng->txt("back"),
561 $this->ctrl->getLinkTarget($this, "log")
562 );
563
564 $conf = new ilConfirmationGUI();
565 $conf->setFormAction($this->ctrl->getFormAction($this, 'rsvDelete'));
566 $conf->setHeaderText($this->lng->txt('book_confirm_delete'));
567 $conf->setConfirm($this->lng->txt('book_set_delete'), 'rsvDelete');
568 $conf->setCancel($this->lng->txt('cancel'), 'log');
569
570 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
571 foreach ($ids as $idx => $id) {
572 [$obj_id, $user_id, $from, $to] = explode("_", $id);
573 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
574 $rsv_id = $rsv_ids[0];
575
576 $rsv = new ilBookingReservation($rsv_id);
577 $obj = new ilBookingObject($rsv->getObjectId());
578
579 $details = sprintf($this->lng->txt('X_reservations_of'), count($rsv_ids)) . ' ' . $obj->getTitle();
580 $details .= ", " . ilDatePresentation::formatPeriod(
581 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
582 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
583 );
584 $conf->addItem('mrsv[]', $id, $details);
585 }
586 } else {
587 foreach ($ids as $idx => $rsv_id) {
588 $rsv = new ilBookingReservation($rsv_id);
589 $obj = new ilBookingObject($rsv->getObjectId());
590 $details = sprintf($this->lng->txt('X_reservations_of'), 1) . ' ' . $obj->getTitle();
591 $conf->addItem('mrsv[]', $rsv_id, $details);
592 }
593 }
594 $this->tpl->setContent($conf->getHTML());
595 }

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

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

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().

+ Here is the call graph for this function:

◆ showRerunPreferenceAssignment()

ilBookingReservationsGUI::showRerunPreferenceAssignment ( )
protected

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

632 : void
633 {
634 if (!$this->access->canManageAllReservations($this->ref_id)) {
635 return;
636 }
637 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
638 $pref_manager = $this->service->domain()->preferences($this->pool);
639 if ($pref_manager->hasRun()) {
640 $this->toolbar->addComponent($this->ui->factory()->button()->standard(
641 $this->lng->txt("book_rerun_assignments"),
642 $this->ctrl->getLinkTarget($this, "confirmResetRun")
643 ));
644 }
645 }
646 }

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

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

Referenced by getReservationsTable().

◆ $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.

◆ $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

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

Referenced by executeCommand().

◆ $help

ilBookingHelpAdapter ilBookingReservationsGUI::$help
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilBookingReservationsGUI::$lng
protected

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

◆ $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.

◆ $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

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

Referenced by log().

◆ $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.

◆ $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: