From: vyshane Date: Fri, 19 May 2006 06:25:12 +0000 (+0000) Subject: Fix for Bug #5541 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2631c1744e75b6194ca1b3d18a6178c01dda9cf2;p=moodle.git Fix for Bug #5541 --- diff --git a/blocks/activity_modules/block_activity_modules.php b/blocks/activity_modules/block_activity_modules.php index 09aafffef0..2f6b31b94d 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].'';