MDL-11717, dimmed_text class for hidden grade items in grader report
This commit is contained in:
@@ -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>';
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user