On second thought, we can be a bit more diplomatic with this one.

The best of both worlds, but a hack is a hack. ;-)
This commit is contained in:
defacer 2006-01-13 16:28:19 +00:00
parent 24acdc993b
commit 42f9b64b80

View File

@ -9,7 +9,16 @@ class block_activity_modules extends block_list {
function get_content() {
global $USER, $CFG;
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
// 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'])) {
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
}
else {
$modnamesplural = $GLOBALS['modnamesplural'];
$modnamesused = $GLOBALS['modnamesused'];
}
if($this->content !== NULL) {
return $this->content;