Permalink
Browse files

grader report: MDL-21159 Link to user report does not respect $CFG->g…

…rade_profilereport setting.

Also, the report was generating invalid XHTML.
  • Loading branch information...
1 parent 7cf74b7 commit b9a18f1b17506084611be72f19d5309fd62439a1 @timhunt timhunt committed Dec 18, 2009
Showing with 6 additions and 3 deletions.
  1. +6 −3 grade/report/grader/lib.php
@@ -731,17 +731,17 @@ function get_studentshtml() {
}
$userreportcell = '';
- if (has_capability('gradereport/user:view', $this->context)) {
+ if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
$a->user = fullname($user);
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
- $userreportcell = '<th class="userreport"><a href="'.$CFG->wwwroot.'/grade/report/user/index.php?id='.$this->courseid.'&amp;userid='.$user->id.'">'
+ $userreportcell = '<th class="header userreport"><a href="'.$CFG->wwwroot.'/grade/report/'.$CFG->grade_profilereport.'/index.php?id='.$this->courseid.'&amp;userid='.$user->id.'">'
.'<img src="'.$CFG->pixpath.'/t/grades.gif" alt="'.$strgradesforuser.'" title="'.$strgradesforuser.'" /></a></th>';
}
$studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
.'<th class="c'.$columncount++.' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">'.$user_pic
.'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->course->id.'">'
- .fullname($user)."</a>$userreportcell</th>\n";
+ .fullname($user)."</a></th>$userreportcell\n";
if ($showuseridnumber) {
$studentshtml .= '<th class="c'.$columncount++.' useridnumber" onclick="set_row(this.parentNode.rowIndex);">'.
@@ -1172,6 +1172,9 @@ function get_avghtml($grouponly=false) {
}
$avghtml .= '<th class="header c0 range" '.$colspan.' scope="row">'.$straverage.'</th>';
}
+ if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
+ $avghtml .= '<th class="header userreport"></th>';
+ }
foreach ($this->gtree->items as $itemid=>$unused) {
$item =& $this->gtree->items[$itemid];

0 comments on commit b9a18f1

Please sign in to comment.