From 2631c1744e75b6194ca1b3d18a6178c01dda9cf2 Mon Sep 17 00:00:00 2001 From: vyshane Date: Fri, 19 May 2006 06:25:12 +0000 Subject: [PATCH] Fix for Bug #5541 --- blocks/activity_modules/block_activity_modules.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blocks/activity_modules/block_activity_modules.php b/blocks/activity_modules/block_activity_modules.php index 09aafffef06..2f6b31b94d8 100644 --- a/blocks/activity_modules/block_activity_modules.php +++ b/blocks/activity_modules/block_activity_modules.php @@ -8,13 +8,15 @@ class block_activity_modules extends block_list { function get_content() { global $USER, $CFG; - + // TODO: FIX: HACK: (any other tags I should add? :P) // Hacker's improvised caching scheme: avoid fetching the mod // data from db if the course format has already fetched them if(!isset($GLOBALS['modnamesplural']) || !isset($GLOBALS['modnamesused'])) { require_once($CFG->dirroot.'/course/lib.php'); - get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused); + if (!empty($this->instance)) { + get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused); + } } else { $modnamesplural = $GLOBALS['modnamesplural']; @@ -30,7 +32,7 @@ class block_activity_modules extends block_list { $this->content->icons = array(); $this->content->footer = ''; - if ($modnamesused) { + if (isset($modnamesused) && $modnamesused) { foreach ($modnamesused as $modname => $modfullname) { if ($modname != 'label') { $this->content->items[] = ''.$modnamesplural[$modname].'';