From: toyomoyo Date: Fri, 14 Sep 2007 08:43:10 +0000 (+0000) Subject: MDL-11274, hide grades in the grader report if the current grades has no viewhidden... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=00374cc5f0d1549ddfc6d4a8cfd49b2501b444af;p=moodle.git MDL-11274, hide grades in the grader report if the current grades has no viewhidden capability --- diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index a3028083e0..0eee158217 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -591,6 +591,8 @@ class grade_report_grader extends grade_report { $scales_list = substr($scales_list, 0, -1); $scales_array = get_records_list('scale', 'id', $scales_list); } + + $canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id)); foreach ($this->users as $userid => $user) { $columncount = 0; @@ -620,6 +622,16 @@ class grade_report_grader extends grade_report { $grade->feedback = ''; } + // MDL-11274 + // Hide grades in the grader report if the current grader doesn't have 'moodle/grade:viewhidden' + if ($grade->is_hidden() && !$canviewhidden) { + if (isset($grade->finalgrade)) { + $studentshtml .= ''.userdate($grade->timecreated,get_string('strftimedatetimeshort')).''; } else { + $studentshtml .= '-'; + } + continue; + } + $grade->courseid = $this->courseid; $grade->grade_item =& $this->items[$itemid]; // this speedsup is_hidden() and other grade_grade methods diff --git a/grade/report/lib.php b/grade/report/lib.php index a73366d544..fda0f7b543 100755 --- a/grade/report/lib.php +++ b/grade/report/lib.php @@ -328,7 +328,7 @@ class grade_report { } $coursemodule = get_coursemodule_from_instance($itemmodule, $iteminstance, $this->course->id); - + $dir = $CFG->dirroot . "/mod/$itemmodule/"; $url = $CFG->wwwroot . "/mod/$itemmodule/"; @@ -339,7 +339,13 @@ class grade_report { } $url .= "?id=$coursemodule->id"; - return '' . $modulename . ''; + + // MDL-11274, Hide grades in the grader report if the current grader doesn't have 'moodle/grade:viewhidden' + if (has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $coursemodule->course))) { + return '' . $modulename . ''; + } else { + return $modulename; + } } return $modulename; diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 5a7a9fa220..0caa37f973 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -1381,6 +1381,7 @@ $string['status'] = 'Status'; $string['strftimedate'] = '%%d %%B %%Y'; $string['strftimedateshort'] = '%%d %%B'; $string['strftimedatetime'] = '%%d %%B %%Y, %%I:%%M %%p'; +$string['strftimedatetimeshort'] = '%%d/%%m/%%Y %%H:%%M'; $string['strftimedaydate'] = '%%A, %%d %%B %%Y'; $string['strftimedaydatetime'] = '%%A, %%d %%B %%Y, %%I:%%M %%p'; $string['strftimedayshort'] = '%%A, %%d %%B';