Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-31918 Use cached module info for activity completion report

  • Loading branch information...
commit 739af42c9c36e82ee66c77111aa95c2bda590877 1 parent 256e3ed
Andrew Nicols andrewnicols authored samhemelryk committed

Showing 1 changed file with 5 additions and 8 deletions. Show diff stats Hide diff stats

  1. +5 8 course/report/completion/index.php
13 course/report/completion/index.php
@@ -90,6 +90,9 @@ function csv_quote($value) {
90 90 * Load data
91 91 */
92 92
  93 +// Retrieve course_module data for all modules in the course
  94 +$modinfo = get_fast_modinfo($course);
  95 +
93 96 // Get criteria for course
94 97 $completion = new completion_info($course);
95 98
@@ -486,13 +489,10 @@ function csv_quote($value) {
486 489 switch ($criterion->criteriatype) {
487 490
488 491 case COMPLETION_CRITERIA_TYPE_ACTIVITY:
489   - // Load activity
490   - $activity = $criterion->get_mod_instance();
491   -
492 492 // Display icon
493 493 $icon = $OUTPUT->pix_url('icon', $criterion->module);
494 494 $iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance;
495   - $icontitle = $activity->name;
  495 + $icontitle = $modinfo->cms[$criterion->moduleinstance]->name;
496 496 $iconalt = get_string('modulename', $criterion->module);
497 497 break;
498 498
@@ -574,10 +574,7 @@ function csv_quote($value) {
574 574 if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
575 575
576 576 // Load activity
577   - $mod = $criterion->get_mod_instance();
578   - $activity = $DB->get_record('course_modules', array('id' => $criterion->moduleinstance));
579   - $activity->name = $mod->name;
580   -
  577 + $activity = $modinfo->cms[$criterion->moduleinstance];
581 578
582 579 // Get progress information and state
583 580 if(array_key_exists($activity->id,$user->progress)) {

0 comments on commit 739af42

Please sign in to comment.
Something went wrong with that request. Please try again.