ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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...
 
 checkPermissionBool (string $a_perm)
 
 back ()
 Back to reservation list. More...
 
 showRerunPreferenceAssignment ()
 
 confirmResetRun ()
 
 resetRun ()
 

Protected Attributes

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

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

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->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  }
global $DIC
Definition: feed.php:28
static lookupPoolId(int $object_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ applyLogFilter()

ilBookingReservationsGUI::applyLogFilter ( )

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

References getReservationsTable(), and log().

210  : void
211  {
212  $table = $this->getReservationsTable();
213  $table->resetOffset();
214  $table->writeFilterToSession();
215  $this->log();
216  }
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.
+ Here is the call graph for this function:

◆ back()

ilBookingReservationsGUI::back ( )
protected

Back to reservation list.

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

References ILIAS\Repository\ctrl().

Referenced by redirectMailToBooker(), rsvCancelUser(), rsvConfirmCancel(), and rsvConfirmDelete().

300  : void
301  {
302  $this->ctrl->redirect($this, "log");
303  }
+ 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 191 of file class.ilBookingReservationsGUI.php.

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

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->checkPermissionBool('write')) {
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.
+ Here is the call graph for this function:

◆ checkPermissionBool()

ilBookingReservationsGUI::checkPermissionBool ( string  $a_perm)
protected

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

References ILIAS\Repository\access().

Referenced by changeStatusObject(), confirmResetRun(), getReservationsTable(), redirectMailToBooker(), resetRun(), rsvCancel(), rsvConfirmCancel(), rsvConfirmDelete(), rsvDelete(), and showRerunPreferenceAssignment().

226  : bool
227  {
228  return $this->access->checkAccess($a_perm, "", $this->ref_id);
229  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmResetRun()

ilBookingReservationsGUI::confirmResetRun ( )
protected

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

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

656  {
657  if (!$this->checkPermissionBool('write')) {
658  return;
659  }
660  $this->tabs_gui->activateTab("log");
661  $mess = $this->ui->factory()->messageBox()->confirmation($this->lng->txt("book_rerun_confirmation"))->withButtons(
662  [
663  $this->ui->factory()->button()->standard(
664  $this->lng->txt("book_rerun_assignments"),
665  $this->ctrl->getLinkTarget($this, "resetRun")
666  ),
667  $this->ui->factory()->button()->standard(
668  $this->lng->txt("cancel"),
669  $this->ctrl->getLinkTarget($this, "log")
670  )
671  ]
672  );
673  $this->tpl->setContent(
674  $this->ui->renderer()->render($mess)
675  );
676  }
+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingReservationsGUI::deliverPostFile ( )

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

References ILIAS\Repository\user().

705  : void
706  {
707  $this->util_gui->deliverPostFile(
708  $this->book_obj_id,
709  $this->user->getId()
710  );
711  }
+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingReservationsGUI::displayPostInfo ( )

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

References ILIAS\Repository\ctrl().

695  : void
696  {
697  $this->ctrl->saveParameter($this, "object_id");
698  $this->util_gui->displayPostInfo(
699  $this->book_obj_id,
700  0,
701  "deliverPostFile"
702  );
703  }
+ Here is the call graph for this function:

◆ executeCommand()

ilBookingReservationsGUI::executeCommand ( )

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

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

110  : void
111  {
112  $ctrl = $this->ctrl;
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  }
getCmd(string $fallback_command=null)
getNextClass($a_gui_class=null)
+ 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.

Referenced by redirectMailToBooker(), rsvConfirmCancel(), and rsvConfirmDelete().

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  }
+ Here is the caller graph for this function:

◆ getReservationsTable()

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

Get reservationsTable.

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

References $book_obj_id, and checkPermissionBool().

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

148  $show_all = ($this->checkPermissionBool('write') || $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  }
+ 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.

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

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

134  : void
135  {
136  $tpl = $this->tpl;
138  $table = $this->getReservationsTable();
139  $tpl->setContent($table->getHTML());
140  }
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.
setContent(string $a_html)
Sets content for standard template.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logDetails()

ilBookingReservationsGUI::logDetails ( )

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

References $tpl, ILIAS\Repository\ctrl(), getReservationsTable(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setContent().

174  : void
175  {
176  $tpl = $this->tpl;
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  }
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.
setContent(string $a_html)
Sets content for standard template.
+ Here is the call graph for this function:

◆ redirectMailToBooker()

ilBookingReservationsGUI::redirectMailToBooker ( )

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

References $id, ilObjUser\_lookupLogin(), back(), checkPermissionBool(), ILIAS\Repository\ctrl(), ilBookingReservation\getCancelDetails(), getLogReservationIds(), ilMailFormCall\getRedirectTarget(), ILIAS\Repository\lng(), ilUtil\redirect(), ilMailFormCall\setRecipients(), ilMailFormCall\SIGNATURE_KEY, and ilObjBookingPool\TYPE_FIX_SCHEDULE.

713  : void
714  {
715  if (!$this->checkPermissionBool("write")) {
716  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
717  $this->ctrl->redirect($this, 'log');
718  }
719 
720  $ids = $this->getLogReservationIds();
721  if (count($ids) === 0) {
722  $this->back();
723  }
724 
725  $users = [];
726  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
727  foreach ($ids as $idx => $id) {
728  [$obj_id, $user_id, $from, $to] = explode("_", $id);
729  $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
730  $rsv_id = $rsv_ids[0];
731  $rsv = new ilBookingReservation($rsv_id);
732  $users[$rsv->getUserId()] = ilObjUser::_lookupLogin($rsv->getUserId());
733  }
734  } else {
735  foreach ($ids as $idx => $rsv_id) {
736  $rsv = new ilBookingReservation($rsv_id);
737  $users[$rsv->getUserId()] = ilObjUser::_lookupLogin($rsv->getUserId());
738  }
739  }
740  $logins = implode(",", $users);
741  // #16530 - see ilObjCourseGUI::createMailSignature
742  $sig = chr(13) . chr(10) . chr(13) . chr(10) . chr(13) . chr(10);
743  $sig .= $this->lng->txt('book_mail_permanent_link') . ": ";
744  $sig .= chr(13) . chr(10);
745  $sig .= ilLink::_getLink($this->book_request->getRefId());
746  $sig = rawurlencode(base64_encode($sig));
747 
750  $this,
751  "log",
752  array(),
753  array(
754  'type' => 'new',
755  'rcp_to' => $logins,
757  )
758  ));
759  }
getLogReservationIds()
Reservations IDs as currently provided from.
static getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
static redirect(string $a_script)
final const SIGNATURE_KEY
static setRecipients(array $recipients, string $type='to')
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:

