]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17940 Display the count of ratings together with the aggregated grade for the...
authormudrd8mz <mudrd8mz>
Fri, 30 Jan 2009 11:32:46 +0000 (11:32 +0000)
committermudrd8mz <mudrd8mz>
Fri, 30 Jan 2009 11:32:46 +0000 (11:32 +0000)
lang/en_utf8/forum.php
mod/forum/lib.php

index 1c184815f25074ffa99c7c48ff0af43dee35e442..d148018a1d1cc289713ee9f0b537d26e36f36e53 100644 (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';
index d45365f4d388966d6d5108526d3925e03eeaaf94..673a8f64b079c008ac8b07e0a3717feb5502305f 100644 (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);
     }
 }