diff --git a/grade/lib.php b/grade/lib.php index 66cf003698b..1c0da1e67f2 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -1478,8 +1478,15 @@ class grade_structure { $icon->pix = 'i/outcomes'; $icon->title = s(get_string('outcome', 'grades')); } else { - $icon->pix = 'icon'; - $icon->component = $element['object']->itemmodule; + $modinfo = get_fast_modinfo($element['object']->courseid); + $module = $element['object']->itemmodule; + $instanceid = $element['object']->iteminstance; + if (isset($modinfo->instances[$module][$instanceid])) { + $icon->url = $modinfo->instances[$module][$instanceid]->get_icon_url(); + } else { + $icon->pix = 'icon'; + $icon->component = $element['object']->itemmodule; + } $icon->title = s(get_string('modulename', $element['object']->itemmodule)); } } else if ($element['object']->itemtype == 'manual') { @@ -1504,6 +1511,8 @@ class grade_structure { if ($spacerifnone) { $outputstr = $OUTPUT->spacer() . ' '; } + } else if (isset($icon->url)) { + $outputstr = html_writer::img($icon->url, $icon->title, $icon->attributes); } else { $outputstr = $OUTPUT->pix_icon($icon->pix, $icon->title, $icon->component, $icon->attributes); }