mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-31918 Use cached module info for activity completion report
This commit is contained in:
parent
cfaa50a61d
commit
15958e8677
1 changed files with 5 additions and 8 deletions
|
@ -91,6 +91,9 @@ if ($group === 0 && $course->groupmode == SEPARATEGROUPS) {
|
||||||
* Load data
|
* Load data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Retrieve course_module data for all modules in the course
|
||||||
|
$modinfo = get_fast_modinfo($course);
|
||||||
|
|
||||||
// Get criteria for course
|
// Get criteria for course
|
||||||
$completion = new completion_info($course);
|
$completion = new completion_info($course);
|
||||||
|
|
||||||
|
@ -492,13 +495,10 @@ if (!$csv) {
|
||||||
switch ($criterion->criteriatype) {
|
switch ($criterion->criteriatype) {
|
||||||
|
|
||||||
case COMPLETION_CRITERIA_TYPE_ACTIVITY:
|
case COMPLETION_CRITERIA_TYPE_ACTIVITY:
|
||||||
// Load activity
|
|
||||||
$activity = $criterion->get_mod_instance();
|
|
||||||
|
|
||||||
// Display icon
|
// Display icon
|
||||||
$icon = $OUTPUT->pix_url('icon', $criterion->module);
|
$icon = $OUTPUT->pix_url('icon', $criterion->module);
|
||||||
$iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance;
|
$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);
|
$iconalt = get_string('modulename', $criterion->module);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -577,10 +577,7 @@ foreach ($progress as $user) {
|
||||||
if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
|
if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
|
||||||
|
|
||||||
// Load activity
|
// Load activity
|
||||||
$mod = $criterion->get_mod_instance();
|
$activity = $modinfo->cms[$criterion->moduleinstance];
|
||||||
$activity = $DB->get_record('course_modules', array('id' => $criterion->moduleinstance));
|
|
||||||
$activity->name = $mod->name;
|
|
||||||
|
|
||||||
|
|
||||||
// Get progress information and state
|
// Get progress information and state
|
||||||
if (array_key_exists($activity->id,$user->progress)) {
|
if (array_key_exists($activity->id,$user->progress)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue