MDL-17940 Display the count of ratings together with the aggregated grade for the post. Merged from 1.9

This commit is contained in:
mudrd8mz 2009-01-30 11:32:46 +00:00
parent df2a8db150
commit c5ce3d837c
2 changed files with 10 additions and 3 deletions

View File

@ -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';

View File

@ -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);
}
}