Skip to content

Commit

Permalink
MDL-13718 New icon for "locked" state icon, for grades whose grade it…
Browse files Browse the repository at this point in the history
…em is locked. Merging from MOODLE_19_STABLE
  • Loading branch information
nicolasconnault committed Feb 28, 2008
1 parent e2ae84a commit 2673c73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions grade/lib.php
Expand Up @@ -1033,7 +1033,7 @@ function get_hiding_icon($element, $gpr) {
}

/**
* Return locking icon for give element
* Return locking icon for given element
* @param object $element
* @return string
*/
Expand All @@ -1043,8 +1043,14 @@ function get_locking_icon($element, $gpr) {
$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;

Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/grades.php
Expand Up @@ -340,6 +340,7 @@
$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';
Expand Down
Binary file added pix/t/unlock_gray.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2673c73

Please sign in to comment.