◆ resetLogFilter()

ilBookingReservationsGUI::resetLogFilter ( )

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

References getReservationsTable(), and log().

218  : void
219  {
220  $table = $this->getReservationsTable();
221  $table->resetOffset();
222  $table->resetFilter();
223  $this->log();
224  }
getReservationsTable(?string $reservation_id=null)
Get reservationsTable.
+ Here is the call graph for this function:

◆ resetRun()

ilBookingReservationsGUI::resetRun ( )
protected

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

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

679  {
680  if (!$this->checkPermissionBool('write')) {
681  return;
682  }
683  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES
684  && $this->access->checkAccess("write", "", $this->pool->getRefId())) {
685  $pref_manager = $this->service->domain()->preferences($this->pool);
686  $repo = $this->service->repo()->preferences();
687  $pref_manager->resetRun();
688  $pref_manager->storeBookings(
689  $repo->getPreferences($this->pool->getId())
690  );
691  }
692  $this->ctrl->redirect($this, "log");
693  }
+ Here is the call graph for this function:

◆ rsvCancel()

ilBookingReservationsGUI::rsvCancel ( )

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

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

References $ctrl, $id, $lng, $res, $tpl, $user, checkPermissionBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), log(), rsvConfirmCancelAggregationForm(), ilGlobalTemplateInterface\setContent(), ilBookingReservation\STATUS_CANCELLED, ilLanguage\txt(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

482  : void
483  {
484  $ilUser = $this->user;
485  $tpl = $this->tpl;
486  $lng = $this->lng;
487  $ilCtrl = $this->ctrl;
488 
489  // simple version of reservation id
490  $ids = $this->book_request->getReservationIds();
491 
492  $rsv_aggr = $this->raw_post_data["rsv_aggr"] ?? null;
493  // aggregated version: determine reservation ids
494  if (!is_null($rsv_aggr)) {
495  $form = $this->rsvConfirmCancelAggregationForm($rsv_aggr);
496  if (!$form->checkInput()) {
497  $this->tabs_gui->clearTargets();
498  $this->tabs_gui->setBackTarget(
499  $lng->txt("back"),
500  $ilCtrl->getLinkTarget($this, "log")
501  );
502 
503  $tpl->setContent($form->getHTML());
504  return;
505  }
506 
507  $ids = array();
508  foreach ($rsv_aggr as $idx => $aggr_ids) {
509  $max = $this->book_request->getCancelNr($idx);
510  if ($max) {
511  if (!is_array($aggr_ids)) {
512  $ids[] = $aggr_ids;
513  } else {
514  $aggr_ids = array_slice($aggr_ids, 0, $max);
515  $ids = array_merge($ids, $aggr_ids);
516  }
517  }
518  }
519  }
520 
521  // for all reservation ids -> set reservation status to cancelled (and remove calendar entry)
522  if ($ids) {
523  foreach ($ids as $id) {
524  $res = new ilBookingReservation($id);
525 
526  // either write permission or own booking
527  $cancel_allowed_per_read = ($this->checkPermissionBool("read") && ($res->getUserId() === $ilUser->getId()));
528  $cancel_allowed_per_write = ($this->checkPermissionBool("write"));
529  if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
530  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
531  $this->ctrl->redirect($this, 'log');
532  }
533 
535  $res->update();
536 
537  if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
538  // remove user calendar entry (#11086)
539  $cal_entry_id = $res->getCalendarEntry();
540  if ($cal_entry_id) {
541  $entry = new ilCalendarEntry($cal_entry_id);
542  $entry->delete();
543  }
544  }
545  }
546  }
547 
548  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
549  $this->log();
550  }
$res
Definition: ltiservices.php:69
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...
setContent(string $a_html)
Sets content for standard template.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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...
+ Here is the call graph for this function:

