/** * Cancel a booking * @param type $a_usr_id * @param type $a_app_id * @return bool */ public static function cancelBooking($a_usr_id, $a_app_id, $a_send_notification = true) { // Delete personal copy of appointment include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; $app = new ilCalendarEntry($a_app_id); include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php'; $user_apps = ilConsultationHourAppointments::getAppointmentIds($a_usr_id, $app->getContextId(), $app->getStart(), ilCalendarCategory::TYPE_CH, false); foreach ($user_apps as $uapp_id) { $uapp = new ilCalendarEntry($uapp_id); $uapp->delete(); include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; ilCalendarCategoryAssignments::_deleteByAppointmentId($uapp_id); break; } // Delete booking entries // Send notification $booking = new ilBookingEntry($app->getContextId()); if ($a_send_notification) { $booking->cancelBooking($a_app_id, $a_usr_id); } else { $booking->deleteBooking($a_app_id, $a_usr_id); } return true; }