]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11274, hide grades in the grader report if the current grades has no viewhidden...
authortoyomoyo <toyomoyo>
Fri, 14 Sep 2007 08:43:10 +0000 (08:43 +0000)
committertoyomoyo <toyomoyo>
Fri, 14 Sep 2007 08:43:10 +0000 (08:43 +0000)
grade/report/grader/lib.php
grade/report/lib.php
lang/en_utf8/moodle.php

index a3028083e03eab89b78c15bf03b1c8c643d3a58f..0eee15821705ebbb0ed2fb23d37fbb1878b538c3 100644 (file)
@@ -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 .= '<td class="cell c'.$columncount++.'">'.userdate($grade->timecreated,get_string('strftimedatetimeshort')).'</td>';                  } else {
+                        $studentshtml .= '<td class="cell c'.$columncount++.'">-</td>';
+                    }
+                    continue; 
+                }
+
                 $grade->courseid = $this->courseid;
                 $grade->grade_item =& $this->items[$itemid]; // this speedsup is_hidden() and other grade_grade methods
 
index a73366d544494fab33a88db700a54d2868188194..fda0f7b54313eacfeb88a54df0ebce662e263ea5 100755 (executable)
@@ -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 '<a href="' . $url . '">' . $modulename . '</a>';
+            
+            // 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 '<a href="' . $url . '">' . $modulename . '</a>';
+            } else {
+                return $modulename; 
+            }
         }
 
         return $modulename;
index 5a7a9fa22001cce8e1f33487b4d4046d945cae3f..0caa37f973ff67a1f14c1405e7fec739ad025c29 100644 (file)
@@ -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';