◆ rsvCancelUser()

ilBookingReservationsGUI::rsvCancelUser ( )

(C1.a) Confirmed (C1)

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

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

271  : void
272  {
273  $lng = $this->lng;
274 
276  $user_id = $this->booked_user;
277 
278  if (!$id || !$user_id) {
279  return;
280  }
281 
283  $id = current($ids);
284  $obj = new ilBookingReservation($id);
285  if ($obj->getUserId() !== $user_id) {
286  $this->tpl->setOnScreenMessage('failure', $lng->txt('permission_denied'), true);
287  $this->back();
288  }
289 
291  $obj->update();
292 
293  $this->tpl->setOnScreenMessage('success', $lng->txt('settings_saved'), true);
294  $this->back();
295  }
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...
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
$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...
+ 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 308 of file class.ilBookingReservationsGUI.php.

References $ctrl, ILIAS\LTI\ToolProvider\$details, $id, $lng, $tpl, $user, back(), checkPermissionBool(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), getLogReservationIds(), IL_CAL_UNIX, ILIAS\Repository\int(), rsvConfirmCancelAggregation(), ilGlobalTemplateInterface\setContent(), setHelpId(), ilLanguage\txt(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

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

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

Referenced by rsvConfirmCancel().

393  : void
394  {
395  $tpl = $this->tpl;
396  $ilCtrl = $this->ctrl;
397  $lng = $this->lng;
398 
399  $this->tabs_gui->clearTargets();
400  $this->tabs_gui->setBackTarget(
401  $lng->txt("back"),
402  $ilCtrl->getLinkTarget($this, "log")
403  );
404 
405  $this->setHelpId("cancel_booking");
406 
407  // #13511
408  $this->tpl->setOnScreenMessage('question', $lng->txt("book_confirm_cancel"));
409 
410  $form = $this->rsvConfirmCancelAggregationForm($a_ids);
411 
412  $tpl->setContent($form->getHTML());
413  }
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...
setContent(string $a_html)
Sets content for standard template.
rsvConfirmCancelAggregationForm(array $a_ids)
Form being used in (C2.a)
+ 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 418 of file class.ilBookingReservationsGUI.php.

References $id, ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingObject\getTitle(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ilDatePresentation\setUseRelativeDates().

Referenced by rsvCancel(), and rsvConfirmCancelAggregation().

421  $form = new ilPropertyFormGUI();
422  $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
423  $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
424 
426 
427  foreach ($a_ids as $idx => $ids) {
428  $first = $ids;
429  if (is_array($ids)) {
430  $first = array_shift($first);
431  }
432 
433  $rsv = new ilBookingReservation($first);
434  $obj = new ilBookingObject($rsv->getObjectId());
435 
436  $caption = $obj->getTitle() . ", " . ilDatePresentation::formatPeriod(
437  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
438  new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
439  );
440 
441  // #17869
442  if (is_array($ids)) {
443  $caption .= " (" . count($ids) . ")";
444  }
445 
446  $item = new ilNumberInputGUI($caption, "rsv_id_" . $idx);
447  $item->setRequired(true);
448  $item->setMinValue(0);
449  $item->setSize(4);
450  $form->addItem($item);
451 
452  if (is_array($ids)) {
453  $item->setMaxValue(count($ids));
454 
455  foreach ($ids as $id) {
456  $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "][]");
457  $hidden->setValue($id);
458  $form->addItem($hidden);
459  }
460  } else {
461  $item->setMaxValue(1);
462 
463  $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "]");
464  $hidden->setValue($ids);
465  $form->addItem($hidden);
466  }
467 
468  if ($this->book_request->getCancelNr($idx)) {
469  $item->setValue($this->book_request->getCancelNr($idx));
470  }
471  }
472 
473  $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
474  $form->addCommandButton("log", $this->lng->txt("cancel"));
475 
476  return $form;
477  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
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.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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...
+ Here is the call graph for this function:
+ 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 244 of file class.ilBookingReservationsGUI.php.

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

