diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php
index 1fe237f15ae..3dee6d322d7 100644
--- a/grade/report/grader/lib.php
+++ b/grade/report/grader/lib.php
@@ -85,6 +85,8 @@ class grade_report_grader extends grade_report {
* */
var $canviewhidden;
+ var $preferences_page=false;
+
/**
* Constructor. Sets local copies of user preferences and initialises grade_tree.
* @param int $courseid
@@ -201,10 +203,13 @@ class grade_report_grader extends grade_report {
// Warn if the grade is out of bounds.
if (is_null($finalgrade)) {
// ok
- } else if ($finalgrade < $grade_item->grademin) {
- $errorstr = 'lessthanmin';
- } else if ($finalgrade > $grade_item->grademax) {
- $errorstr = 'morethanmax';
+ } else {
+ $bounded = $grade_item->bounded_grade($finalgrade);
+ if ($bounded > $finalgrade) {
+ $errorstr = 'lessthanmin';
+ } else if ($bounded < $finalgrade) {
+ $errorstr = 'morethanmax';
+ }
}
if ($errorstr) {
$user = get_record('user', 'id', $userid, '', '', '', '', 'id, firstname, lastname');
@@ -489,31 +494,38 @@ class grade_report_grader extends grade_report {
function get_headerhtml() {
global $CFG, $USER;
- $strsortasc = $this->get_lang_string('sortasc', 'grades');
- $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
- $strfirstname = $this->get_lang_string('firstname');
- $strlastname = $this->get_lang_string('lastname');
- $showuseridnumber = $this->get_pref('showuseridnumber');
+ $this->rowcount = 0;
+ $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
- if ($this->sortitemid === 'lastname') {
- if ($this->sortorder == 'ASC') {
- $lastarrow = print_arrow('up', $strsortasc, true);
+ if (!$fixedstudents) {
+ $strsortasc = $this->get_lang_string('sortasc', 'grades');
+ $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
+ $strfirstname = $this->get_lang_string('firstname');
+ $strlastname = $this->get_lang_string('lastname');
+ $showuseridnumber = $this->get_pref('showuseridnumber');
+
+ if ($this->sortitemid === 'lastname') {
+ if ($this->sortorder == 'ASC') {
+ $lastarrow = print_arrow('up', $strsortasc, true);
+ } else {
+ $lastarrow = print_arrow('down', $strsortdesc, true);
+ }
} else {
- $lastarrow = print_arrow('down', $strsortdesc, true);
+ $lastarrow = '';
}
- } else {
- $lastarrow = '';
+
+ if ($this->sortitemid === 'firstname') {
+ if ($this->sortorder == 'ASC') {
+ $firstarrow = print_arrow('up', $strsortasc, true);
+ } else {
+ $firstarrow = print_arrow('down', $strsortdesc, true);
+ }
+ } else {
+ $firstarrow = '';
+ }
+
}
- if ($this->sortitemid === 'firstname') {
- if ($this->sortorder == 'ASC') {
- $firstarrow = print_arrow('up', $strsortasc, true);
- } else {
- $firstarrow = print_arrow('down', $strsortdesc, true);
- }
- } else {
- $firstarrow = '';
- }
// Prepare Table Headers
$headerhtml = '';
@@ -521,7 +533,6 @@ class grade_report_grader extends grade_report {
$columns_to_unset = array();
-
foreach ($this->gtree->levels as $key=>$row) {
$columncount = 0;
if ($key == 0) {
@@ -529,38 +540,42 @@ class grade_report_grader extends grade_report {
// continue;
}
- $headerhtml .= '
';
-
- if ($key == $numrows - 1) {
- $headerhtml .= ''
- . $strfirstname . ' '
- . $firstarrow. '/ ' . $strlastname . ' '. $lastarrow .' ';
- if ($showuseridnumber) {
- if ('idnumber' == $this->sortitemid) {
- if ($this->sortorder == 'ASC') {
- $idnumberarrow = print_arrow('up', $strsortasc, true);
+ if ($fixedstudents) {
+ $headerhtml .= ' ';
+ } else {
+ $headerhtml .= ' ';
+ if ($key == $numrows - 1) {
+ $headerhtml .= ''
+ . $strfirstname . ' '
+ . $firstarrow. '/ ' . $strlastname . ' '. $lastarrow .' ';
+ if ($showuseridnumber) {
+ if ('idnumber' == $this->sortitemid) {
+ if ($this->sortorder == 'ASC') {
+ $idnumberarrow = print_arrow('up', $strsortasc, true);
+ } else {
+ $idnumberarrow = print_arrow('down', $strsortdesc, true);
+ }
} else {
- $idnumberarrow = print_arrow('down', $strsortdesc, true);
+ $idnumberarrow = '';
}
- } else {
- $idnumberarrow = '';
+ $headerhtml .= ''
+ . get_string('idnumber') . ' ' . $idnumberarrow . ' ';
+ }
+ } else {
+ $colspan='';
+ if ($showuseridnumber) {
+ $colspan = 'colspan="2" ';
}
- $headerhtml .= ''
- . get_string('idnumber') . ' ' . $idnumberarrow . ' ';
- }
- } else {
- $colspan='';
- if ($showuseridnumber) {
- $colspan = 'colspan="2" ';
- }
- $headerhtml .= ' ';
+ $headerhtml .= ' ';
- if ($showuseridnumber) {
- $columncount++;
+ if ($showuseridnumber) {
+ $columncount++;
+ }
}
}
+
foreach ($row as $columnkey => $element) {
$sort_link = '';
if (isset($element['object']->id)) {
@@ -594,7 +609,7 @@ class grade_report_grader extends grade_report {
}
// Element is a category
else if ($type == 'category') {
- $headerhtml .= ''
+ $headerhtml .= ' '
. shorten_text($element['object']->get_name());
$headerhtml .= $this->get_collapsing_icon($element);
@@ -626,7 +641,7 @@ class grade_report_grader extends grade_report {
}
$headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
- $headerhtml .= ' '
+ $headerhtml .= ' '
. shorten_text($headerlink) . $arrow;
$headerhtml .= ' ';
}
@@ -649,9 +664,10 @@ class grade_report_grader extends grade_report {
$strfeedback = $this->get_lang_string("feedback");
$strgrade = $this->get_lang_string('grade');
$gradetabindex = 1;
+ $numusers = count($this->users);
$showuserimage = $this->get_pref('showuserimage');
$showuseridnumber = $this->get_pref('showuseridnumber');
- $numusers = count($this->users);
+ $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
// Preload scale objects for items with a scaleid
$scales_list = '';
@@ -690,20 +706,25 @@ class grade_report_grader extends grade_report {
}
$columncount = 0;
- // Student name and link
- $user_pic = null;
- if ($showuserimage) {
- $user_pic = '' . print_user_picture($user, $this->courseid, NULL, 0, true) . '
';
- }
+ if ($fixedstudents) {
+ $studentshtml .= ' ';
+ } else {
+ // Student name and link
+ $user_pic = null;
+ if ($showuserimage) {
+ $user_pic = '' . print_user_picture($user, $this->courseid, null, 0, true) . '
';
+ }
- $studentshtml .= ' '
- .''.$user_pic
- .''
- .fullname($user).' ';
+ $studentshtml .= ' '
+ .''.$user_pic
+ .''
+ .fullname($user).' ';
+
+ if ($showuseridnumber) {
+ $studentshtml .= ''.
+ $user->idnumber.' ';
+ }
- if ($showuseridnumber) {
- $studentshtml .= ''.
- $user->idnumber.' ';
}
foreach ($this->gtree->items as $itemid=>$unused) {
@@ -737,7 +758,7 @@ class grade_report_grader extends grade_report {
$eid = $this->gtree->get_grade_eid($grade);
$element = array('eid'=>$eid, 'object'=>$grade, 'type'=>'grade');
- $cellclasses = 'cell c'.$columncount++;
+ $cellclasses = 'grade cell c'.$columncount++;
if ($item->is_category_item()) {
$cellclasses .= ' cat';
}
@@ -749,13 +770,23 @@ class grade_report_grader extends grade_report {
}
if ($grade->is_excluded()) {
- $cellclasses .= ' excluded';
+ // $cellclasses .= ' excluded';
}
- $studentshtml .= '';
+ $grade_title = '<div class="fullname">'.fullname($user).'</div>';
+ $grade_title .= '<div class="itemname">'.$item->get_name(true).'</div>';
+
+ if (!empty($grade->feedback) && !$USER->gradeediting[$this->courseid]) {
+ $grade_title .= '<div class="feedback">'
+ .wordwrap(trim(format_string($grade->feedback, $grade->feedbackformat)), 34, '<br/ >') . '</div>';
+ } else {
+
+ }
+
+ $studentshtml .= ' ';
if ($grade->is_excluded()) {
- $studentshtml .= get_string('excluded', 'grades') . ' ';
+ $studentshtml .= ''.get_string('excluded', 'grades') . ' ';
}
// Do not show any icons if no grade (no record in DB to match)
@@ -817,7 +848,7 @@ class grade_report_grader extends grade_report {
if ($gradeval < 1) {
$studentshtml .= '- ';
} else {
- $gradeval = (int)bounded_number($grade->grade_item->grademin, $gradeval, $grade->grade_item->grademax); //just in case somebody changes scale
+ $gradeval = $grade->grade_item->bounded_grade($gradeval); //just in case somebody changes scale
$studentshtml .= ''.$scales[$gradeval-1].' ';
}
} else {
@@ -839,9 +870,7 @@ class grade_report_grader extends grade_report {
// If quickfeedback is on, print an input element
if ($this->get_pref('showquickfeedback') and $grade->is_editable()) {
- if ($this->get_pref('quickgrading')) {
- $studentshtml .= ' ';
- }
+
$studentshtml .= ' ';
$studentshtml .= ' ';
- }
if ($item->needsupdate) {
$studentshtml .= ''.get_string('error').' ';
@@ -885,6 +907,138 @@ class grade_report_grader extends grade_report {
return $studentshtml;
}
+ function get_studentnameshtml() {
+ global $CFG, $USER;
+ $studentshtml = '';
+
+ $showuserimage = $this->get_pref('showuserimage');
+ $showuseridnumber = $this->get_pref('showuseridnumber');
+ $fixedstudents = empty($USER->screenreader) && $CFG->grade_report_fixedstudents;
+
+ $strsortasc = $this->get_lang_string('sortasc', 'grades');
+ $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
+ $strfirstname = $this->get_lang_string('firstname');
+ $strlastname = $this->get_lang_string('lastname');
+
+ if ($this->sortitemid === 'lastname') {
+ if ($this->sortorder == 'ASC') {
+ $lastarrow = print_arrow('up', $strsortasc, true);
+ } else {
+ $lastarrow = print_arrow('down', $strsortdesc, true);
+ }
+ } else {
+ $lastarrow = '';
+ }
+
+ if ($this->sortitemid === 'firstname') {
+ if ($this->sortorder == 'ASC') {
+ $firstarrow = print_arrow('up', $strsortasc, true);
+ } else {
+ $firstarrow = print_arrow('down', $strsortdesc, true);
+ }
+ } else {
+ $firstarrow = '';
+ }
+
+ if ($fixedstudents) {
+ $studentshtml .= '
+