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();
44 $this->book_obj_id = (int) $_REQUEST[
'object_id'];
49 $this->booked_user = (int) $_REQUEST[
'bkusr'];
50 if ($this->booked_user == 0) {
51 $this->booked_user =
$DIC->user()->getId();
56 $this->ctrl->saveParameter($this, [
"object_id",
"bkusr"]);
59 throw new ilException(
"Booking Object ID does not match Booking Pool.");
69 if (is_array(
$_POST[
"mrsv"])) {
71 } elseif ($this->reservation_id > 0) {
72 return array($this->reservation_id);
85 $next_class = $ctrl->getNextClass($this);
86 $cmd = $ctrl->getCmd(
"log");
88 switch ($next_class) {
90 if (in_array($cmd, array(
"log",
"logDetails",
"changeStatusObject",
"rsvConfirmCancelUser",
"rsvCancelUser",
91 "applyLogFilter",
"resetLogFilter",
"rsvConfirmCancel",
"rsvCancel",
"back",
"rsvConfirmDelete",
"rsvDelete"))) {
102 $this->
help->setHelpId($a_id);
112 $tpl->setContent($table->getHTML());
126 if ($this->book_obj_id > 0) {
127 $filter[
"object"] = $this->book_obj_id;
130 if (
$_GET[
'user_id']) {
131 $filter[
"user_id"] = (int)
$_GET[
'user_id'];
133 $context_filter = ($this->context_obj_id > 0)
134 ? [$this->context_obj_id]
141 $this->pool->getId(),
155 $this->tabs_gui->clearTargets();
156 $this->tabs_gui->setBackTarget(
157 $this->lng->txt(
"back"),
158 $this->ctrl->getLinkTarget($this,
"log")
162 $tpl->setContent($table->getHTML());
170 if (!
$_POST[
'reservation_id']) {
179 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
180 $this->ctrl->redirect($this,
'log');
189 $table->resetOffset();
190 $table->writeFilterToSession();
200 $table->resetOffset();
201 $table->resetFilter();
213 $ilAccess = $this->access;
215 return $ilAccess->checkAccess($a_perm,
"", $this->ref_id);
236 $id = $this->book_obj_id;
244 $conf->setFormAction(
$ilCtrl->getFormAction($this));
245 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
248 $conf->addItem(
'object_id', $id,
$type->getTitle());
249 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancelUser');
250 $conf->setCancel(
$lng->txt(
'cancel'),
'back');
252 $tpl->setContent($conf->getHTML());
262 $id = $this->book_obj_id;
263 $user_id = $this->booked_user;
265 if (!$id || !$user_id) {
271 if ($obj->getUserId() != $user_id) {
279 ilUtil::sendSuccess(
$lng->txt(
'settings_saved'),
true);
288 $this->ctrl->redirect($this,
"log");
302 if (!is_array($ids) || !
sizeof($ids)) {
307 foreach ($ids as $idx => $id) {
308 if (!is_numeric($id)) {
309 list($obj_id, $user_id, $from, $to) = explode(
"_", $id);
311 $valid_ids = array();
313 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
318 in_array($obj_id, array_keys($valid_ids))) {
320 if (!
sizeof($rsv_ids)) {
323 if (
sizeof($rsv_ids) > 1) {
324 $max[$id] =
sizeof($rsv_ids);
325 $ids[$idx] = $rsv_ids;
328 $ids[$idx] = array_shift($rsv_ids);
336 if (!is_array($ids) || !
sizeof($ids)) {
337 $this->ctrl->redirect($this,
'log');
341 if (
sizeof($max) && max($max) > 1) {
346 $this->tabs_gui->clearTargets();
347 $this->tabs_gui->setBackTarget(
349 $ilCtrl->getLinkTargetByClass(
"ilBookingReservationsGUI",
"")
355 $conf->setFormAction(
$ilCtrl->getFormAction($this,
'rsvCancel'));
356 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
357 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancel');
358 $conf->setCancel(
$lng->txt(
'cancel'),
'back');
360 foreach ($ids as $id) {
364 $details = $obj->getTitle();
372 $conf->addItem(
'rsv_id[]', $id, $details);
375 $tpl->setContent($conf->getHTML());
390 $this->tabs_gui->clearTargets();
391 $this->tabs_gui->setBackTarget(
393 $ilCtrl->getLinkTarget($this,
"log")
403 $tpl->setContent($form->getHTML());
415 $form->setFormAction($this->ctrl->getFormAction($this,
"rsvCancel"));
416 $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
420 foreach ($a_ids as $idx => $ids) {
421 if (is_array($ids)) {
423 $first = array_shift($first);
437 if (is_array($ids)) {
438 $caption .=
" (" .
sizeof($ids) .
")";
442 $item->setRequired(
true);
443 $item->setMinValue(0);
445 $form->addItem($item);
447 if (is_array($ids)) {
448 $item->setMaxValue(
sizeof($ids));
450 foreach ($ids as $id) {
452 $hidden->setValue($id);
453 $form->addItem($hidden);
456 $item->setMaxValue(1);
459 $hidden->setValue($ids);
460 $form->addItem($hidden);
463 if (
$_POST[
"rsv_id_" . $idx]) {
464 $item->setValue((
int)
$_POST[
"rsv_id_" . $idx]);
468 $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
469 $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));
490 if (!$form->checkInput()) {
491 $this->tabs_gui->clearTargets();
492 $this->tabs_gui->setBackTarget(
494 $ilCtrl->getLinkTarget($this,
"log")
497 return $tpl->setContent($form->getHTML());
501 foreach (
$_POST[
"rsv_aggr"] as $idx => $aggr_ids) {
502 $max = (int)
$_POST[
"rsv_id_" . $idx];
504 if (!is_array($aggr_ids)) {
507 $aggr_ids = array_slice($aggr_ids, 0, $max);
508 $ids = array_merge($ids, $aggr_ids);
516 foreach ($ids as $id) {
522 if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
524 $this->ctrl->redirect($this,
'log');
532 $cal_entry_id =
$res->getCalendarEntry();
541 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
551 $this->ctrl->redirect($this,
'log');
554 $this->tabs_gui->clearTargets();
555 $this->tabs_gui->setBackTarget(
556 $this->lng->txt(
"back"),
557 $this->ctrl->getLinkTarget($this,
"log")
561 $conf->setFormAction($this->ctrl->getFormAction($this,
'rsvDelete'));
562 $conf->setHeaderText($this->lng->txt(
'book_confirm_delete'));
563 $conf->setConfirm($this->lng->txt(
'book_set_delete'),
'rsvDelete');
564 $conf->setCancel($this->lng->txt(
'cancel'),
'log');
567 list($obj_id, $user_id, $from, $to) = explode(
"_",
568 $DIC->http()->request()->getQueryParams()[
'reservation_id']);
572 $rsv_id =
$DIC->http()->request()->getQueryParams()[
'reservation_id'];
578 $details = sprintf($this->lng->txt(
'X_reservations_of'), count($ids)) .
' ' . $obj->getTitle();
586 $conf->addItem(
'rsv_ids', implode(
',', $ids), $details);
587 $this->tpl->setContent($conf->getHTML());
593 $get =
$DIC->http()->request()->getParsedBody()[
'rsv_ids'];
595 foreach (explode(
',', $get) as $id) {
598 if ($obj->getPoolId() != $this->pool->getId() || !$this->checkPermissionBool(
"write")) {
600 $this->ctrl->redirect($this,
'log');
603 $cal_entry_id =
$res->getCalendarEntry();
605 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
613 ilUtil::sendSuccess($this->lng->txt(
'reservation_deleted'),
true);
614 $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)
__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
Base class for ILIAS Exception handling.
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
foreach($_POST as $key=> $value) $res
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl