} else {
$headerhtml .= '<tr class="heading r'.$this->rowcount++.'">';
if ($key == $numrows - 1) {
+ $colspan = 1;
+ if (has_capability('gradereport/user:view', $this->context)) {
+ $colspan++;
+ }
+ $colspan='colspan="'.$colspan.'"';
+
$sortfirstname = html_link::make(clone($this->baseurl), $strfirstname);
$sortfirstname->url->param('sortitemid', 'firstname');
$sortlastname = html_link::make(clone($this->baseurl), $strlastname);
$sortlastname->url->param('sortitemid', 'lastname');
- $headerhtml .= '<th class="header c'.$columncount++.'" scope="col">' . $OUTPUT->link($sortfirstname)
+ $headerhtml .= '<th '.$colspan.' class="header c'.$columncount++.'" scope="col">' . $OUTPUT->link($sortfirstname)
. $firstarrow. '/ ' . $OUTPUT->link($sortlastname) . $lastarrow .'</th>';
if ($showuseridnumber) {
if ('idnumber' == $this->sortitemid) {
$sortidnumber->url->param('sortitemid', 'idnumber');
$headerhtml .= '<th class="header cc'.$columncount++.' useridnumber" scope="col">' . $OUTPUT->link($sortidnumber) . $idnumberarrow . '</th>';
}
- } else {
- $colspan='';
+ } else {
+ $colspan = 1;
+ if (has_capability('gradereport/user:view', $this->context)) {
+ $colspan++;
+ }
if ($showuseridnumber) {
- $colspan = 'colspan="2" ';
+ $colspan++;
}
+ $colspan='colspan="'.$colspan.'"';
+
$headerhtml .= '<td '.$colspan.'class="cell c'.$columncount++.' topleft"> </td>';
if ($showuseridnumber) {
$userpic = $OUTPUT->container($OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)), 'userpic');
}
+ $userreportcell = '';
+
+ if (has_capability('gradereport/user:view', $this->context)) {
+ $a->user = fullname($user);
+ $strgradesforuser = get_string('gradesforuser', 'grades', $a);
+ $userreporticon = new moodle_action_icon();
+ $userreporticon->link->url = new moodle_url($CFG->wwwroot.'/grade/report/user/index.php', array('userid' => $user->id, 'id' => $this->course->id));
+ $userreporticon->image->add_class('iconsmall');
+ $userreporticon->image->src = $OUTPUT->old_icon_url('t/grades');
+ $userreporticon->image->alt = $strgradesforuser;
+ $userreportcell = '<th class="userreport">'.$OUTPUT->action_icon($userreporticon).'</th>';
+ }
+
$userlink = html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user));
$studentshtml .= '<tr class="r'.$this->rowcount++ . $rowclasses[$this->rowcount % 2] . '">'
.'<th class="c'.$columncount++.' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">'.$userpic
- .$OUTPUT->link($userlink).'</th>';
+ .$OUTPUT->link($userlink).$userreportcell.'</th>';
if ($showuseridnumber) {
$studentshtml .= '<th class="c'.$columncount++.' useridnumber" onclick="set_row(this.parentNode.rowIndex);">'.
$fixedcolumntable->add_class('fixed_grades_column');
$fixedcolumntable->bodyclasses = 'leftbody';
- $colspan = null;
+ $colspan = 1;
+
+ if (has_capability('gradereport/user:view', $this->context)) {
+ $colspan++;
+ }
+
if ($showuseridnumber) {
- $colspan = 2;
+ $colspan++;
}
$levels = count($this->gtree->levels) - 1;
$studentheader->scope = 'col';
$studentheader->header = true;
$studentheader->id = 'studentheader';
+ if (has_capability('gradereport/user:view', $this->context)) {
+ $studentheader->colspan = 2;
+ }
$studentheader->text = $OUTPUT->link($sortfirstname) . $firstarrow. '/ ' . $OUTPUT->link($sortlastname) . $lastarrow;
$headerrow->cells[] = $studentheader;
}
$usercell->text .= $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user)));
+
$userrow->cells[] = $usercell;
+ if (has_capability('gradereport/user:view', $this->context)) {
+ $userreportcell = new html_table_cell();
+ $userreportcell->add_class('userreport');
+ $userreportcell->header = true;
+ $a->user = fullname($user);
+ $strgradesforuser = get_string('gradesforuser', 'grades', $a);
+ $userreporticon = new moodle_action_icon();
+ $userreporticon->link->url = new moodle_url($CFG->wwwroot.'/grade/report/user/index.php', array('userid' => $user->id, 'id' => $this->course->id));
+ $userreporticon->image->add_class('iconsmall');
+ $userreporticon->image->src = $OUTPUT->old_icon_url('t/grades');
+ $userreporticon->image->alt = $strgradesforuser;
+ $userreportcell->text = $OUTPUT->action_icon($userreporticon);
+ $userrow->cells[] = $userreportcell;
+ }
+
if ($showuseridnumber) {
$idnumbercell = new html_table_cell();
$idnumbercell->add_classes(array('header', 'c0', 'useridnumber'));