ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 

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.

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

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 
44  $this->book_obj_id = (int) $_REQUEST['object_id'];
45 
46  $this->context_obj_id = $context_obj_id;
47 
48  // user who's reservation is being tackled (e.g. canceled)
49  $this->booked_user = (int) $_REQUEST['bkusr'];
50  if ($this->booked_user == 0) {
51  $this->booked_user = $DIC->user()->getId();
52  }
53  // we get this from the reservation screen
54  $this->reservation_id = ilUtil::stripSlashes($_GET["reservation_id"]);
55 
56  $this->ctrl->saveParameter($this, ["object_id", "bkusr"]);
57 
58  if ((int) $_REQUEST['object_id'] > 0 && ilBookingObject::lookupPoolId((int) $_REQUEST['object_id']) != $this->pool->getId()) {
59  throw new ilException("Booking Object ID does not match Booking Pool.");
60  }
61  }
$_GET["client_id"]
user()
Definition: user.php:4
help()
Definition: help.php:2
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static lookupPoolId($object_id)
Lookup pool id.
$DIC
Definition: xapitoken.php:46
getRefId()
get reference id public
+ Here is the call graph for this function:

Member Function Documentation

◆ applyLogFilter()

ilBookingReservationsGUI::applyLogFilter ( )

Apply filter from reservations table gui.

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

References getReservationsTable(), and log().

187  {
188  $table = $this->getReservationsTable();
189  $table->resetOffset();
190  $table->writeFilterToSession();
191  $this->log();
192  }
getReservationsTable($reservation_id=null)
Get reservationsTable.
+ Here is the call graph for this function:

◆ back()

ilBookingReservationsGUI::back ( )
protected

Back to reservation list.

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

Referenced by rsvCancelUser(), and rsvConfirmCancel().

287  {
288  $this->ctrl->redirect($this, "log");
289  }
+ Here is the caller graph for this function:

◆ changeStatusObject()

ilBookingReservationsGUI::changeStatusObject ( )

Change status of given reservations.

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

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

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

◆ checkPermissionBool()

ilBookingReservationsGUI::checkPermissionBool (   $a_perm)
protected

Check permission.

Parameters
$a_perm
Returns
mixed

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

Referenced by changeStatusObject(), getReservationsTable(), rsvCancel(), rsvConfirmCancel(), rsvConfirmDelete(), and rsvDelete().

212  {
213  $ilAccess = $this->access;
214 
215  return $ilAccess->checkAccess($a_perm, "", $this->ref_id);
216  }
+ Here is the caller graph for this function:

◆ executeCommand()

ilBookingReservationsGUI::executeCommand ( )

Execute command.

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

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

◆ getLogReservationIds()

ilBookingReservationsGUI::getLogReservationIds ( )
protected

Reservations IDs as currently provided from.

Returns
array

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

References $_POST.

Referenced by rsvConfirmCancel().

68  {
69  if (is_array($_POST["mrsv"])) {
70  return $_POST["mrsv"];
71  } elseif ($this->reservation_id > 0) {
72  return array($this->reservation_id);
73  }
74  return [];
75  }
$_POST["username"]
+ 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 121 of file class.ilBookingReservationsGUI.php.

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

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

122  {
123  $show_all = ($this->checkPermissionBool('write') || $this->pool->hasPublicLog());
124 
125  $filter = null;
126  if ($this->book_obj_id > 0) {
127  $filter["object"] = $this->book_obj_id;
128  }
129  // coming from participants tab to cancel reservations.
130  if ($_GET['user_id']) {
131  $filter["user_id"] = (int) $_GET['user_id'];
132  }
133  $context_filter = ($this->context_obj_id > 0)
134  ? [$this->context_obj_id]
135  : null;
136 
138  $this,
139  'log',
140  $this->ref_id,
141  $this->pool->getId(),
142  $show_all,
143  ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE),
144  $filter,
145  $reservation_id,
146  $context_filter
147  );
148  }
$_GET["client_id"]
checkPermissionBool($a_perm)
Check permission.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log()

ilBookingReservationsGUI::log ( )

List reservations.

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

References $tpl, and getReservationsTable().

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

109  {
110  $tpl = $this->tpl;
111  $table = $this->getReservationsTable();
112  $tpl->setContent($table->getHTML());
113  }
getReservationsTable($reservation_id=null)
Get reservationsTable.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logDetails()

