ILIAS  release_7 Revision v7.30-3-g800a261c036
ilBookingReservationsGUI Class Reference

Reservations screen. More...

+ Collaboration diagram for ilBookingReservationsGUI:

Public Member Functions

 __construct (ilObjBookingPool $pool, ilBookingHelpAdapter $help, int $context_obj_id=0)
 ilBookingReservationsGUI constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 log ()
 List reservations. More...
 
 logDetails ()
 
 changeStatusObject ()
 Change status of given reservations. More...
 
 applyLogFilter ()
 Apply filter from reservations table gui. More...
 
 resetLogFilter ()
 Reset filter in reservations table gui. More...
 
 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 ($a_ids)
 Form being used in (C2.a) More...
 
 rsvCancel ()
 (C2.b) Cancel reservations (coming from C2 or C2.a) More...
 
 rsvConfirmDelete ()
 
 rsvDelete ()
 

Protected Member Functions

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

Protected Attributes

 $help
 
 $context_obj_id
 

Detailed Description

Reservations screen.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

ilBookingReservationsGUI constructor.

Parameters
ilObjBookingPool$pool
ilBookingHelpAdapter$help
int$context_obj_idfilter ui for a context object (e.g. course)
Exceptions
ilException

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

31 {
32 global $DIC;
33
34 $this->tpl = $DIC->ui()->mainTemplate();
35 $this->pool = $pool;
36 $this->ctrl = $DIC->ctrl();
37 $this->ref_id = $pool->getRefId();
38 $this->lng = $DIC->language();
39 $this->access = $DIC->access();
40 $this->tabs_gui = $DIC->tabs();
41 $this->help = $help;
42 $this->user = $DIC->user();
43 $this->service = $DIC->bookingManager()->internal();
44 $this->ui = $DIC->ui();
45 $this->toolbar = $DIC->toolbar();
46
47 $this->book_obj_id = (int) $_REQUEST['object_id'];
48
49 $this->context_obj_id = $context_obj_id;
50
51 // user who's reservation is being tackled (e.g. canceled)
52 $this->booked_user = (int) $_REQUEST['bkusr'];
53 if ($this->booked_user == 0) {
54 $this->booked_user = $DIC->user()->getId();
55 }
56 // we get this from the reservation screen
57 $this->reservation_id = ilUtil::stripSlashes($_GET["reservation_id"]);
58
59 $this->ctrl->saveParameter($this, ["object_id", "bkusr"]);
60
61 if ((int) $_REQUEST['object_id'] > 0 && ilBookingObject::lookupPoolId((int) $_REQUEST['object_id']) != $this->pool->getId()) {
62 throw new ilException("Booking Object ID does not match Booking Pool.");
63 }
64 }
user()
Definition: user.php:4
$_GET["client_id"]
static lookupPoolId($object_id)
Lookup pool id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRefId()
get reference id @access public
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
ui()
Definition: ui.php:5

