MDL-18229 gradereport: updated index.php test to calculate navigation based on new class name 'gradereport_selectable_items'

This commit is contained in:
Aparup Banerjee 2014-10-06 11:12:03 +08:00 committed by Zachary Durber
parent 8ec7b088ef
commit 0a55da571a
8 changed files with 32 additions and 23 deletions

View file

@ -658,17 +658,24 @@ class grade_report_grader extends grade_report {
$userrow->cells[] = $usercell;
$userreportcell = new html_table_cell();
$userreportcell->attributes['class'] = 'userreport';
$userreportcell->header = true;
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
$userreportcell = new html_table_cell();
$userreportcell->attributes['class'] = 'userreport';
$userreportcell->header = true;
$a = new stdClass();
$a->user = $fullname;
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
$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));
}
if (has_capability('gradereport/singleview:view', $this->context)) {
$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)) . $singleview;
$userreportcell->text .= $singleview;
}
if ($userreportcell->text) {
$userrow->cells[] = $userreportcell;
}
@ -808,7 +815,8 @@ class grade_report_grader extends grade_report {
}
$singleview = '';
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
if (has_capability('gradereport/singleview:view', $this->context) &&
preg_match('/^item/', $type)) {
$url = new moodle_url('/grade/report/singleview/index.php', array(
'id' => $this->course->id,
'item' => 'grade',