]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13718 New icon for "locked" state icon, for grades whose grade item is locked...
authornicolasconnault <nicolasconnault>
Thu, 28 Feb 2008 15:43:09 +0000 (15:43 +0000)
committernicolasconnault <nicolasconnault>
Thu, 28 Feb 2008 15:43:09 +0000 (15:43 +0000)
grade/lib.php
lang/en_utf8/grades.php
pix/t/unlock_gray.gif [new file with mode: 0644]

index 2948aab9bb09c24164fa8ac2e925b6e63bb95a78..85b9cb618214aa854b1bdbd1be19a6bce6e21ed6 100644 (file)
@@ -1033,7 +1033,7 @@ class grade_structure {
     }
 
     /**
-     * Return locking icon for give element
+     * Return locking icon for given element
      * @param object $element
      * @return string
      */
@@ -1043,8 +1043,14 @@ class grade_structure {
         $strparams = $this->get_params_for_iconstr($element);
         $strunlock = get_string('unlockverbose', 'grades', $strparams);
         $strlock = get_string('lockverbose', 'grades', $strparams);
-
-        if ($element['object']->is_locked()) {
+        
+        // Don't allow an unlocking action for a grade whose grade item is locked: just print a state icon
+        if ($element['type'] == 'grade' && $element['object']->grade_item->is_locked()) {
+            $strparamobj = new stdClass();
+            $strparamobj->itemname = $element['object']->grade_item->itemname;
+            $strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
+            $action  = '<img src="'.$CFG->pixpath.'/t/unlock_gray.gif" alt="'.$strnonunlockable.'" class="iconsmall" title="'.$strnonunlockable.'"/>'; 
+        } elseif ($element['object']->is_locked()) {
             $icon = 'unlock';
             $tooltip = $strunlock;
 
index 37fc54d00d0e70b61a0783262b5a2d91a5c021b9..d44385b27457afc0496f6099c506fb6a01127dab 100644 (file)
@@ -340,6 +340,7 @@ $string['noidnumber'] = 'No id number';
 $string['nolettergrade'] = 'No letter grade for';
 $string['nomode'] = 'NA';
 $string['nonnumericweight'] = 'Received non-numeric value for';
+$string['nonunlockableverbose'] = 'This grade cannot be unlocked until $a->itemname is unlocked.';
 $string['nonweightedpct'] = 'non-weighted %%';
 $string['nooutcome'] = 'No outcome';
 $string['nopublish'] = 'Do not publish';
diff --git a/pix/t/unlock_gray.gif b/pix/t/unlock_gray.gif
new file mode 100644 (file)
index 0000000..a7b434a
Binary files /dev/null and b/pix/t/unlock_gray.gif differ