MDL-25660 workshop removes its calendar events on instance deletion

This commit is contained in:
David Mudrak
2012-04-13 13:11:45 +02:00
parent 3108a0f862
commit f58b7c2f4a
+7
View File
@@ -218,6 +218,13 @@ function workshop_delete_instance($id) {
call_user_func($classname.'::delete_instance', $workshop->id);
}
// delete the calendar events
$events = $DB->get_records('event', array('modulename' => 'workshop', 'instance' => $workshop->id));
foreach ($events as $event) {
$event = calendar_event::load($event);
$event->delete();
}
// finally remove the workshop record itself
$DB->delete_records('workshop', array('id' => $workshop->id));