ratings MDLSITE-1028 Added additional structure to the ratings renderer output
authorSam Hemelryk <sam@moodle.com>
Wed, 6 Oct 2010 05:50:45 +0000 (05:50 +0000)
committerSam Hemelryk <sam@moodle.com>
Wed, 6 Oct 2010 05:50:45 +0000 (05:50 +0000)
lib/outputrenderers.php
mod/forum/lib.php

index 09cf31b..8e50816 100644 (file)
@@ -1417,6 +1417,7 @@ class core_renderer extends renderer_base {
                     $aggregatelabel .= get_string("aggregatesum", "rating");
                     break;
             }
+            $aggregatelabel .= get_string('labelsep', 'langconfig');
 
             //$scalemax = 0;//no longer displaying scale max
             $aggregatestr = '';
@@ -1442,15 +1443,16 @@ class core_renderer extends renderer_base {
             //$aggregatehtml = "{$ratingstr} / $scalemax ({$rating->count}) ";
             $aggregatehtml = "<span id='ratingaggregate{$rating->itemid}'>{$aggregatestr}</span> $countstr ";
 
+            $ratinghtml .= html_writer::tag('span', $aggregatelabel, array('class'=>'rating-aggregate-label'));
             if ($rating->settings->permissions->viewall && $rating->settings->pluginpermissions->viewall) {
                 $url = "/rating/index.php?contextid={$rating->context->id}&itemid={$rating->itemid}&scaleid={$rating->settings->scale->id}";
                 $nonpopuplink = new moodle_url($url);
                 $popuplink = new moodle_url("$url&popup=1");
 
                 $action = new popup_action('click', $popuplink, 'ratings', array('height' => 400, 'width' => 600));
-                $ratinghtml .= $aggregatelabel.get_string('labelsep', 'langconfig').$this->action_link($nonpopuplink, $aggregatehtml, $action);
+                $ratinghtml .= $this->action_link($nonpopuplink, $aggregatehtml, $action);
             } else {
-                $ratinghtml .= $aggregatelabel.get_string('labelsep', 'langconfig').$aggregatehtml;
+                $ratinghtml .= $aggregatehtml;
             }
         }
 
index 76525fe..af593a0 100644 (file)
@@ -3385,7 +3385,7 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa
 
 // Ratings
     if (!empty($post->rating)) {
-        echo $OUTPUT->render($post->rating);
+        echo html_writer::tag('div', $OUTPUT->render($post->rating), array('class'=>'forum-post-rating'));
     }
 
 // Link to post if required