Skip to content

Commit

Permalink
MDL-33621 rating: fixed view help error for global scale rating
Browse files Browse the repository at this point in the history
  • Loading branch information
polothy authored and Rossiani Wijaya committed Oct 15, 2012
1 parent ccd90e7 commit eaf52ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/outputrenderers.php
Expand Up @@ -1657,7 +1657,13 @@ function render_rating(rating $rating) {
$ratinghtml .= html_writer::empty_tag('input', $attributes);

if (!$rating->settings->scale->isnumeric) {
$ratinghtml .= $this->help_icon_scale($rating->settings->scale->courseid, $rating->settings->scale);
// If a global scale, try to find current course ID from the context
if (empty($rating->settings->scale->courseid) and $coursecontext = $rating->context->get_course_context(false)) {
$courseid = $coursecontext->instanceid;
} else {
$courseid = $rating->settings->scale->courseid;
}
$ratinghtml .= $this->help_icon_scale($courseid, $rating->settings->scale);
}
$ratinghtml .= html_writer::end_tag('span');
$ratinghtml .= html_writer::end_tag('div');
Expand Down

0 comments on commit eaf52ff

Please sign in to comment.