Merge branch 'MDL-31918-master-2' of git://git.luns.net.uk/moodle
authorSam Hemelryk <sam@moodle.com>
Mon, 12 Mar 2012 01:54:42 +0000 (14:54 +1300)
committerSam Hemelryk <sam@moodle.com>
Mon, 12 Mar 2012 01:54:42 +0000 (14:54 +1300)
report/completion/index.php

index 2d2b83d..7449f87 100644 (file)
@@ -90,6 +90,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);
 
@@ -490,13 +493,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;
 
@@ -575,10 +575,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)) {