MDL-17940 Display the count of ratings together with the aggregated grade for the post. Merged from 1.9
This commit is contained in:
@@ -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';
|
||||
|
||||
+9
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user