From 2673c733de5fb78a30760fb816861c8e05c134c9 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 28 Feb 2008 15:43:09 +0000 Subject: [PATCH] MDL-13718 New icon for "locked" state icon, for grades whose grade item is locked. Merging from MOODLE_19_STABLE --- grade/lib.php | 12 +++++++++--- lang/en_utf8/grades.php | 1 + pix/t/unlock_gray.gif | Bin 0 -> 91 bytes 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 pix/t/unlock_gray.gif diff --git a/grade/lib.php b/grade/lib.php index 2948aab9bb0..85b9cb61821 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -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 = ''.$strnonunlockable.''; + } elseif ($element['object']->is_locked()) { $icon = 'unlock'; $tooltip = $strunlock; diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php index 37fc54d00d0..d44385b2745 100644 --- a/lang/en_utf8/grades.php +++ b/lang/en_utf8/grades.php @@ -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 index 0000000000000000000000000000000000000000..a7b434a27c1c178ec6ceefb72726019b0b120d93 GIT binary patch literal 91 zcmZ?wbhEHbC$`m?mc_