diff --git a/lang/en_utf8/forum.php b/lang/en_utf8/forum.php index 1c184815f25..d148018a1d1 100644 --- a/lang/en_utf8/forum.php +++ b/lang/en_utf8/forum.php @@ -7,6 +7,7 @@ $string['addanewtopic'] = 'Add a new topic'; $string['advancedsearch'] = 'Advanced search'; $string['aggregateavg'] = 'Average of ratings'; $string['aggregatecount'] = 'Count of ratings'; +$string['aggregatecountformat'] = '$a->count (grade: $a->grade)'; $string['aggregatemax'] = 'Maximum rating'; $string['aggregatemin'] = 'Minimum rating'; $string['aggregatenone'] = 'No ratings'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index d45365f4d38..673a8f64b07 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3625,9 +3625,15 @@ function forum_get_ratings_count($postid, $scale, $ratings=NULL) { if (($count == 0) && ($scaleused)) { // If no rating given yet and we use a scale return get_string('noratinggiven', 'forum'); } elseif ($count > $maxgradeidx) { // The count exceeds the max grade - return $scale[$maxgradeidx]; - } else { // Display the grade, eg. '3/10' or 'weak' - return $scale[$count]; + $a = new stdClass(); + $a->count = $count; + $a->grade = $scale[$maxgradeidx]; + return get_string('aggregatecountformat', 'forum', $a); + } else { // Display the count and the aggregated grade for this post + $a = new stdClass(); + $a->count = $count; + $a->grade = $scale[$count]; + return get_string('aggregatecountformat', 'forum', $a); } }