34 $this->tpl =
$DIC->ui()->mainTemplate();
36 $this->ctrl =
$DIC->ctrl();
38 $this->lng =
$DIC->language();
39 $this->access =
$DIC->access();
40 $this->tabs_gui =
$DIC->tabs();
42 $this->
user = $DIC->user();
43 $this->service =
$DIC->bookingManager()->internal();
44 $this->
ui = $DIC->ui();
45 $this->toolbar =
$DIC->toolbar();
47 $this->book_obj_id = (int) $_REQUEST[
'object_id'];
52 $this->booked_user = (int) $_REQUEST[
'bkusr'];
53 if ($this->booked_user == 0) {
54 $this->booked_user =
$DIC->user()->getId();
59 $this->ctrl->saveParameter($this, [
"object_id",
"bkusr"]);
62 throw new ilException(
"Booking Object ID does not match Booking Pool.");
72 if (is_array(
$_POST[
"mrsv"])) {
74 } elseif ($this->reservation_id > 0) {
75 return array($this->reservation_id);
88 $next_class = $ctrl->getNextClass($this);
89 $cmd = $ctrl->getCmd(
"log");
91 switch ($next_class) {
93 if (in_array($cmd, array(
"log",
"logDetails",
"changeStatusObject",
"rsvConfirmCancelUser",
"rsvCancelUser",
94 "applyLogFilter",
"resetLogFilter",
"rsvConfirmCancel",
"rsvCancel",
"back",
"rsvConfirmDelete",
"rsvDelete",
"confirmResetRun",
"resetRun"))) {
105 $this->
help->setHelpId($a_id);
116 $tpl->setContent($table->getHTML());
130 if ($this->book_obj_id > 0) {
131 $filter[
"object"] = $this->book_obj_id;
134 if (
$_GET[
'user_id']) {
135 $filter[
"user_id"] = (int)
$_GET[
'user_id'];
137 $context_filter = ($this->context_obj_id > 0)
138 ? [$this->context_obj_id]
145 $this->pool->getId(),
159 $this->tabs_gui->clearTargets();
160 $this->tabs_gui->setBackTarget(
161 $this->lng->txt(
"back"),
162 $this->ctrl->getLinkTarget($this,
"log")
166 $tpl->setContent($table->getHTML());
174 if (!
$_POST[
'reservation_id']) {
183 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
184 $this->ctrl->redirect($this,
'log');
193 $table->resetOffset();
194 $table->writeFilterToSession();
204 $table->resetOffset();
205 $table->resetFilter();
217 $ilAccess = $this->access;
219 return $ilAccess->checkAccess($a_perm,
"", $this->ref_id);
237 $ilCtrl = $this->ctrl;
240 $id = $this->book_obj_id;
248 $conf->setFormAction($ilCtrl->getFormAction($this));
249 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
252 $conf->addItem(
'object_id', $id,
$type->getTitle());
253 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancelUser');
254 $conf->setCancel(
$lng->txt(
'cancel'),
'back');
256 $tpl->setContent($conf->getHTML());
266 $id = $this->book_obj_id;
267 $user_id = $this->booked_user;
269 if (!$id || !$user_id) {
275 if ($obj->getUserId() != $user_id) {
283 ilUtil::sendSuccess(
$lng->txt(
'settings_saved'),
true);
292 $this->ctrl->redirect($this,
"log");
300 $ilCtrl = $this->ctrl;
306 if (!is_array($ids) || !
sizeof($ids)) {
311 foreach ($ids as $idx => $id) {
312 if (!is_numeric($id)) {
313 list($obj_id, $user_id, $from, $to) = explode(
"_", $id);
315 $valid_ids = array();
317 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
322 in_array($obj_id, array_keys($valid_ids))) {
324 if (!
sizeof($rsv_ids)) {
327 if (
sizeof($rsv_ids) > 1) {
328 $max[$id] =
sizeof($rsv_ids);
329 $ids[$idx] = $rsv_ids;
332 $ids[$idx] = array_shift($rsv_ids);
340 if (!is_array($ids) || !
sizeof($ids)) {
341 $this->ctrl->redirect($this,
'log');
345 if (
sizeof($max) && max($max) > 1) {
350 $this->tabs_gui->clearTargets();
351 $this->tabs_gui->setBackTarget(
353 $ilCtrl->getLinkTargetByClass(
"ilBookingReservationsGUI",
"")
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');
364 foreach ($ids as $id) {
368 $details = $obj->getTitle();
376 $conf->addItem(
'rsv_id[]', $id, $details);
379 $tpl->setContent($conf->getHTML());
391 $ilCtrl = $this->ctrl;
394 $this->tabs_gui->clearTargets();
395 $this->tabs_gui->setBackTarget(
397 $ilCtrl->getLinkTarget($this,
"log")
407 $tpl->setContent($form->getHTML());
419 $form->setFormAction($this->ctrl->getFormAction($this,
"rsvCancel"));
420 $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
424 foreach ($a_ids as $idx => $ids) {
425 if (is_array($ids)) {
427 $first = array_shift($first);
441 if (is_array($ids)) {
442 $caption .=
" (" .
sizeof($ids) .
")";
446 $item->setRequired(
true);
447 $item->setMinValue(0);
449 $form->addItem($item);
451 if (is_array($ids)) {
452 $item->setMaxValue(
sizeof($ids));
454 foreach ($ids as $id) {
456 $hidden->setValue($id);
457 $form->addItem($hidden);
460 $item->setMaxValue(1);
463 $hidden->setValue($ids);
464 $form->addItem($hidden);
467 if (
$_POST[
"rsv_id_" . $idx]) {
468 $item->setValue((
int)
$_POST[
"rsv_id_" . $idx]);
472 $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
473 $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));
486 $ilCtrl = $this->ctrl;
494 if (!$form->checkInput()) {
495 $this->tabs_gui->clearTargets();
496 $this->tabs_gui->setBackTarget(
498 $ilCtrl->getLinkTarget($this,
"log")
501 return $tpl->setContent($form->getHTML());
505 foreach (
$_POST[
"rsv_aggr"] as $idx => $aggr_ids) {
506 $max = (int)
$_POST[
"rsv_id_" . $idx];
508 if (!is_array($aggr_ids)) {
511 $aggr_ids = array_slice($aggr_ids, 0, $max);
512 $ids = array_merge($ids, $aggr_ids);
520 foreach ($ids as $id) {
526 if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
528 $this->ctrl->redirect($this,
'log');
536 $cal_entry_id =
$res->getCalendarEntry();
545 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
555 $this->ctrl->redirect($this,
'log');
559 if (!is_array($ids) || !
sizeof($ids)) {
563 $this->tabs_gui->clearTargets();
564 $this->tabs_gui->setBackTarget(
565 $this->lng->txt(
"back"),
566 $this->ctrl->getLinkTarget($this,
"log")
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');
576 foreach ($ids as $idx => $id) {
577 list($obj_id, $user_id, $from, $to) = explode(
"_", $id);
579 $rsv_id = $rsv_ids[0];
584 $details = sprintf($this->lng->txt(
'X_reservations_of'), count($rsv_ids)) .
' ' . $obj->getTitle();
589 $conf->addItem(
'mrsv[]', $id, $details);
592 foreach ($ids as $idx => $rsv_id) {
595 $details = sprintf($this->lng->txt(
'X_reservations_of'), 1) .
' ' . $obj->getTitle();
596 $conf->addItem(
'mrsv[]', $rsv_id, $details);
599 $this->tpl->setContent($conf->getHTML());
605 $get =
$DIC->http()->request()->getParsedBody()[
'mrsv'];
607 foreach ($get as $id) {
609 list($obj_id, $user_id, $from, $to) = explode(
"_", $id);
614 foreach ($rsv_ids as $rsv_id) {
617 if ($obj->getPoolId() != $this->pool->getId() || !$this->checkPermissionBool(
"write")) {
619 $this->ctrl->redirect($this,
'log');
622 $cal_entry_id =
$res->getCalendarEntry();
624 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
633 ilUtil::sendSuccess($this->lng->txt(
'reservation_deleted'),
true);
634 $this->ctrl->redirect($this,
'log');
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")
658 $this->tabs_gui->activateTab(
"log");
659 $mess = $this->
ui->factory()->messageBox()->confirmation($this->lng->txt(
"book_rerun_confirmation"))->withButtons(
661 $this->
ui->factory()->button()->standard(
662 $this->lng->txt(
"book_rerun_assignments"),
663 $this->ctrl->getLinkTarget($this,
"resetRun")
665 $this->ui->factory()->button()->standard(
666 $this->lng->txt(
"cancel"),
667 $this->ctrl->getLinkTarget($this,
"log")
671 $this->tpl->setContent(
672 $this->
ui->renderer()->render($mess)
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())
690 $this->ctrl->redirect($this,
"log");
An exception for terminatinating execution or to throw for unit testing.
Help adapter for booking manager.
static lookupPoolId($object_id)
Lookup pool id.
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static changeStatus(array $a_ids, $a_status)
Batch update reservation status.
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
rsvCancel()
(C2.b) Cancel reservations (coming from C2 or C2.a)
rsvConfirmCancelAggregation(array $a_ids=null)
(C2.a) Cancel aggregated booking from reservations screen (with and without schedule) called in (C2)
checkPermissionBool($a_perm)
Check permission.
rsvCancelUser()
(C1.a) Confirmed (C1)
rsvConfirmCancelAggregationForm($a_ids)
Form being used in (C2.a)
back()
Back to reservation list.
rsvConfirmCancelUser()
(C1) Confirmation screen for canceling booking without schedule from booking objects screen or from p...
executeCommand()
Execute command.
getReservationsTable($reservation_id=null)
Get reservationsTable.
getLogReservationIds()
Reservations IDs as currently provided from.
changeStatusObject()
Change status of given reservations.
resetLogFilter()
Reset filter in reservations table gui.
rsvConfirmCancel()
(C2) Confirmation screen for canceling booking from reservations screen (with and without schedule)
showRerunPreferenceAssignment()
__construct(ilObjBookingPool $pool, ilBookingHelpAdapter $help, int $context_obj_id=0)
ilBookingReservationsGUI constructor.
applyLogFilter()
Apply filter from reservations table gui.
Model for a calendar entry.
Confirmation screen class.
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NO_SCHEDULE_PREFERENCES
getRefId()
get reference id @access public
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
foreach($_POST as $key=> $value) $res