244  : void
245  {
246  $ilCtrl = $this->ctrl;
247  $lng = $this->lng;
248  $tpl = $this->tpl;
250  if (!$id) {
251  return;
252  }
253 
254  $this->setHelpId("cancel_booking");
255 
256  $conf = new ilConfirmationGUI();
257  $conf->setFormAction($ilCtrl->getFormAction($this));
258  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
259 
260  $type = new ilBookingObject($id);
261  $conf->addItem('object_id', $id, $type->getTitle());
262  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
263  $conf->setCancel($lng->txt('cancel'), 'back');
264 
265  $tpl->setContent($conf->getHTML());
266  }
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...
setContent(string $a_html)
Sets content for standard template.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ rsvConfirmDelete()

ilBookingReservationsGUI::rsvConfirmDelete ( )

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

References ILIAS\LTI\ToolProvider\$details, $DIC, $id, back(), checkPermissionBool(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), getLogReservationIds(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

552  : void
553  {
554  global $DIC;
555  if (!$this->checkPermissionBool("write")) {
556  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
557  $this->ctrl->redirect($this, 'log');
558  }
559 
560  $ids = $this->getLogReservationIds();
561  if (count($ids) === 0) {
562  $this->back();
563  }
564 
565  $this->tabs_gui->clearTargets();
566  $this->tabs_gui->setBackTarget(
567  $this->lng->txt("back"),
568  $this->ctrl->getLinkTarget($this, "log")
569  );
570 
571  $conf = new ilConfirmationGUI();
572  $conf->setFormAction($this->ctrl->getFormAction($this, 'rsvDelete'));
573  $conf->setHeaderText($this->lng->txt('book_confirm_delete'));
574  $conf->setConfirm($this->lng->txt('book_set_delete'), 'rsvDelete');
575  $conf->setCancel($this->lng->txt('cancel'), 'log');
576 
577  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
578  foreach ($ids as $idx => $id) {
579  [$obj_id, $user_id, $from, $to] = explode("_", $id);
580  $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
581  $rsv_id = $rsv_ids[0];
582 
583  $rsv = new ilBookingReservation($rsv_id);
584  $obj = new ilBookingObject($rsv->getObjectId());
585 
586  $details = sprintf($this->lng->txt('X_reservations_of'), count($rsv_ids)) . ' ' . $obj->getTitle();
587  $details .= ", " . ilDatePresentation::formatPeriod(
588  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
589  new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
590  );
591  $conf->addItem('mrsv[]', $id, $details);
592  }
593  } else {
594  foreach ($ids as $idx => $rsv_id) {
595  $rsv = new ilBookingReservation($rsv_id);
596  $obj = new ilBookingObject($rsv->getObjectId());
597  $details = sprintf($this->lng->txt('X_reservations_of'), 1) . ' ' . $obj->getTitle();
598  $conf->addItem('mrsv[]', $rsv_id, $details);
599  }
600  }
601  $this->tpl->setContent($conf->getHTML());
602  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
getLogReservationIds()
Reservations IDs as currently provided from.
global $DIC
Definition: feed.php:28
array $details
Details for error message relating to last request processed.
Definition: System.php:109
static getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
$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...
+ Here is the call graph for this function:

◆ rsvDelete()

ilBookingReservationsGUI::rsvDelete ( )

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

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

604  : void
605  {
606  global $DIC;
607  $get = $DIC->http()->request()->getParsedBody()['mrsv'];
608  if ($get) {
609  foreach ($get as $id) {
610  if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
611  list($obj_id, $user_id, $from, $to) = explode("_", $id);
612  $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
613  } else {
614  $rsv_ids = [$id];
615  }
616 
617  foreach ($rsv_ids as $rsv_id) {
618  $res = new ilBookingReservation($rsv_id);
619  $obj = new ilBookingObject($res->getObjectId());
620  if (!$this->checkPermissionBool("write") || $obj->getPoolId() !== $this->pool->getId()) {
621  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
622  $this->ctrl->redirect($this, 'log');
623  }
624  if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE) {
625  $cal_entry_id = $res->getCalendarEntry();
626  if ($cal_entry_id) {
627  $entry = new ilCalendarEntry($cal_entry_id);
628  $entry->delete();
629  }
630  }
631  $res->delete();
632  }
633  }
634  }
635  $this->tpl->setOnScreenMessage('success', $this->lng->txt('reservation_deleted'), true);
636  $this->ctrl->redirect($this, 'log');
637  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:69
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static getCancelDetails(int $a_obj_id, int $a_user_id, int $a_from, int $a_to)
Get reservation ids from aggregated id for cancellation.
$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...
+ Here is the call graph for this function:

