]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10477 Mainly the percentage grade display type
authornicolasconnault <nicolasconnault>
Mon, 16 Jul 2007 19:46:54 +0000 (19:46 +0000)
committernicolasconnault <nicolasconnault>
Mon, 16 Jul 2007 19:46:54 +0000 (19:46 +0000)
12 files changed:
grade/report/grader/.lib.php.swp [new file with mode: 0644]
grade/report/grader/lib.php
grade/report/grader/preferences_form.php
grade/report/grader/settings.php
grade/report/lib.php
grade/report/simpletest/testreportlib.php [new file with mode: 0644]
lang/en_utf8/grades.php
lib/grade/grade_tree.php
lib/gradelib.php
pix/t/grades.gif [new file with mode: 0644]
theme/custom_corners/header.html
version.php

diff --git a/grade/report/grader/.lib.php.swp b/grade/report/grader/.lib.php.swp
new file mode 100644 (file)
index 0000000..a7d4bf4
Binary files /dev/null and b/grade/report/grader/.lib.php.swp differ
index b486a25d5a8e83c18c63a43206fd31001a6e9014..532bee999210c987fa76299e94191a21ddb41375 100644 (file)
@@ -354,7 +354,9 @@ class grade_report_grader extends grade_report {
     function load_final_grades() {
         global $CFG;
 
-        $sql = "SELECT g.id, g.itemid, g.userid, g.finalgrade, g.hidden, g.locked, g.locktime, g.overridden, gt.feedback, gt.feedbackformat
+        $sql = "SELECT g.id, g.itemid, g.userid, g.finalgrade, g.hidden, g.locked, g.locktime, g.overridden,
+                       gt.feedback, gt.feedbackformat,
+                       gi.grademin, gi.grademax
                 FROM  {$CFG->prefix}grade_items gi,
                       {$CFG->prefix}grade_grades g
                 LEFT JOIN {$CFG->prefix}grade_grades_text gt ON g.id = gt.gradeid
@@ -586,11 +588,27 @@ class grade_report_grader extends grade_report {
             $studentshtml .= '<tr><th class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id='
                           . $user->id . '">' . fullname($user) . '</a></th>';
             foreach ($this->items as $item) {
+                // Percentage format if specified by user (check each item for a set preference)
+                $gradedisplaytype = $this->get_pref('gradedisplaytype', $item->id);
+                $percentsign = '';
+
+                if ($gradedisplaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE) {
+                    $percentsign = '%';
+                }
 
                 if (isset($this->finalgrades[$userid][$item->id])) {
                     $gradeval = $this->finalgrades[$userid][$item->id]->finalgrade;
+
+                    // Convert the grade to percentage if needed
+                    if ($gradedisplaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE) {
+                        $gradeval = grade_grades::standardise_score($gradeval,
+                                                                    $this->finalgrades[$userid][$item->id]->grademin,
+                                                                    $this->finalgrades[$userid][$item->id]->grademax,
+                                                                    0, 100);
+                    }
+
                     $grade = new grade_grades($this->finalgrades[$userid][$item->id], false);
-                    $grade->feedback = $this->finalgrades[$userid][$item->id]->feedback;
+                    $grade->feedback = stripslashes_safe($this->finalgrades[$userid][$item->id]->feedback);
                     $grade->feedbackformat = $this->finalgrades[$userid][$item->id]->feedbackformat;
 
                 } else {
@@ -654,12 +672,12 @@ class grade_report_grader extends grade_report {
                             // no such scale, throw error?
                         }
 
-                    } else if ($item->gradetype != GRADE_TYPE_TEXT) {
+                    } else if ($item->gradetype != GRADE_TYPE_TEXT) { // Value type
                         if ($this->get_pref('quickgrading') and $grade->is_editable()) {
                             $studentshtml .= '<input size="6" tabindex="' . $gradetabindex++ . '" type="text" name="grade_'.$userid.'_'
-                                          .$item->id.'" value="'.$this->get_grade_clean($gradeval).'"/>';
+                                          .$item->id.'" value="'.$this->get_grade_clean($gradeval).'"/>' . $percentsign;
                         } else {
-                            $studentshtml .= $this->get_grade_clean($gradeval);
+                            $studentshtml .= $this->get_grade_clean($gradeval) . $percentsign;
                         }
                     }
 
@@ -677,9 +695,9 @@ class grade_report_grader extends grade_report {
                     // If feedback present, surround grade with feedback tooltip
                     if (!empty($grade->feedback)) {
                         if ($grade->feedbackformat == 1) {
-                            $overlib = "return overlib('$grade->feedback', CAPTION, '$strfeedback');";
-                        } else {
                             $overlib = "return overlib('" . s(ltrim($grade->feedback)) . "', FULLHTML);";
+                        } else {
+                            $overlib = "return overlib('" . ($grade->feedback) . "', CAPTION, '$strfeedback');";
                         }
 
                         $studentshtml .= '<span onmouseover="' . $overlib . '" onmouseout="return nd();">';
@@ -701,7 +719,7 @@ class grade_report_grader extends grade_report {
                         if (is_null($gradeval)) {
                             $studentshtml .= '-';
                         } else {
-                            $studentshtml .=  $this->get_grade_clean($gradeval);
+                            $studentshtml .=  $this->get_grade_clean($gradeval). $percentsign;
                         }
                     }
                     if (!empty($grade->feedback)) {
@@ -727,6 +745,8 @@ class grade_report_grader extends grade_report {
     function get_groupavghtml($gpr) {
         global $CFG;
 
+        $averagesdisplaytype = $this->get_pref('averagesdisplaytype');
+
         $groupavghtml = '';
         if ($this->currentgroup && $this->get_pref('showgroups')) {
 
@@ -755,6 +775,14 @@ class grade_report_grader extends grade_report {
 
             $groupavghtml = '<tr><th>'.get_string('groupavg', 'grades').'</th>';
             foreach ($this->items as $item) {
+                // Determine which display type to use for this average
+                $gradedisplaytype = $this->get_pref('gradedisplaytype', $item->id);
+                if ($averagesdisplaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_INHERIT) { // Inherit specific column or general preference
+                    $displaytype = $gradedisplaytype;
+                } else { // General preference overrides specific column display type
+                    $displaytype = $averagesdisplaytype;
+                }
+
                 if (empty($groupscount[$itemid]) || !isset($groupsum[$item->id])) {
                     $groupavghtml .= '<td>-</td>';
                 } else {
@@ -778,7 +806,15 @@ class grade_report_grader extends grade_report {
                         $gradehtml = $scales[$scaleval-1];
                     } else {
                         $gradeval = $this->get_grade_clean($sum/$groupscount[$item->id]);
-                        $gradehtml = $gradeval;
+
+                        $percentsign = '';
+
+                        if ($displaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE) {
+                            $percentsign = '%';
+                            $gradeval = grade_grades::standardise_score($gradeval, $item->grademin, $item->grademax, 0, 100);
+                        }
+
+                        $gradehtml = round($gradeval, $this->get_pref('decimalpoints', $item->id)) . $percentsign;
                     }
                     $groupavghtml .= '<td>'.$gradehtml.'</td>';
                 }
@@ -795,6 +831,8 @@ class grade_report_grader extends grade_report {
     function get_gradeavghtml($gpr) {
         global $CFG;
 
+        $averagesdisplaytype = $this->get_pref('averagesdisplaytype');
+
         $gradeavghtml = '';
         if ($this->get_pref('showaverages')) {
 
@@ -820,6 +858,14 @@ class grade_report_grader extends grade_report {
 
             $gradeavghtml = '<tr><th>'.get_string('average', 'grades').'</th>';
             foreach ($this->items as $item) {
+                // Determine which display type to use for this average
+                $gradedisplaytype = $this->get_pref('gradedisplaytype', $item->id);
+                if ($averagesdisplaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_INHERIT) { // Inherit specific column or general preference
+                    $displaytype = $gradedisplaytype;
+                } else { // General preference overrides specific column display type
+                    $displaytype = $averagesdisplaytype;
+                }
+
                 if (empty($classcount[$itemid]) || !isset($classsum[$item->id])) {
                     $gradeavghtml .= '<td>-</td>';
                 } else {
@@ -839,8 +885,16 @@ class grade_report_grader extends grade_report {
                         $gradehtml = $scales[$scaleval-1];
                     } else {
                         $gradeval = $this->get_grade_clean($sum/$classcount[$itemid]);
-                        $gradehtml = $gradeval;
+                        $percentsign = '';
+
+                        if ($displaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE) {
+                            $gradeval = grade_grades::standardise_score($gradeval, $item->grademin, $item->grademax, 0, 100);
+                            $percentsign = '%';
+                        }
+
+                        $gradehtml = round($gradeval, $this->get_pref('decimalpoints', $item->id)) . $percentsign;
                     }
+
                     $gradeavghtml .= '<td>'.$gradehtml.'</td>';
                 }
             }
@@ -920,9 +974,9 @@ class grade_report_grader extends grade_report {
         $overlib = '';
         if (!empty($object->feedback)) {
             if (empty($object->feedbackformat) || $object->feedbackformat != 1) {
-                $function = "return overlib('$object->feedback', CAPTION, '$strfeedback');";
+                $function = "return overlib('" . strip_tags($object->feedback) . "', CAPTION, '$strfeedback');";
             } else {
-                $function = "return overlib('" . s(ltrim($object->feedback)) . "', FULLHTML);";
+                $function = "return overlib('" . s(ltrim($object->feedback) . "', FULLHTML);");
             }
             $overlib = 'onmouseover="' . $function . '" onmouseout="return nd();"';
         }
@@ -1035,7 +1089,7 @@ class grade_report_grader extends grade_report {
             }
 
             // If object is a category, display expand/contract icon
-            if (get_class($object) == 'grade_category' && $this->get_pref('aggregationview') == GRADER_REPORT_AGGREGATION_VIEW_COMPACT) {
+            if (get_class($object) == 'grade_category' && $this->get_pref('aggregationview') == GRADE_REPORT_AGGREGATION_VIEW_COMPACT) {
                 $html .= $contract_expand_icon;
             }
         } else { // Editing mode is off
index 0b9b91d4ea73fb1599fa19e68cdb328ff5688835..417e366d0af0ce3027e316755f9a1bad26437da2 100644 (file)
@@ -29,16 +29,18 @@ class grader_report_preferences_form extends moodleform {
                              'showranges'             => 'advcheckbox',
                              'quickgrading'           => 'advcheckbox',
                              'quickfeedback'          => 'advcheckbox',
+                             'showuserimage'          => 'advcheckbox',
                              'meanselection'          => array(GRADE_AGGREGATE_MEAN_ALL => get_string('meanall', 'grades'),
                                                                GRADE_AGGREGATE_MEAN_GRADED => get_string('meangraded', 'grades')),
-                             'aggregationposition'    => array(GRADER_REPORT_AGGREGATION_POSITION_LEFT => get_string('left', 'grades'),
-                                                               GRADER_REPORT_AGGREGATION_POSITION_RIGHT => get_string('right', 'grades')),
-                             'aggregationview'        => array(GRADER_REPORT_AGGREGATION_VIEW_FULL => get_string('full', 'grades'),
-                                                               GRADER_REPORT_AGGREGATION_VIEW_COMPACT => get_string('compact', 'grades')),
-                             'gradedisplaytype'       => array(GRADER_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
-                                                               GRADER_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades')),
-                             'averagesdisplaytype'    => array(GRADER_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
-                                                               GRADER_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades')),
+                             'aggregationposition'    => array(GRADE_REPORT_AGGREGATION_POSITION_LEFT => get_string('left', 'grades'),
+                                                               GRADE_REPORT_AGGREGATION_POSITION_RIGHT => get_string('right', 'grades')),
+                             'aggregationview'        => array(GRADE_REPORT_AGGREGATION_VIEW_FULL => get_string('full', 'grades'),
+                                                               GRADE_REPORT_AGGREGATION_VIEW_COMPACT => get_string('compact', 'grades')),
+                             'gradedisplaytype'       => array(GRADE_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
+                                                               GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades')),
+                             'averagesdisplaytype'    => array(GRADE_REPORT_GRADE_DISPLAY_TYPE_INHERIT => get_string('inherit', 'grades'),
+                                                               GRADE_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
+                                                               GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades')),
                              'decimalpoints'          => array(0, 1, 2, 3, 4, 5),
                              'studentsperpage'        => 'text');
 
index 2b72478faab944f80795717bc850b6c586293a13..b954c15aa448f329589949fb8dd283d0b5bd8043 100644 (file)
@@ -4,13 +4,13 @@ require_once($CFG->libdir.'/gradelib.php');
 /// Add settings for this module to the $settings object (it's already defined)
 $settings->add(new admin_setting_configselect('grade_report_aggregationposition', get_string('aggregationposition', 'grades'),
                                           get_string('configaggregationposition', 'grades'), false,
-                                          array(GRADER_REPORT_AGGREGATION_POSITION_LEFT => get_string('left', 'grades'),
-                                                GRADER_REPORT_AGGREGATION_POSITION_RIGHT => get_string('right', 'grades'))));
+                                          array(GRADE_REPORT_AGGREGATION_POSITION_LEFT => get_string('left', 'grades'),
+                                                GRADE_REPORT_AGGREGATION_POSITION_RIGHT => get_string('right', 'grades'))));
 
 $settings->add(new admin_setting_configselect('grade_report_aggregationview', get_string('aggregationview', 'grades'),
                                           get_string('configaggregationview', 'grades'), false,
-                                          array(GRADER_REPORT_AGGREGATION_VIEW_FULL => get_string('full', 'grades'),
-                                                GRADER_REPORT_AGGREGATION_VIEW_COMPACT => get_string('compact', 'grades'))));
+                                          array(GRADE_REPORT_AGGREGATION_VIEW_FULL => get_string('full', 'grades'),
+                                                GRADE_REPORT_AGGREGATION_VIEW_COMPACT => get_string('compact', 'grades'))));
 
 $settings->add(new admin_setting_configcheckbox('grade_report_bulkcheckboxes', get_string('bulkcheckboxes', 'grades'),
                                             get_string('configbulkcheckboxes', 'grades'), 0));
@@ -20,13 +20,14 @@ $settings->add(new admin_setting_configcheckbox('grade_report_enableajax', get_s
 
 $settings->add(new admin_setting_configselect('grade_report_gradedisplaytype', get_string('gradedisplaytype', 'grades'),
                                           get_string('configgradedisplaytype', 'grades'), false,
-                                          array(GRADER_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
-                                                GRADER_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'))));
+                                          array(GRADE_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
+                                                GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'))));
 
 $settings->add(new admin_setting_configselect('grade_report_averagesdisplaytype', get_string('averagesdisplaytype', 'grades'),
                                           get_string('configaveragesdisplaytype', 'grades'), false,
-                                          array(GRADER_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
-                                                GRADER_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'))));
+                                          array(GRADE_REPORT_GRADE_DISPLAY_TYPE_INHERIT => get_string('inherit', 'grades'),
+                                                GRADE_REPORT_GRADE_DISPLAY_TYPE_RAW => get_string('raw', 'grades'),
+                                                GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'))));
 
 $settings->add(new admin_setting_configselect('grade_report_meanselection', get_string('meanselection', 'grades'),
                                           get_string('configmeanselection', 'grades'), false,
@@ -57,6 +58,9 @@ $settings->add(new admin_setting_configcheckbox('grade_report_quickgrading', get
 $settings->add(new admin_setting_configcheckbox('grade_report_quickfeedback', get_string('quickfeedback', 'grades'),
                                             get_string('configquickfeedback', 'grades'), 1));
 
+$settings->add(new admin_setting_configcheckbox('grade_report_showuserimage', get_string('showuserimage', 'grades'),
+                                            get_string('configshowuserimage', 'grades'), 1));
+
 $settings->add(new admin_setting_configtext('grade_report_studentsperpage', get_string('studentsperpage', 'grades'),
                                         get_string('configstudentsperpage', 'grades'), 20));
 
index 38e54d00f1a99de52be2796cac0ca09764f366c4..31cc011022b0dbf4994ce0ba16a40eb7a60da76a 100755 (executable)
@@ -92,28 +92,37 @@ class grade_report {
      * the saved value is returned. If the preference is not set at the User level, the $CFG equivalent
      * is given (site default).
      * @param string $pref The name of the preference (do not include the grade_report_ prefix)
+     * @param int $itemid An optional itemid to check for a more fine-grained preference
      * @return mixed The value of the preference
      */
-    function get_pref($pref) {
+    function get_pref($pref, $itemid=null) {
         global $CFG;
 
-        if (empty($this->user_prefs[$pref])) {
+        if (empty($this->user_prefs[$pref.$itemid])) {
             $fullprefname = 'grade_report_' . $pref;
-            $this->user_prefs[$pref] = get_user_preferences($fullprefname, $CFG->$fullprefname);
+            if (!empty($itemid)) {
+                $value = get_user_preferences($fullprefname . $itemid, $this->get_pref($pref));
+            } else {
+                $value = get_user_preferences($fullprefname, $CFG->$fullprefname);
+            }
+            $this->user_prefs[$pref.$itemid] = $value;
         }
-        return $this->user_prefs[$pref];
+        return $this->user_prefs[$pref.$itemid];
     }
+
     /**
      * Uses set_user_preferences() to update the value of a user preference.
      * Also updates the object's corresponding variable.
      * @param string $pref_name The name of the preference.
      * @param mixed $pref_value The value of the preference.
+     * @param int $itemid An optional itemid to which the preference will be assigned
      * @return bool Success or failure.
      * TODO print visual feedback
      */
-    function set_user_pref($pref, $pref_value) {
-        if ($result = set_user_preferences(array($pref => $pref_value))) {
-            $this->$pref = $pref_value;
+    function set_pref($pref, $pref_value, $itemid=null) {
+        $fullprefname = 'grade_report_' . $pref;
+        if ($result = set_user_preferences(array($fullprefname.$itemid => $pref_value))) {
+            $this->user_prefs[$pref.$itemid] = $pref_value;
         }
         return $result;
     }
@@ -197,7 +206,7 @@ class grade_report {
             $gradeval = '';
         } else {
             // decimal points as specified by user
-            $decimals = get_user_preferences('grade_report_decimalpoints', $CFG->grade_report_decimalpoints);
+            $decimals = $this->get_pref('decimalpoints');
             $gradeval = number_format($gradeval, $decimals, $this->get_lang_string('decpoint', 'langconfig'),
                                       $this->get_lang_string('thousandsep', 'langconfig'));
         }
@@ -248,6 +257,22 @@ class grade_report {
         return $this->lang_strings[$strcode];
     }
 
-
+    /**
+     * Computes then returns the percentage value of the grade value within the given range.
+     * @param float $gradeval
+     * @param float $grademin
+     * @param float $grademx
+     * @return float $percentage
+     */
+    function grade_to_percentage($gradeval, $grademin, $grademax) {
+        if ($grademin >= $grademax) {
+            debugging("The minimum grade ($grademin) was higher than or equal to the maximum grade ($grademax)!!! Cannot proceed with computation.");
+        }
+        $offset_value = $gradeval - $grademin;
+        $offset_max = $grademax - $grademin;
+        $factor = 100 / $offset_max;
+        $percentage = $offset_value * $factor;
+        return $percentage;
+    }
 }
 ?>
diff --git a/grade/report/simpletest/testreportlib.php b/grade/report/simpletest/testreportlib.php
new file mode 100644 (file)
index 0000000..23946cf
--- /dev/null
@@ -0,0 +1,31 @@
+<?php // $Id$
+/**
+ * Unit tests for grade/report/lib.php.
+ *
+ * @author nicolas@moodle.com
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package moodlecore
+ */
+
+
+if (!defined('MOODLE_INTERNAL')) {
+    die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
+}
+
+require_once($CFG->dirroot.'/grade/report/lib.php');
+
+/**
+ * @TODO create a set of mock objects to simulate the database operations. We don't want to connect to any real sql server.
+ */
+class gradereportlib_test extends UnitTestCase {
+    var $courseid = 1;
+    var $context = null;
+    var $report = null;
+
+    function setUp() {
+        $this->report = new grade_report($this->courseid, $this->context);
+    }
+
+}
+
+?>
index 9616de54c2a9ba9af46bb850cf9eb323b4adc16c..44f3a24e5075e570c2c51baf85a1be9b32c5ac98 100644 (file)
@@ -32,7 +32,7 @@ $string['choosecategory'] = 'Select Category';
 $string['compact'] = 'Compact';
 $string['configaggregationposition'] = 'The position of the aggregation column in the grader report table, in reference to the raw grades.';
 $string['configaggregationview'] = 'The way aggregations are displayed: either alongside the raw grades, or in a compact form in which only one type is shown in the table at once: the raw grades OR the aggregated grades.';
-$string['configaveragesdisplaytype'] = 'Column averages can be shown as raw grades or as percentages (in reference to the minimum and maximum grades).';
+$string['configaveragesdisplaytype'] = 'Specifies how to display the averages for each column in the grader report. The default and recommended value is Inherit, which first checks the display type of each column, and if such is not set explicitly, defaults to the more general Grade Display Type. If Raw or Percentage are selected, they ignore the individual settings for each column, and use exclusively the selected type.';
 $string['configbulkcheckboxes'] = 'Checkboxes near each grade for Bulk grade operations.';
 $string['configdecimalpoints'] = 'The number of decimal points to display for each grade. This can be overriden per grading item.';
 $string['configenableajax'] = 'Adds a layer of AJAX functionality to the grader report, simplifying and speeding up common operations. Depends on Javascript being switched on at the user\'s browser level.';
@@ -47,6 +47,7 @@ $string['configshowgroups'] = 'Show group averages and means in the grader repor
 $string['configshowlocks'] = 'Whether to show a lock/unlock icon near each grade.';
 $string['configshowfeedback'] = 'Whether to show a feedback icon (for adding/editing) near each grade.';
 $string['configshowranges'] = 'Display a row showing the range of possible for each grading item in the grader report.';
+$string['configshowuserimage'] = 'Whether to show the user\'s profile image next to the name in the grader report.';
 $string['configstudentsperpage'] = 'The number of students to display per page in the grader report.';
 $string['contract'] = 'Contract Category';
 $string['createcategory'] = 'Create Category';
@@ -138,6 +139,7 @@ $string['importpreview'] = 'Import preview';
 $string['importsuccess'] = 'Grade import success';
 $string['importxml'] = 'Import XML';
 $string['incorrectcourseid'] = 'Course ID was incorrect';
+$string['inherit'] = 'Inherit';
 $string['item'] = 'Item';
 $string['iteminfo'] = 'Item info';
 $string['itemname'] = 'Item name';
@@ -212,14 +214,15 @@ $string['setting'] = 'Setting';
 $string['settings'] = 'Settings';
 $string['setweights'] = 'Set Weights';
 $string['showallstudents'] = 'Show All Students';
+$string['showaverages'] = 'Show column averages';
 $string['showcalculations'] = 'Show calculations';
 $string['showeyecons'] = 'Show show/hide icons';
-$string['showaverages'] = 'Show column averages';
+$string['showfeedback'] = 'Show feedback';
 $string['showgroups'] = 'Show groups';
+$string['showhiddenitems'] = 'Show Hidden Items';
 $string['showlocks'] = 'Show locks';
-$string['showfeedback'] = 'Show feedback';
 $string['showranges'] = 'Show ranges';
-$string['showhiddenitems'] = 'Show Hidden Items';
+$string['showuserimage'] = 'Show user profile images';
 $string['sort'] = 'sort';
 $string['sortasc'] = 'Sort in ascending order';
 $string['sortdesc'] = 'Sort in descending order';
index 60f8bf34aba532dfffa6a64624f3321a36ede20e..1a1e9a13723bd282498f9bc2491a43aeeae67134 100644 (file)
@@ -60,7 +60,7 @@ class grade_tree {
      * @param boolean $aggregation_view Either full view (0) or compact view (1)
      */
     function grade_tree($courseid, $fillers=true, $category_grade_last=false,
-                        $aggregation_view=GRADER_REPORT_AGGREGATION_VIEW_FULL) {
+                        $aggregation_view=GRADE_REPORT_AGGREGATION_VIEW_FULL) {
         global $USER;
 
         $this->courseid = $courseid;
index d6191d85956a8d4df22718da700ceb70a8e651bd..6707eefa3487aef5db6579ace509f33c9415ae5a 100644 (file)
@@ -69,12 +69,13 @@ define('GRADE_EDIT_DIR', $CFG->dirroot . '/grade/edit');
 define('GRADE_EDIT_URL', $CFG->wwwroot . '/grade/edit');
 
 // Grader reports
-define('GRADER_REPORT_AGGREGATION_POSITION_LEFT', 0);
-define('GRADER_REPORT_AGGREGATION_POSITION_RIGHT', 1);
-define('GRADER_REPORT_AGGREGATION_VIEW_FULL', 0);
-define('GRADER_REPORT_AGGREGATION_VIEW_COMPACT', 1);
-define('GRADER_REPORT_GRADE_DISPLAY_TYPE_RAW', 0);
-define('GRADER_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE', 1);
+define('GRADE_REPORT_AGGREGATION_POSITION_LEFT', 0);
+define('GRADE_REPORT_AGGREGATION_POSITION_RIGHT', 1);
+define('GRADE_REPORT_AGGREGATION_VIEW_FULL', 0);
+define('GRADE_REPORT_AGGREGATION_VIEW_COMPACT', 1);
+define('GRADE_REPORT_GRADE_DISPLAY_TYPE_RAW', 0);
+define('GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE', 1);
+define('GRADE_REPORT_GRADE_DISPLAY_TYPE_INHERIT', 2); // Inherit the value set for a particular grade_item (grade_report_gradedisplaytype{$itemid})
 
 require_once($CFG->libdir . '/grade/grade_category.php');
 require_once($CFG->libdir . '/grade/grade_item.php');
diff --git a/pix/t/grades.gif b/pix/t/grades.gif
new file mode 100644 (file)
index 0000000..e322351
Binary files /dev/null and b/pix/t/grades.gif differ
index dfa792b22696c5910b7d83d5ad56d260d19ea5b2..f479b70860299802a89f6c3e1bcbbeeb5a6a89d0 100644 (file)
@@ -5,45 +5,45 @@
     <meta name="keywords" content="moodle, <?php echo $title ?> " />
     <title><?php echo $title ?></title>
     <link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
-    
+
     <?php //include('ui/chameleon.php'); ?>
     <?php include("$CFG->javascript"); ?>
     <?php include('js/jquery.php'); ?>
-    
+
     <?php require_once($CFG->dirroot.'/lib/custom_corners_lib.php'); ?>
-    
+
     <?php
-        
+
         global $PAGE;
-        
+
         // handle pages which get displayed wrong
         // either no custom corners or too much
-        
+
         // all admin pages are build with the layout-table: sideblocks and content
         if (($PAGE->type == 'admin') && (strstr($bodytags, ' nocoursepage'))) {
             $bodytags = str_replace(' nocoursepage', '', $bodytags);
         }
-        
+
         // list of pages using the layout-table to be able to view sideblocks
         $excludelist = array('mod-chat-view', 'mod-data-view', 'mod-quiz-view',
             'my-index');
-        if ((in_array($PAGE->type, $excludelist)) && 
+        if ((in_array($PAGE->type, $excludelist)) &&
             (strstr($bodytags, ' nocoursepage'))) {
             $bodytags = str_replace(' nocoursepage', '', $bodytags);
         }
-        
+
         // add 'nocoursepage' to the list of CLASSes on the admin-roles pages
         preg_match('/id="([^"]*)"/i', $bodytags, $ids);
         if (($ids[1] == 'admin-roles-assign') || ($ids[1] == 'admin-roles-override')) {
             // exclude roles called from the admin area (courseid 1)
-            // include user roles for the Moodle user settings called 
+            // include user roles for the Moodle user settings called
             // from the start page
             if (($COURSE->id > 1) || ($_GET['contextid'] == 30)) {
                 preg_match('/class="([^"]*)"/i', $bodytags, $classes);
                 $classlist = explode (' ', $classes[1]);
                 if (!in_array('nocoursepage', $classlist)) {
                     array_push($classlist, 'nocoursepage');
-                    $bodytags = str_replace($classes[0], 
+                    $bodytags = str_replace($classes[0],
                         'class="'.implode(' ', $classlist).'"', $bodytags);
                 }
             }
         echo " onload=\"setfocus()\"";
     };
     ?>>
-    
-    <?php if(!empty($infooutput)) { ?> 
+
+    <?php if(!empty($infooutput)) { ?>
         <div id="infowrapper"><div id="infooverlay"><?php echo $infooutput; ?></div></div>
     <?php } ?>
 <div id="page">
-    
-<?php if ($home) {  // This is what gets printed on the home page only  
+
+<?php if ($home) {  // This is what gets printed on the home page only
 ?>
     <div id="header-home" class="clearfix">
       <?php print_custom_corners_start(TRUE); ?>
@@ -71,7 +71,7 @@
           <div class="headermenu"><?php echo $menu ?></div>
       <?php print_custom_corners_end(); ?>
     </div>
-<?php } else {  // This is what gets printed on any other page with a heading 
+<?php } else {  // This is what gets printed on any other page with a heading
 ?>
     <div id="header" class="clearfix">
       <?php print_custom_corners_start(); ?>
index 2433ca533edebf35a638cc90983d1bf1045d6034..d8dcd8544c42e86d8566afc2a6a65114684b2ca7 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2007071600;  // YYYYMMDD = date
+    $version = 2007071601;  // YYYYMMDD = date
                             //       XY = increments within a single day
 
     $release = '1.9 dev';   // Human-friendly version name