Each mod is responsible to deleting its own blocks; what I had in mind for

centralizing this wouldn't work out. Use the flexible page_import_types so that
we don't create one more dependency when writing new code.
This commit is contained in:
defacer 2005-02-28 04:18:13 +00:00
parent b5e9682173
commit 880d86758b
2 changed files with 14 additions and 0 deletions

View File

@ -123,6 +123,13 @@ function chat_delete_instance($id) {
$result = false;
}
$pagetypes = page_import_types('mod/chat/');
foreach($pagetypes as $pagetype) {
if(!delete_records('block_instance', 'pageid', $chat->id, 'pagetype', $pagetype)) {
$result = false;
}
}
if (! delete_records('event', 'modulename', 'chat', 'instance', $chat->id)) {
$result = false;
}

View File

@ -170,6 +170,13 @@ function quiz_delete_instance($id) {
$result = false;
}
$pagetypes = page_import_types('mod/quiz/');
foreach($pagetypes as $pagetype) {
if(!delete_records('block_instance', 'pageid', $quiz->id, 'pagetype', $pagetype)) {
$result = false;
}
}
if ($events = get_records_select('event', "modulename = 'quiz' and instance = '$quiz->id'")) {
foreach($events as $event) {
delete_event($event->id);