References $_GET, $context_obj_id, $DIC, $help, ilObject\getRefId(), help(), ilBookingObject\lookupPoolId(), ilUtil\stripSlashes(), ui(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyLogFilter()

ilBookingReservationsGUI::applyLogFilter ( )

Apply filter from reservations table gui.

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

191 {
192 $table = $this->getReservationsTable();
193 $table->resetOffset();
194 $table->writeFilterToSession();
195 $this->log();
196 }
getReservationsTable($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 290 of file class.ilBookingReservationsGUI.php.

291 {
292 $this->ctrl->redirect($this, "log");
293 }

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

+ Here is the caller graph for this function:

◆ changeStatusObject()

ilBookingReservationsGUI::changeStatusObject ( )

Change status of given reservations.

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

173 {
174 if (!$_POST['reservation_id']) {
175 ilUtil::sendFailure($this->lng->txt('select_one'));
176 $this->log();
177 }
178
179 if ($this->checkPermissionBool('write')) {
180 ilBookingReservation::changeStatus($_POST['reservation_id'], (int) $_POST['tstatus']);
181 }
182
183 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
184 $this->ctrl->redirect($this, 'log');
185 }
$_POST["username"]
static changeStatus(array $a_ids, $a_status)
Batch update reservation status.
checkPermissionBool($a_perm)
Check permission.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, ilBookingReservation\changeStatus(), checkPermissionBool(), log(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ checkPermissionBool()

ilBookingReservationsGUI::checkPermissionBool (   $a_perm)
protected

Check permission.

Parameters
$a_perm
Returns
mixed

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

216 {
217 $ilAccess = $this->access;
218
219 return $ilAccess->checkAccess($a_perm, "", $this->ref_id);
220 }

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

+ Here is the caller graph for this function:

◆ confirmResetRun()

ilBookingReservationsGUI::confirmResetRun ( )
protected

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

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

References checkPermissionBool(), and ui().

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingReservationsGUI::executeCommand ( )

Execute command.

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

85 {
86 $ctrl = $this->ctrl;
87
88 $next_class = $ctrl->getNextClass($this);
89 $cmd = $ctrl->getCmd("log");
90
91 switch ($next_class) {
92 default:
93 if (in_array($cmd, array("log", "logDetails", "changeStatusObject", "rsvConfirmCancelUser", "rsvCancelUser",
94 "applyLogFilter", "resetLogFilter", "rsvConfirmCancel", "rsvCancel", "back", "rsvConfirmDelete", "rsvDelete", "confirmResetRun", "resetRun"))) {
95 $this->$cmd();
96 }
97 }
98 }

◆ getLogReservationIds()

ilBookingReservationsGUI::getLogReservationIds ( )
protected

Reservations IDs as currently provided from.

Returns
array

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

71 {
72 if (is_array($_POST["mrsv"])) {
73 return $_POST["mrsv"];
74 } elseif ($this->reservation_id > 0) {
75 return array($this->reservation_id);
76 }
77 return [];
78 }

References $_POST.

Referenced by rsvConfirmCancel(), and rsvConfirmDelete().

+ Here is the caller graph for this function:

◆ getReservationsTable()

ilBookingReservationsGUI::getReservationsTable (   $reservation_id = null)
protected

Get reservationsTable.

Parameters
string$reservation_id
Returns
ilTableGUI

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

126 {
127 $show_all = ($this->checkPermissionBool('write') || $this->pool->hasPublicLog());
128
129 $filter = null;
130 if ($this->book_obj_id > 0) {
131 $filter["object"] = $this->book_obj_id;
132 }
133 // coming from participants tab to cancel reservations.
134 if ($_GET['user_id']) {
135 $filter["user_id"] = (int) $_GET['user_id'];
136 }
137 $context_filter = ($this->context_obj_id > 0)
138 ? [$this->context_obj_id]
139 : null;
140
142 $this,
143 'log',
144 $this->ref_id,
145 $this->pool->getId(),
146 $show_all,
147 ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE),
148 $filter,
149 $reservation_id,
150 $context_filter
151 );
152 }

References $_GET, checkPermissionBool(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

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

112 {
115 $table = $this->getReservationsTable();
116 $tpl->setContent($table->getHTML());
117 }
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References $tpl, getReservationsTable(), and showRerunPreferenceAssignment().

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

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

◆ logDetails()

ilBookingReservationsGUI::logDetails ( )

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

156 {
158
159 $this->tabs_gui->clearTargets();
160 $this->tabs_gui->setBackTarget(
161 $this->lng->txt("back"),
162 $this->ctrl->getLinkTarget($this, "log")
163 );
164
165 $table = $this->getReservationsTable($this->reservation_id);
166 $tpl->setContent($table->getHTML());
167 }

References $tpl, and getReservationsTable().

+ Here is the call graph for this function:

◆ resetLogFilter()

ilBookingReservationsGUI::resetLogFilter ( )

Reset filter in reservations table gui.

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

202 {
203 $table = $this->getReservationsTable();
204 $table->resetOffset();
205 $table->resetFilter();
206 $this->log();
207 }

References getReservationsTable(), and log().

+ Here is the call graph for this function:

◆ resetRun()

ilBookingReservationsGUI::resetRun ( )
protected

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

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

References checkPermissionBool(), 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 481 of file class.ilBookingReservationsGUI.php.

482 {
483 $ilUser = $this->user;
486 $ilCtrl = $this->ctrl;
487
488 // simple version of reservation id
489 $ids = $_POST["rsv_id"];
490
491 // aggregated version: determine reservation ids
492 if ($_POST["rsv_aggr"]) {
493 $form = $this->rsvConfirmCancelAggregationForm($_POST["rsv_aggr"]);
494 if (!$form->checkInput()) {
495 $this->tabs_gui->clearTargets();
496 $this->tabs_gui->setBackTarget(
497 $lng->txt("back"),
498 $ilCtrl->getLinkTarget($this, "log")
499 );
500
501 return $tpl->setContent($form->getHTML());
502 }
503
504 $ids = array();
505 foreach ($_POST["rsv_aggr"] as $idx => $aggr_ids) {
506 $max = (int) $_POST["rsv_id_" . $idx];
507 if ($max) {
508 if (!is_array($aggr_ids)) {
509 $ids[] = $aggr_ids;
510 } else {
511 $aggr_ids = array_slice($aggr_ids, 0, $max);
512 $ids = array_merge($ids, $aggr_ids);
513 }
514 }
515 }
516 }
517
518 // for all reservation ids -> set reservation status to cancelled (and remove calendar entry)
519 if ($ids) {
520 foreach ($ids as $id) {
521 $res = new ilBookingReservation($id);
522
523 // either write permission or own booking
524 $cancel_allowed_per_read = ($this->checkPermissionBool("read") && ($res->getUserId() == $ilUser->getId()));
525 $cancel_allowed_per_write = ($this->checkPermissionBool("write"));
526 if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
527 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
528 $this->ctrl->redirect($this, 'log');
529 }
530
532 $res->update();
533
534 if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
535 // remove user calendar entry (#11086)
536 $cal_entry_id = $res->getCalendarEntry();
537 if ($cal_entry_id) {
538 $entry = new ilCalendarEntry($cal_entry_id);
539 $entry->delete();
540 }
541 }
542 }
543 }
544
545 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
546 $this->log();
547 return "";
548 }
rsvConfirmCancelAggregationForm($a_ids)
Form being used in (C2.a)
Model for a calendar entry.
$ilUser
Definition: imgupload.php:18
$lng
foreach($_POST as $key=> $value) $res

