function rsvCancelUser() { global $ilCtrl, $ilUser, $lng; $id = (int) $_GET["object_id"]; if (!$id) { return; } include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId()); $obj = new ilBookingReservation($id); if ($obj->getUserId() != $ilUser->getId()) { ilUtil::sendFailure($lng->txt('permission_denied'), true); $ilCtrl->redirect($this, 'render'); } $obj->setStatus(ilBookingReservation::STATUS_CANCELLED); $obj->update(); ilUtil::sendSuccess($lng->txt('settings_saved')); $ilCtrl->redirect($this, 'render'); }
function rsvNotInUseObject() { global $ilAccess; $this->tabs_gui->setTabActive('log'); if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { ilUtil::sendFailure($this->lng->txt('permission_denied'), true); $this->ctrl->redirect($this, 'log'); } $id = (int) $_GET['reservation_id']; include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $obj = new ilBookingReservation($id); $obj->setStatus(NULL); $obj->update(); ilUtil::sendSuccess($this->lng->txt('settings_saved')); $this->logObject(); }
/** * Cancel consultation appointment or ressource booking, was confirmed * This will delete the calendar entry */ public function cancelConfirmed() { global $ilUser; $entry = (int) $_POST['app_id']; $user = (int) $_GET['bkid']; include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; $entry = new ilCalendarEntry($entry); $category = $this->calendarEntryToCategory($entry); if ($category->getType() == ilCalendarCategory::TYPE_CH) { // find cloned calendar entry in user calendar include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php'; $GLOBALS['ilLog']->dump($entry->getStart()); $apps = ilConsultationHourAppointments::getAppointmentIds($ilUser->getId(), $entry->getContextId(), $entry->getStart(), ilCalendarCategory::TYPE_CH, false); $GLOBALS['ilLog']->dump($apps); // Fix for wrong, old entries foreach ((array) $apps as $own_app) { $ref_entry = new ilCalendarEntry($own_app); $ref_entry->delete(); } include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $booking = new ilBookingEntry($entry->getContextId()); $booking->cancelBooking($entry->getEntryId()); // do NOT delete original entry } else { if ($category->getType() == ilCalendarCategory::TYPE_BOOK) { include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $booking = new ilBookingReservation($entry->getContextId()); $booking->setStatus(ilBookingReservation::STATUS_CANCELLED); $booking->update(); $entry->delete(); } } ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'), true); $this->ctrl->returnToParent($this); }
function rsvNotInUseObject() { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { ilUtil::sendFailure($this->lng->txt('permission_denied'), true); $this->ctrl->redirect($this, 'log'); } $ids = $this->getLogReservationIds(); if ($ids) { include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; foreach ($ids as $id) { $obj = new ilBookingReservation($id); $obj->setStatus(NULL); $obj->update(); } } ilUtil::sendSuccess($this->lng->txt('settings_saved')); $this->logObject(); }