diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index f9feea807d88e..677f10a5a767f 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -665,8 +665,10 @@ public function get_left_rows($displayaverages) { $a = new stdClass(); $a->user = $fullname; $strgradesforuser = get_string('gradesforuser', 'grades', $a); + $url = new moodle_url('/grade/report/singleview/index.php', array('id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user')); + $singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades', $fullname))); $url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php', array('userid' => $user->id, 'id' => $this->course->id)); - $userreportcell->text = $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser)); + $userreportcell->text = $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser)) . $singleview; $userrow->cells[] = $userreportcell; } @@ -805,8 +807,17 @@ public function get_right_rows($displayaverages) { $itemcell->attributes['class'] .= ' dimmed_text'; } + $singleview = ''; + if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) { + $url = new moodle_url('/grade/report/singleview/index.php', array( + 'id' => $this->course->id, + 'item' => 'grade', + 'itemid' => $element['object']->id)); + $singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades', $element['object']->itemname))); + } + $itemcell->colspan = $colspan; - $itemcell->text = shorten_text($headerlink) . $arrow; + $itemcell->text = shorten_text($headerlink) . $arrow . $singleview; $itemcell->header = true; $itemcell->scope = 'col'; diff --git a/grade/report/singleview/screens/grade/lib.php b/grade/report/singleview/screens/grade/lib.php index 362b9fd22fa04..3a894d9db4346 100644 --- a/grade/report/singleview/screens/grade/lib.php +++ b/grade/report/singleview/screens/grade/lib.php @@ -169,9 +169,9 @@ public function format_line($item) { $url = new moodle_url("/user/view.php", array('id' => $item->id, 'course' => $this->courseid)); $line = array( - $OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', get_string('filtergrades', 'gradereport_singleview', $fullname))), + $OUTPUT->action_icon($this->format_link('user', $item->id), new pix_icon('t/editstring', get_string('filtergrades', 'gradereport_singleview', $fullname))), $OUTPUT->user_picture($item), - html_writer::tag('a', $fullname, array('href' => $url)), + html_writer::link($url, $fullname), $this->item_range() ); return $this->format_definition($line, $grade); diff --git a/lang/en/grades.php b/lang/en/grades.php index 31816c06ca4ce..122d155453e01 100644 --- a/lang/en/grades.php +++ b/lang/en/grades.php @@ -309,6 +309,7 @@ $string['graderreport'] = 'Grader report'; $string['grades'] = 'Grades'; $string['gradesforuser'] = 'Grades for {$a->user}'; +$string['singleview'] = 'Single view for {$a}'; $string['gradesonly'] = 'Grades only'; $string['gradessettings'] = 'Grade settings'; $string['gradetype'] = 'Grade type';