From 880d86758b29d3ca2f3f86123cd3f5f175c5da22 Mon Sep 17 00:00:00 2001 From: defacer Date: Mon, 28 Feb 2005 04:18:13 +0000 Subject: [PATCH] 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. --- mod/chat/lib.php | 7 +++++++ mod/quiz/lib.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/mod/chat/lib.php b/mod/chat/lib.php index 49c5445ed48..8ec1ed26a3f 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -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; } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 880c07f8939..d2301f5c862 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -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);