◆ setHelpId()

ilBookingReservationsGUI::setHelpId ( string  $a_id)
protected

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

References ILIAS\Repository\help().

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

126  : void
127  {
128  $this->help->setHelpId($a_id);
129  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showRerunPreferenceAssignment()

ilBookingReservationsGUI::showRerunPreferenceAssignment ( )
protected

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

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

Referenced by log().

639  : void
640  {
641  if (!$this->checkPermissionBool('write')) {
642  return;
643  }
644  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
645  $pref_manager = $this->service->domain()->preferences($this->pool);
646  if ($pref_manager->hasRun()) {
647  $this->toolbar->addComponent($this->ui->factory()->button()->standard(
648  $this->lng->txt("book_rerun_assignments"),
649  $this->ctrl->getLinkTarget($this, "confirmResetRun")
650  ));
651  }
652  }
653  }
+ 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 36 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 30 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 32 of file class.ilBookingReservationsGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilBookingReservationsGUI::$ctrl
protected

◆ $help

ilBookingHelpAdapter ilBookingReservationsGUI::$help
protected

Definition at line 31 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 29 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 28 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 26 of file class.ilBookingReservationsGUI.php.

◆ $tpl

◆ $ui

ILIAS DI UIServices ilBookingReservationsGUI::$ui
protected

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

◆ $user

ilObjUser ilBookingReservationsGUI::$user
protected

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

Referenced by rsvCancel(), and 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: