$gradestr = new object();
$gradestr->username = fullname($user);
$gradestr->itemname = $grade_item->get_name();
- $warnings[] = get_string($errorstr, 'grades', $gradestr);
+ $warnings[] = get_string($errorstr, 'grades', $gradestr);
}
} else if ($data_type == 'feedback') {
global $CFG;
if (is_numeric($this->sortitemid)) {
- $sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture
+ $sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
FROM {$CFG->prefix}grade_grades g RIGHT OUTER JOIN
{$CFG->prefix}user u ON (u.id = g.userid AND g.itemid = $this->sortitemid)
LEFT JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
}
$roles = explode(',', $this->gradebookroles);
$this->users = get_role_users($roles, $this->context, false,
- 'u.id, u.firstname, u.lastname', 'u.'.$this->sortitemid .' '. $this->sortorder . $sort2,
+ 'u.id, u.firstname, u.lastname, u.idnumber', 'u.'.$this->sortitemid .' '. $this->sortorder . $sort2,
false, $this->currentgroup, $this->page * $this->get_pref('studentsperpage'), $this->get_pref('studentsperpage'));
}
$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') {
$headerhtml .= '<th class="header c'.$columncount++.'" scope="col"><a href="'.$this->baseurl.'&sortitemid=firstname">'
. $strfirstname . '</a> '
. $firstarrow. '/ <a href="'.$this->baseurl.'&sortitemid=lastname">' . $strlastname . '</a>'. $lastarrow .'</th>';
- } else {
- $headerhtml .= '<td class="cell c'.$columncount++.' topleft"> </td>';
+ 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 = '';
+ }
+ $headerhtml .= '<th class="header c'.$columncount++.' useridnumber" scope="col"><a href="'.$this->baseurl.'&sortitemid=idnumber">'
+ . get_string('idnumber') . '</a> ' . $idnumberarrow . '</th>';
+ }
+ } else {
+ $colspan='';
+ if ($showuseridnumber) {
+ $colspan = 'colspan="2" ';
+ }
+
+ $headerhtml .= '<td '.$colspan.'class="cell c'.$columncount++.' topleft"> </td>';
+
+ if ($showuseridnumber) {
+ $columncount++;
+ }
}
foreach ($row as $columnkey => $element) {
$strgrade = $this->get_lang_string('grade');
$gradetabindex = 1;
$showuserimage = $this->get_pref('showuserimage');
+ $showuseridnumber = $this->get_pref('showuseridnumber');
$numusers = count($this->users);
// Preload scale objects for items with a scaleid
.'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->course->id.'">'
.fullname($user).'</a></th>';
+ if ($showuseridnumber) {
+ $studentshtml .= '<th class="header c'.$columncount++.' useridnumber" onclick="set_row(this.parentNode.rowIndex);">'.
+ $user->idnumber.'</a></th>';
+ }
+
foreach ($this->gtree->items as $itemid=>$unused) {
$item =& $this->gtree->items[$itemid];
$grade = $this->grades[$userid][$item->id];
$scales = explode(",", $scale->scale);
// reindex because scale is off 1
-
+
// MDL-12104 some previous scales might have taken up part of the array
// so this needs to be reset
$scaleopt = array();
$averagesdecimalpoints = $this->get_pref('averagesdecimalpoints');
$meanselection = $this->get_pref('meanselection');
$shownumberofgrades = $this->get_pref('shownumberofgrades');
+ $showuseridnumber = $this->get_pref('showuseridnumber');
$avghtml = '';
$avgcssclass = 'avg';
}
}
- $avghtml = '<tr class="' . $avgcssclass . ' r'.$this->rowcount++.'"><th class="header c0" scope="row">'.$straverage.'</th>';
+ $columncount=0;
+ $colspan='';
+ if ($showuseridnumber) {
+ $colspan = 'colspan="2" ';
+ }
+
+ $avghtml = '<tr class="' . $avgcssclass . ' r'.$this->rowcount++.'"><th class="header c0" '.$colspan.'scope="row">'.$straverage.'</th>';
- $columncount=1;
+ if ($showuseridnumber) {
+ $columncount++;
+ }
$gsql = str_replace('u.id', 'ra.userid', $groupsql); // hack
*/
function get_rangehtml() {
global $USER;
+ $showuseridnumber = $this->get_pref('showuseridnumber');
$scalehtml = '';
if ($this->get_pref('showranges')) {
$rangesdisplaytype = $this->get_pref('rangesdisplaytype');
$rangesdecimalpoints = $this->get_pref('rangesdecimalpoints');
+ $columncount=0;
+ $colspan='';
+ if ($showuseridnumber) {
+ $colspan = 'colspan="2" ';
+ }
+
$scalehtml = '<tr class="r'.$this->rowcount++.'">'
- . '<th class="header c0 range" scope="row">'.$this->get_lang_string('range','grades').'</th>';
+ . '<th class="header c0 range" '.$colspan.'scope="row">'.$this->get_lang_string('range','grades').'</th>';
+
+ if ($showuseridnumber) {
+ $columncount++;
+ }
- $columncount = 1;
foreach ($this->gtree->items as $itemid=>$unused) {
$item =& $this->gtree->items[$itemid];