From ccb8d546e3796c5924e609b093cda1e97e4c3c6a Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Tue, 6 Mar 2012 14:36:20 +0000 Subject: [PATCH] MDL-31918 Use cached module info for activity completion report --- report/completion/index.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/report/completion/index.php b/report/completion/index.php index dcd81a98b01..c9682b5ee69 100644 --- a/report/completion/index.php +++ b/report/completion/index.php @@ -91,6 +91,9 @@ if ($group === 0 && $course->groupmode == SEPARATEGROUPS) { * Load data */ +// Retrieve course_module data for all modules in the course +$modinfo = get_fast_modinfo($course); + // Get criteria for course $completion = new completion_info($course); @@ -492,13 +495,10 @@ if (!$csv) { switch ($criterion->criteriatype) { case COMPLETION_CRITERIA_TYPE_ACTIVITY: - // Load activity - $activity = $criterion->get_mod_instance(); - // Display icon $icon = $OUTPUT->pix_url('icon', $criterion->module); $iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance; - $icontitle = $activity->name; + $icontitle = $modinfo->cms[$criterion->moduleinstance]->name; $iconalt = get_string('modulename', $criterion->module); break; @@ -577,10 +577,7 @@ foreach ($progress as $user) { if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) { // Load activity - $mod = $criterion->get_mod_instance(); - $activity = $DB->get_record('course_modules', array('id' => $criterion->moduleinstance)); - $activity->name = $mod->name; - + $activity = $modinfo->cms[$criterion->moduleinstance]; // Get progress information and state if (array_key_exists($activity->id,$user->progress)) {