rating MDL-21657 changed to make use use of user_picture::fields()
authorAndrew Davis <andrew@affinitysoftware.net>
Thu, 18 Mar 2010 04:08:52 +0000 (04:08 +0000)
committerAndrew Davis <andrew@affinitysoftware.net>
Thu, 18 Mar 2010 04:08:52 +0000 (04:08 +0000)
rating/index.php
rating/lib.php

index 7c471b9..f9b88c7 100644 (file)
@@ -81,8 +81,8 @@ if (!$ratings) {
     foreach ($ratings as $rating) {
         echo '<tr class="ratingitemheader">';
         echo "<td>";
-        if($courseid) {
-            echo $OUTPUT->user_picture($rating, array('courseid'=>$courseid));
+        if($course && $course->id) {
+            echo $OUTPUT->user_picture($rating, array('courseid'=>$course->id));
         } else {
             echo $OUTPUT->user_picture($rating);
         }
index ee314b8..7e9f4fd 100644 (file)
@@ -182,8 +182,9 @@ class rating implements renderable {
     public static function load_ratings_for_item($context, $itemid, $sort) {
         global $DB;
 
+        $userfields = user_picture::fields('u');
         $sql = "SELECT r.id, r.rating, r.itemid, r.userid, r.timemodified,
-                    u.firstname, u.lastname, u.imagealt, u.picture
+                    $userfields
                 FROM {rating} r
                 LEFT JOIN {user} u ON r.userid = u.id
                 WHERE r.contextid = :contextid AND
@@ -252,7 +253,7 @@ class rating implements renderable {
         $scaleobj = new stdClass();
         $scalemax = null;
 
-        //todo we could look for a scale id on each item to allow each item to use a different scale
+        //we could look for a scale id on each item to allow each item to use a different scale
 
         if($scaleid < 0 ) { //if its a scale (not numeric)
             $scalerecord = $DB->get_record('scale', array('id' => -$scaleid));