]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10211 Added all icons.
authornicolasconnault <nicolasconnault>
Thu, 28 Jun 2007 12:40:11 +0000 (12:40 +0000)
committernicolasconnault <nicolasconnault>
Thu, 28 Jun 2007 12:40:11 +0000 (12:40 +0000)
lang/en_utf8/grades.php
lib/gradelib.php

index f5d11f7c1b5d3e14d6209fdbfcffc273486feae2..9ef73aaa9e63216ebe448d1d2941e4e0ad85cc68 100644 (file)
@@ -17,6 +17,7 @@ $string['category'] = 'Category';
 $string['categoriesedit'] = 'Edit Categories';
 $string['categoryname'] = 'Category name';
 $string['choosecategory'] = 'Select Category';
+$string['contract'] = 'Contract Category';
 $string['createcategory'] = 'Create Category';
 $string['createcategoryerror'] = 'Could not create a new category';
 $string['creatinggradebooksettings'] = 'Creating Gradebook settings';
@@ -37,6 +38,7 @@ $string['errornocourse'] = 'Could not get course information';
 $string['errorreprintheadersnonnumeric'] = 'Received non-numeric value for reprint-headers';
 $string['exceptions'] = 'Exceptions';
 $string['excluded'] = 'Excluded';
+$string['expand'] = 'Expand Category';
 $string['exportods'] = 'Export ODS';
 $string['exporttxt'] = 'Export TXT';
 $string['exportxml'] = 'Export XML';
index b8cc8b4578ddc1a948fd75a42ffc136297ce3568..14625a7eea10970bbb9170a18e9f12b8ebeeadac 100644 (file)
@@ -45,6 +45,9 @@ define('GRADE_CHILDTYPE_CAT', 1);
 define('GRADE_ITEM', 0); // Used to compare class names with CHILDTYPE values
 define('GRADE_CATEGORY', 1); // Used to compare class names with CHILDTYPE values
 
+define('GRADE_CATEGORY_CONTRACTED', 0); // The state of a category header in the grader report
+define('GRADE_CATEGORY_EXPANDED', 1); // The state of a category header in the grader report
+
 define('GRADE_TYPE_NONE', 0);
 define('GRADE_TYPE_VALUE', 1);
 define('GRADE_TYPE_SCALE', 2);
@@ -704,6 +707,8 @@ function grade_get_icons($object, $tree) {
     $strhide           = get_string("hide");
     $strshow           = get_string("show");
     $strlock           = get_string("lock", 'grades');
+    $strswitch_minus   = get_string("contract", 'grades');
+    $strswitch_plus    = get_string("expand", 'grades');
     $strunlock         = get_string("unlock", 'grades');
 
     $html = '<div class="grade_icons">';
@@ -764,9 +769,21 @@ function grade_get_icons($object, $tree) {
               . "&amp;action=$lock_unlock$tree->commonvars\">\n";
         $html .= '<img src="'.$CFG->pixpath.'/t/'.$lock_unlock.'.gif" class="iconsmall" alt="'
               .${'str' . $lock_unlock}.'" title="'.${'str' . $lock_unlock}.'" /></a>'. "\n";
+        
+        // If object is a category, display expand/contract icon
+        if (get_class($object) == 'grade_category') {
+            $expand_contract = 'switch_minus'; // Default: expanded
 
-        if ($grade) {
+            $state = get_user_preferences('grade_category_' . $object->id, GRADE_CATEGORY_EXPANDED);
             
+            if ($state == GRADE_CATEGORY_CONTRACTED) {
+                $expand_contract = 'switch_plus';
+            }
+
+            $html .= '<a href="report.php?report=grader&amp;target=' . $identifier
+                  . "&amp;action=$expand_contract$tree->commonvars\">\n";
+            $html .= '<img src="'.$CFG->pixpath.'/t/'.$expand_contract.'.gif" class="iconsmall" alt="'
+                  .${'str' . $expand_contract}.'" title="'.${'str' . $expand_contract}.'" /></a>'. "\n";
         }
     } else {
         if ($USER->gradefeedback) {