References $_POST, $ilUser, $lng, $res, $tpl, checkPermissionBool(), log(), rsvConfirmCancelAggregationForm(), ilUtil\sendFailure(), 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 262 of file class.ilBookingReservationsGUI.php.

263 {
265
266 $id = $this->book_obj_id;
267 $user_id = $this->booked_user;
268
269 if (!$id || !$user_id) {
270 return;
271 }
272
274 $obj = new ilBookingReservation($id);
275 if ($obj->getUserId() != $user_id) {
276 ilUtil::sendFailure($lng->txt('permission_denied'), true);
277 $this->back();
278 }
279
281 $obj->update();
282
283 ilUtil::sendSuccess($lng->txt('settings_saved'), true);
284 $this->back();
285 }
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)

References $lng, back(), ilBookingReservation\getObjectReservationForUser(), ilUtil\sendFailure(), 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 298 of file class.ilBookingReservationsGUI.php.

299 {
300 $ilCtrl = $this->ctrl;
303 $ilUser = $this->user;
304
305 $ids = $this->getLogReservationIds();
306 if (!is_array($ids) || !sizeof($ids)) {
307 $this->back();
308 }
309
310 $max = array();
311 foreach ($ids as $idx => $id) {
312 if (!is_numeric($id)) {
313 list($obj_id, $user_id, $from, $to) = explode("_", $id);
314
315 $valid_ids = array();
316 foreach (ilBookingObject::getList($this->pool->getId()) as $item) {
317 $valid_ids[$item["booking_object_id"]] = $item["title"];
318 }
319
320 if (($this->checkPermissionBool("write") || $user_id == $ilUser->getId()) &&
321 $from > time() &&
322 in_array($obj_id, array_keys($valid_ids))) {
323 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
324 if (!sizeof($rsv_ids)) {
325 unset($ids[$idx]);
326 }
327 if (sizeof($rsv_ids) > 1) {
328 $max[$id] = sizeof($rsv_ids);
329 $ids[$idx] = $rsv_ids;
330 } else {
331 // only 1 in group? treat as normal reservation
332 $ids[$idx] = array_shift($rsv_ids);
333 }
334 } else {
335 unset($ids[$idx]);
336 }
337 }
338 }
339
340 if (!is_array($ids) || !sizeof($ids)) {
341 $this->ctrl->redirect($this, 'log');
342 }
343
344 // show form instead
345 if (sizeof($max) && max($max) > 1) {
346 $this->rsvConfirmCancelAggregation($ids);
347 return;
348 }
349
350 $this->tabs_gui->clearTargets();
351 $this->tabs_gui->setBackTarget(
352 $lng->txt("back"),
353 $ilCtrl->getLinkTargetByClass("ilBookingReservationsGUI", "")
354 );
355
356 $this->setHelpId("cancel_booking");
357
358 $conf = new ilConfirmationGUI();
359 $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
360 $conf->setHeaderText($lng->txt('book_confirm_cancel'));
361 $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
362 $conf->setCancel($lng->txt('cancel'), 'back');
363
364 foreach ($ids as $id) {
365 $rsv = new ilBookingReservation($id);
366 $obj = new ilBookingObject($rsv->getObjectId());
367
368 $details = $obj->getTitle();
369 if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
370 $details .= ", " . ilDatePresentation::formatPeriod(
371 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
372 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
373 );
374 }
375
376 $conf->addItem('rsv_id[]', $id, $details);
377 }
378
379 $tpl->setContent($conf->getHTML());
380 }
const IL_CAL_UNIX
a bookable ressource
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
rsvConfirmCancelAggregation(array $a_ids=null)
(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2)
getLogReservationIds()
Reservations IDs as currently provided from.
Confirmation screen class.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling

References $ilUser, $lng, $tpl, back(), checkPermissionBool(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), getLogReservationIds(), IL_CAL_UNIX, rsvConfirmCancelAggregation(), setHelpId(), 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)

Parameters
array | null$a_ids

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

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 ilUtil::sendQuestion($lng->txt("book_confirm_cancel"));
404
405 $form = $this->rsvConfirmCancelAggregationForm($a_ids);
406
407 $tpl->setContent($form->getHTML());
408 }
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.

References $lng, $tpl, rsvConfirmCancelAggregationForm(), ilUtil\sendQuestion(), and setHelpId().

Referenced by rsvConfirmCancel().

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

◆ rsvConfirmCancelAggregationForm()

ilBookingReservationsGUI::rsvConfirmCancelAggregationForm (   $a_ids)

Form being used in (C2.a)

Parameters
$a_ids
Returns
ilPropertyFormGUI

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

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

References $_POST, ilDatePresentation\formatPeriod(), IL_CAL_UNIX, and ilDatePresentation\setUseRelativeDates().

Referenced by rsvCancel(), and rsvConfirmCancelAggregation().

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

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

References $lng, $tpl, $type, and setHelpId().

+ Here is the call graph for this function:

◆ rsvConfirmDelete()

ilBookingReservationsGUI::rsvConfirmDelete ( )

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

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

References $DIC, back(), checkPermissionBool(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), getLogReservationIds(), IL_CAL_UNIX, ilUtil\sendFailure(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

+ Here is the call graph for this function:

◆ rsvDelete()

ilBookingReservationsGUI::rsvDelete ( )

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

603 {
604 global $DIC;
605 $get = $DIC->http()->request()->getParsedBody()['mrsv'];
606 if ($get) {
607 foreach ($get as $id) {
608 if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
609 list($obj_id, $user_id, $from, $to) = explode("_", $id);
610 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
611 } else {
612 $rsv_ids = [$id];
613 }
614 foreach ($rsv_ids as $rsv_id) {
615 $res = new ilBookingReservation($rsv_id);
616 $obj = new ilBookingObject($res->getObjectId());
617 if ($obj->getPoolId() != $this->pool->getId() || !$this->checkPermissionBool("write")) {
618 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
619 $this->ctrl->redirect($this, 'log');
620 }
621 if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
622 $cal_entry_id = $res->getCalendarEntry();
623 if ($cal_entry_id) {
624 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
625 $entry = new ilCalendarEntry($cal_entry_id);
626 $entry->delete();
627 }
628 }
629 $res->delete();
630 }
631 }
632 }
633 ilUtil::sendSuccess($this->lng->txt('reservation_deleted'), true);
634 $this->ctrl->redirect($this, 'log');
635 }

References $DIC, $res, ilBookingReservation\getCancelDetails(), ilUtil\sendFailure(), ilObjBookingPool\TYPE_FIX_SCHEDULE, and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ setHelpId()

ilBookingReservationsGUI::setHelpId ( string  $a_id)
protected
Parameters
string$a_id

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

104 {
105 $this->help->setHelpId($a_id);
106 }

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

637 : void
638 {
639 if (!$this->checkPermissionBool('write')) {
640 return;
641 }
642 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
643 $pref_manager = $this->service->domain()->preferences($this->pool);
644 if ($pref_manager->hasRun()) {
645 $this->toolbar->addComponent($this->ui->factory()->button()->standard(
646 $this->lng->txt("book_rerun_assignments"),
647 $this->ctrl->getLinkTarget($this, "confirmResetRun")
648 ));
649 }
650 }
651 }

References checkPermissionBool(), ilObjBookingPool\TYPE_NO_SCHEDULE_PREFERENCES, and ui().

Referenced by log().

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

Field Documentation

◆ $context_obj_id

ilBookingReservationsGUI::$context_obj_id
protected

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

Referenced by __construct().

◆ $help

ilBookingReservationsGUI::$help
protected

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

Referenced by __construct().


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