From d4795a07926a124b6b8838a1dba15c9b6da70f9e Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 8 Aug 2007 15:48:20 +0000 Subject: [PATCH] MDL-9628 When a timestamp is selected for locktime or hiddenuntil, the grader report now shows a new icon (lock or eye in front of a calendar), with a tooltip showing the selected date. Very useful :-) --- grade/lib.php | 42 ++++++++++++++++++++++++------- grade/report/grader/lib.php | 6 ++--- pix/t/hiddenuntil.gif | Bin 0 -> 205 bytes theme/standard/styles_layout.css | 5 ++++ 4 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 pix/t/hiddenuntil.gif diff --git a/grade/lib.php b/grade/lib.php index 9ecbbddbb1..b03b962744 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -429,7 +429,7 @@ function grade_build_nav($path, $pagename=null, $id=null) { $navigation = build_navigation($navlinks); return $navigation; - } +} /** * This class represents a complete tree of categories, grade_items and final grades, @@ -547,7 +547,7 @@ class grade_tree { and $element['children'][$sortorder]['object']->is_outcome_item()) { unset($element['children'][$sortorder]); - } else if ($element['children'][$sortorder]['type'] == 'category') { + } else if ($element['children'][$sortorder]['type'] == 'category') { grade_tree::no_outcomes($element['children'][$sortorder]); } } @@ -822,12 +822,23 @@ class grade_tree { } if ($element['object']->is_hidden()) { - $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=show&sesskey='.sesskey().'&eid='.$element['eid']; + $icon = 'show'; + $tooltip = ''; + + if ($element['object']->hidden > 1) { // Change the icon and add a tooltip showing the date + $icon = 'hiddenuntil'; + $tooltip = userdate($element['object']->hidden); + } + + $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=show&sesskey='.sesskey() + . '&eid='.$element['eid']; $url = $gpr->add_url_params($url); - $action = ''.$strshow.''; + $action = ''
+                     . $strshow.''; } else { - $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=hide&sesskey='.sesskey().'&eid='.$element['eid']; + $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=hide&sesskey='.sesskey() + . '&eid='.$element['eid']; $url = $gpr->add_url_params($url); $action = ''.$strhide.''; } @@ -850,20 +861,33 @@ class grade_tree { } if ($element['object']->is_locked()) { + $icon = 'unlock'; + $tooltip = ''; + + if ($element['object']->locktime > 1) { // Change the icon and add a tooltip showing the date + $icon = 'locktime'; + $tooltip = userdate($element['object']->locktime); + } + if (!has_capability('moodle/grade:manage', $this->context) and !has_capability('moodle/grade:unlock', $this->context)) { return ''; } - $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=unlock&sesskey='.sesskey().'&eid='.$element['eid']; + $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=unlock&sesskey='.sesskey() + . '&eid='.$element['eid']; $url = $gpr->add_url_params($url); - $action = ''.$strunlock.''; + $action = ''.$strunlock
+                     . ''; } else { if (!has_capability('moodle/grade:manage', $this->context) and !has_capability('moodle/grade:lock', $this->context)) { return ''; } - $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=lock&sesskey='.sesskey().'&eid='.$element['eid']; + $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.$this->courseid.'&action=lock&sesskey='.sesskey() + . '&eid='.$element['eid']; $url = $gpr->add_url_params($url); - $action = ''.$strlock.''; + $action = ''.$strlock.''; } return $action; } diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 710d0f53cf..8b17e22f95 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -352,7 +352,7 @@ class grade_report_grader extends grade_report { 'calculations' => 't/calc.gif', 'locks' => 't/lock.gif', 'averages' => 't/sigma.gif', - 'nooutcomes' => 'i/outcomes.gif'); + 'nooutcomes' => 't/outcomes.gif'); $pref_name = 'grade_report_show' . $type; @@ -634,9 +634,9 @@ class grade_report_grader extends grade_report { if ($this->get_pref('quickgrading') and $grade->is_editable()) { $oldval = empty($gradeval) ? -1 : $gradeval; if (empty($item->outcomeid)) { - $nogradestr = $this->get_lang_string('nograde'); + $nogradestr = $this->get_lang_string('nograde'); } else { - $nogradestr = $this->get_lang_string('nooutcome', 'grades'); + $nogradestr = $this->get_lang_string('nooutcome', 'grades'); } $studentshtml .= ''; diff --git a/pix/t/hiddenuntil.gif b/pix/t/hiddenuntil.gif new file mode 100644 index 0000000000000000000000000000000000000000..ae8612976e8b8e0213cbd76f65c3ac11ab021806 GIT binary patch literal 205 zcmZ?wbhEHb(oH=vm z&!4|&(W1qR7q3~fX5G4V8#iv;v}x0>UAuPg-hJ@k!4oG=ynFZV