Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-33621 rating: fixed view help error for global scale rating

  • Loading branch information...
commit e2398ac29020c62ab399bd86aa6a7fbd62cef300 1 parent a8ce907
@mrmark mrmark authored rwijaya committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/outputrenderers.php
View
8 lib/outputrenderers.php
@@ -1530,7 +1530,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');
Please sign in to comment.
Something went wrong with that request. Please try again.