ilBookingReservationsGUI::logDetails ( )

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

References $tpl, and getReservationsTable().

152  {
153  $tpl = $this->tpl;
154 
155  $this->tabs_gui->clearTargets();
156  $this->tabs_gui->setBackTarget(
157  $this->lng->txt("back"),
158  $this->ctrl->getLinkTarget($this, "log")
159  );
160 
161  $table = $this->getReservationsTable($this->reservation_id);
162  $tpl->setContent($table->getHTML());
163  }
getReservationsTable($reservation_id=null)
Get reservationsTable.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:

◆ resetLogFilter()

ilBookingReservationsGUI::resetLogFilter ( )

Reset filter in reservations table gui.

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

References getReservationsTable(), and log().

198  {
199  $table = $this->getReservationsTable();
200  $table->resetOffset();
201  $table->resetFilter();
202  $this->log();
203  }
getReservationsTable($reservation_id=null)
Get reservationsTable.
+ 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.

References $_POST, $ilCtrl, $ilUser, $lng, $res, $tpl, checkPermissionBool(), log(), rsvConfirmCancelAggregationForm(), ilUtil\sendFailure(), ilBookingReservation\STATUS_CANCELLED, and ilObjBookingPool\TYPE_NO_SCHEDULE.

478  {
479  $ilUser = $this->user;
480  $tpl = $this->tpl;
481  $lng = $this->lng;
482  $ilCtrl = $this->ctrl;
483 
484  // simple version of reservation id
485  $ids = $_POST["rsv_id"];
486 
487  // aggregated version: determine reservation ids
488  if ($_POST["rsv_aggr"]) {
489  $form = $this->rsvConfirmCancelAggregationForm($_POST["rsv_aggr"]);
490  if (!$form->checkInput()) {
491  $this->tabs_gui->clearTargets();
492  $this->tabs_gui->setBackTarget(
493  $lng->txt("back"),
494  $ilCtrl->getLinkTarget($this, "log")
495  );
496 
497  return $tpl->setContent($form->getHTML());
498  }
499 
500  $ids = array();
501  foreach ($_POST["rsv_aggr"] as $idx => $aggr_ids) {
502  $max = (int) $_POST["rsv_id_" . $idx];
503  if ($max) {
504  if (!is_array($aggr_ids)) {
505  $ids[] = $aggr_ids;
506  } else {
507  $aggr_ids = array_slice($aggr_ids, 0, $max);
508  $ids = array_merge($ids, $aggr_ids);
509  }
510  }
511  }
512  }
513 
514  // for all reservation ids -> set reservation status to cancelled (and remove calendar entry)
515  if ($ids) {
516  foreach ($ids as $id) {
517  $res = new ilBookingReservation($id);
518 
519  // either write permission or own booking
520  $cancel_allowed_per_read = ($this->checkPermissionBool("read") && ($res->getUserId() == $ilUser->getId()));
521  $cancel_allowed_per_write = ($this->checkPermissionBool("write"));
522  if (!$cancel_allowed_per_read && !$cancel_allowed_per_write) {
523  ilUtil::sendFailure($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  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
542  $this->log();
543  return "";
544  }
Model for a calendar entry.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
checkPermissionBool($a_perm)
Check permission.
global $ilCtrl
Definition: ilias.php:18
foreach($_POST as $key=> $value) $res
$lng
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
rsvConfirmCancelAggregationForm($a_ids)
Form being used in (C2.a)
+ Here is the call graph for this function:

◆ rsvCancelUser()

ilBookingReservationsGUI::rsvCancelUser ( )

(C1.a) Confirmed (C1)

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

References $lng, back(), ilBookingReservation\getObjectReservationForUser(), ilUtil\sendFailure(), and ilBookingReservation\STATUS_CANCELLED.

259  {
260  $lng = $this->lng;
261 
262  $id = $this->book_obj_id;
263  $user_id = $this->booked_user;
264 
265  if (!$id || !$user_id) {
266  return;
267  }
268 
270  $obj = new ilBookingReservation($id);
271  if ($obj->getUserId() != $user_id) {
272  ilUtil::sendFailure($lng->txt('permission_denied'), true);
273  $this->back();
274  }
275 
277  $obj->update();
278 
279  ilUtil::sendSuccess($lng->txt('settings_saved'), true);
280  $this->back();
281  }
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
$lng
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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 294 of file class.ilBookingReservationsGUI.php.

References $ilCtrl, $ilUser, $lng, $tpl, back(), checkPermissionBool(), ilDatePresentation\formatPeriod(), ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), getLogReservationIds(), ilBookingObject\getTitle(), IL_CAL_UNIX, rsvConfirmCancelAggregation(), setHelpId(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

295  {
296  $ilCtrl = $this->ctrl;
297  $lng = $this->lng;
298  $tpl = $this->tpl;
299  $ilUser = $this->user;
300 
301  $ids = $this->getLogReservationIds();
302  if (!is_array($ids) || !sizeof($ids)) {
303  $this->back();
304  }
305 
306  $max = array();
307  foreach ($ids as $idx => $id) {
308  if (!is_numeric($id)) {
309  list($obj_id, $user_id, $from, $to) = explode("_", $id);
310 
311  $valid_ids = array();
312  foreach (ilBookingObject::getList($this->pool->getId()) as $item) {
313  $valid_ids[$item["booking_object_id"]] = $item["title"];
314  }
315 
316  if (($this->checkPermissionBool("write") || $user_id == $ilUser->getId()) &&
317  $from > time() &&
318  in_array($obj_id, array_keys($valid_ids))) {
319  $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
320  if (!sizeof($rsv_ids)) {
321  unset($ids[$idx]);
322  }
323  if (sizeof($rsv_ids) > 1) {
324  $max[$id] = sizeof($rsv_ids);
325  $ids[$idx] = $rsv_ids;
326  } else {
327  // only 1 in group? treat as normal reservation
328  $ids[$idx] = array_shift($rsv_ids);
329  }
330  } else {
331  unset($ids[$idx]);
332  }
333  }
334  }
335 
336  if (!is_array($ids) || !sizeof($ids)) {
337  $this->ctrl->redirect($this, 'log');
338  }
339 
340  // show form instead
341  if (sizeof($max) && max($max) > 1) {
342  $this->rsvConfirmCancelAggregation($ids);
343  return;
344  }
345 
346  $this->tabs_gui->clearTargets();
347  $this->tabs_gui->setBackTarget(
348  $lng->txt("back"),
349  $ilCtrl->getLinkTargetByClass("ilBookingReservationsGUI", "")
350  );
351 
352  $this->setHelpId("cancel_booking");
353 
354  $conf = new ilConfirmationGUI();
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');
359 
360  foreach ($ids as $id) {
361  $rsv = new ilBookingReservation($id);
362  $obj = new ilBookingObject($rsv->getObjectId());
363 
364  $details = $obj->getTitle();
365  if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
366  $details .= ", " . ilDatePresentation::formatPeriod(
367  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
368  new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
369  );
370  }
371 
372  $conf->addItem('rsv_id[]', $id, $details);
373  }
374 
375  $tpl->setContent($conf->getHTML());
376  }
a bookable ressource
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
checkPermissionBool($a_perm)
Check permission.
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
getLogReservationIds()
Reservations IDs as currently provided from.
getTitle()
Get object title.
$lng
$ilUser
Definition: imgupload.php:18
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
Confirmation screen class.
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)

Parameters
array | null$a_ids

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

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

Referenced by rsvConfirmCancel().

385  {
386  $tpl = $this->tpl;
387  $ilCtrl = $this->ctrl;
388  $lng = $this->lng;
389 
390  $this->tabs_gui->clearTargets();
391  $this->tabs_gui->setBackTarget(
392  $lng->txt("back"),
393  $ilCtrl->getLinkTarget($this, "log")
394  );
395 
396  $this->setHelpId("cancel_booking");
397 
398  // #13511
399  ilUtil::sendQuestion($lng->txt("book_confirm_cancel"));
400 
401  $form = $this->rsvConfirmCancelAggregationForm($a_ids);
402 
403  $tpl->setContent($form->getHTML());
404  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilCtrl
Definition: ilias.php:18
$lng
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
rsvConfirmCancelAggregationForm($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 (   $a_ids)

Form being used in (C2.a)

Parameters
$a_ids
Returns
ilPropertyFormGUI

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

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

Referenced by rsvCancel(), and rsvConfirmCancelAggregation().

413  {
414  $form = new ilPropertyFormGUI();
415  $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
416  $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
417 
419 
420  foreach ($a_ids as $idx => $ids) {
421  if (is_array($ids)) {
422  $first = $ids;
423  $first = array_shift($first);
424  } else {
425  $first = $ids;
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 .= " (" . sizeof($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(sizeof($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 ($_POST["rsv_id_" . $idx]) {
464  $item->setValue((int) $_POST["rsv_id_" . $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  }
a bookable ressource
This class represents a property form user interface.
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
This class represents a hidden form property in a property form.
getTitle()
Get object title.
This class represents a number property in a property form.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$_POST["username"]
+ 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 231 of file class.ilBookingReservationsGUI.php.

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

232  {
233  $ilCtrl = $this->ctrl;
234  $lng = $this->lng;
235  $tpl = $this->tpl;
236  $id = $this->book_obj_id;
237  if (!$id) {
238  return;
239  }
240 
241  $this->setHelpId("cancel_booking");
242 
243  $conf = new ilConfirmationGUI();
244  $conf->setFormAction($ilCtrl->getFormAction($this));
245  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
246 
247  $type = new ilBookingObject($id);
248  $conf->addItem('object_id', $id, $type->getTitle());
249  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
250  $conf->setCancel($lng->txt('cancel'), 'back');
251 
252  $tpl->setContent($conf->getHTML());
253  }
a bookable ressource
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$type
global $ilCtrl
Definition: ilias.php:18
$lng
Confirmation screen class.
+ Here is the call graph for this function:

◆ rsvConfirmDelete()

ilBookingReservationsGUI::rsvConfirmDelete ( )

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

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

547  {
548  global $DIC;
549  if (!$this->checkPermissionBool("write")) {
550  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
551  $this->ctrl->redirect($this, 'log');
552  }
553 
554  $this->tabs_gui->clearTargets();
555  $this->tabs_gui->setBackTarget(
556  $this->lng->txt("back"),
557  $this->ctrl->getLinkTarget($this, "log")
558  );
559 
560  $conf = new ilConfirmationGUI();
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');
565 
566  if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
567  list($obj_id, $user_id, $from, $to) = explode("_",
568  $DIC->http()->request()->getQueryParams()['reservation_id']);
569  $ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
570  $rsv_id = $ids[0];
571  } else {
572  $rsv_id = $DIC->http()->request()->getQueryParams()['reservation_id'];
573  $ids = [$rsv_id];
574  }
575  $rsv = new ilBookingReservation($rsv_id);
576  $obj = new ilBookingObject($rsv->getObjectId());
577 
578  $details = sprintf($this->lng->txt('X_reservations_of'), count($ids)) . ' ' . $obj->getTitle();
579  if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
580  $details .= ", " . ilDatePresentation::formatPeriod(
581  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
582  new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
583  );
584  }
585 
586  $conf->addItem('rsv_ids', implode(',', $ids), $details);
587  $this->tpl->setContent($conf->getHTML());
588  }
a bookable ressource
checkPermissionBool($a_perm)
Check permission.
const IL_CAL_UNIX
getTitle()
Get object title.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$DIC
Definition: xapitoken.php:46
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
Confirmation screen class.
+ Here is the call graph for this function:

◆ rsvDelete()

ilBookingReservationsGUI::rsvDelete ( )

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

References $DIC, $res, checkPermissionBool(), ilUtil\sendFailure(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

591  {
592  global $DIC;
593  $get = $DIC->http()->request()->getParsedBody()['rsv_ids'];
594  if ($get) {
595  foreach (explode(',', $get) as $id) {
596  $res = new ilBookingReservation($id);
597  $obj = new ilBookingObject($res->getObjectId());
598  if ($obj->getPoolId() != $this->pool->getId() || !$this->checkPermissionBool("write")) {
599  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
600  $this->ctrl->redirect($this, 'log');
601  }
602  if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
603  $cal_entry_id = $res->getCalendarEntry();
604  if ($cal_entry_id) {
605  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
606  $entry = new ilCalendarEntry($cal_entry_id);
607  $entry->delete();
608  }
609  }
610  $res->delete();
611  }
612  }
613  ilUtil::sendSuccess($this->lng->txt('reservation_deleted'), true);
614  $this->ctrl->redirect($this, 'log');
615  }
a bookable ressource
Model for a calendar entry.
checkPermissionBool($a_perm)
Check permission.
foreach($_POST as $key=> $value) $res
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ setHelpId()

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

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

References help().

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

101  {
102  $this->help->setHelpId($a_id);
103  }
help()
Definition: help.php:2
+ 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: