/** * Book consultation appointment, was confirmed */ public function bookconfirmed() { global $ilUser; $entry = (int) $_REQUEST['app_id']; $user = (int) $_REQUEST['bkid']; $form = $this->initFormConfirmBooking(); if ($form->checkInput()) { // check if appointment is bookable include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; $cal_entry = new ilCalendarEntry($entry); include_once './Services/Booking/classes/class.ilBookingEntry.php'; $booking = new ilBookingEntry($cal_entry->getContextId()); if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['ilUser']->getId())) { ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true); $this->ctrl->returnToParent($this); } include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php'; ilConsultationHourUtils::bookAppointment($ilUser->getId(), $entry); include_once './Services/Booking/classes/class.ilBookingEntry.php'; ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment')); } ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'), true); $this->ctrl->returnToParent($this); }