Permalink
Browse files

MDL-25660 workshop removes its calendar events on instance deletion

  • Loading branch information...
1 parent 3108a0f commit f58b7c2f4ae92fd32fb9472958390ec3f6de17df @mudrd8mz mudrd8mz committed Apr 13, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 mod/workshop/lib.php
View
7 mod/workshop/lib.php
@@ -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));

0 comments on commit f58b7c2

Please sign in to comment.