/** * Deletes all data of a room sharing pool. * * @param ilObjRoomSharing $a_pool * * @return bool true if deletion was successful */ public static function deletePool(ilObjRoomSharing $a_pool) { $db = new ilRoomSharingDatabase($a_pool->getPoolId()); // Calendar $calendar_id = $db->getCalendarId(); $db->deleteCalendar($calendar_id); // Bookings $all_bookings_ids = $db->getAllBookingsIds(); // Calendar-Entries $db->deleteCalendarEntriesOfBookings($all_bookings_ids); foreach ($all_bookings_ids as $booking_id) { $db->deleteBooking($booking_id); } // Booking attributes $all_booking_attributes = $db->getAllBookingAttributes(); foreach ($all_booking_attributes as $booking_attribute) { $db->deleteBookingAttribute($booking_attribute['id']); $db->deleteAttributeBookingAssign($booking_attribute['id']); } // Rooms $all_room_ids = $db->getAllRoomIds(); foreach ($all_room_ids as $room_id) { $db->deleteRoom($room_id); } // Room attributes $all_room_attributes = $db->getAllRoomAttributes(); foreach ($all_room_attributes as $room_attribute) { $db->deleteRoomAttribute($room_attribute['id']); $db->deleteAttributeRoomAssign($room_attribute['id']); } // Privileges $classes = $db->getClasses(); foreach ($classes as $class) { $db->deleteClass($class['id']); // Takes also care of assignments } // Floorplans $all_floorplans_ids = $db->getAllFloorplanIds(); foreach ($all_floorplans_ids as $floor_plan_id) { $db->deleteFloorplan($floor_plan_id); } // Files of floorplans and rooms user agreement foreach ($all_floorplans_ids as $floor_plan_file_id) { if (!empty($floor_plan_file_id) && $floor_plan_file_id != "0") { $floor_plan_file = new ilObjMediaObject($floor_plan_file_id); $floor_plan_file->delete(); } } $rooms_agreement_file_id = $a_pool->getRoomsAgreementFileId(); if (ilRoomSharingNumericUtils::isPositiveNumber($rooms_agreement_file_id)) { $rooms_agreement_file = new ilObjMediaObject($rooms_agreement_file_id); $rooms_agreement_file->delete(); } // Pool itself $db->deletePoolEntry("SURE"); }