]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix for MDL-11717, dimmed_text class for hidden grade items in grader report
authortoyomoyo <toyomoyo>
Fri, 12 Oct 2007 07:18:41 +0000 (07:18 +0000)
committertoyomoyo <toyomoyo>
Fri, 12 Oct 2007 07:18:41 +0000 (07:18 +0000)
grade/report/grader/lib.php
grade/report/lib.php

index 82011d2f4240ad5f10f98c61dd4d5969ecb2756f..4fe96a66e4595bcc85dbaa9784092ba5436624fb 100644 (file)
@@ -575,7 +575,7 @@ class grade_report_grader extends grade_report {
                                 .$this->get_lang_string('manualgrade', 'grades') .'"/>';
                     }
 
-                    $headerlink = $this->get_module_link($element['object']->get_name(), $itemmodule, $iteminstance);
+                    $headerlink = $this->get_module_link($element['object']->get_name(), $itemmodule, $iteminstance, $element['object']->is_hidden());
                     $headerhtml .= '<th class="header '.$columnclass.' '.$type.$catlevel.$dimmed.'" scope="col">'. $headerlink . $arrow;
                     $headerhtml .= $this->get_icons($element) . '</th>';
 
index e443c7f0fdab7b530c921dccaeb072f48d691022..31591958d9b88e9fc5a9714709dc94d03544182b 100755 (executable)
@@ -336,9 +336,10 @@ class grade_report {
      * @param string $modulename The shortname of the module, will become the visible header
      * @param string $itemmodule The name of the module type (e.g. assignment, quiz...)
      * @param int $iteminstance The instance number of the module
+     * @param bool itemhidden - if the grade item is hidden
      * @return string HTML
      */
-    function get_module_link($modulename, $itemmodule=null, $iteminstance=null) {
+    function get_module_link($modulename, $itemmodule=null, $iteminstance=null, $itemhidden=false) {
         global $CFG;
 
         $link = null;
@@ -361,8 +362,11 @@ class grade_report {
             }
 
             $url .= "?id=$coursemodule->id";
-
-            return '<a href="' . $url . '">' . $modulename . '</a>';
+            if ($itemhidden && has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $coursemodule->course))) {
+                return '<a href="' . $url . '"><span class="dimmed_text">' . $modulename . '</div></a>';
+            } else {
+                return '<a href="' . $url . '">' . $modulename . '</a>';
+            }
         }
 
         return $modulename;