Skip to content

Commit

Permalink
MDL-18229 gradebook: Links to Single view via icons on Grade Report.
Browse files Browse the repository at this point in the history
  • Loading branch information
zbdd committed Oct 14, 2014
1 parent d124a60 commit 92c61fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
15 changes: 13 additions & 2 deletions grade/report/grader/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions grade/report/singleview/screens/grade/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions lang/en/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 92c61fe

Please sign in to comment.