mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-15498: Completion: added idnumber to progress report table (if enabled)
This commit is contained in:
parent
14bea70caf
commit
f94988555e
2 changed files with 20 additions and 2 deletions
|
@ -18,6 +18,9 @@ $format=optional_param('format','',PARAM_ALPHA);
|
||||||
$excel=$format=='excelcsv';
|
$excel=$format=='excelcsv';
|
||||||
$csv=$format=='csv' || $excel;
|
$csv=$format=='csv' || $excel;
|
||||||
|
|
||||||
|
// Whether to show idnumber
|
||||||
|
$idnumbers=$CFG->grade_report_showuseridnumber;
|
||||||
|
|
||||||
function csv_quote($value) {
|
function csv_quote($value) {
|
||||||
global $excel;
|
global $excel;
|
||||||
if($excel) {
|
if($excel) {
|
||||||
|
@ -112,6 +115,15 @@ if(!$csv) {
|
||||||
get_string('lastname');
|
get_string('lastname');
|
||||||
}
|
}
|
||||||
print '</th>';
|
print '</th>';
|
||||||
|
|
||||||
|
if($idnumbers) {
|
||||||
|
print '<th>'.get_string('idnumber').'</th>';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if($idnumbers) {
|
||||||
|
print $sep;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activities
|
// Activities
|
||||||
|
@ -152,9 +164,15 @@ foreach($progress as $user) {
|
||||||
// User name
|
// User name
|
||||||
if($csv) {
|
if($csv) {
|
||||||
print csv_quote(fullname($user));
|
print csv_quote(fullname($user));
|
||||||
|
if($idnumbers) {
|
||||||
|
print $sep.csv_quote($user->idnumber);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr><th scope="row"><a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
print '<tr><th scope="row"><a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
||||||
$user->id.'&course='.$course->id.'">'.fullname($user).'</a></th>';
|
$user->id.'&course='.$course->id.'">'.fullname($user).'</a></th>';
|
||||||
|
if($idnumbers) {
|
||||||
|
print '<td>'.htmlspecialchars($user->idnumber).'</td>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Progress for each activity
|
// Progress for each activity
|
||||||
|
|
|
@ -569,7 +569,7 @@ class completion_info {
|
||||||
$roles=array();
|
$roles=array();
|
||||||
}
|
}
|
||||||
$users=get_role_users($roles,get_context_instance(CONTEXT_COURSE,$this->course->id),true,
|
$users=get_role_users($roles,get_context_instance(CONTEXT_COURSE,$this->course->id),true,
|
||||||
'u.id,u.firstname,u.lastname',
|
'u.id,u.firstname,u.lastname,u.idnumber',
|
||||||
$sortfirstname ? 'u.firstname ASC' : 'u.lastname ASC',true,$groupid);
|
$sortfirstname ? 'u.firstname ASC' : 'u.lastname ASC',true,$groupid);
|
||||||
$users=$users ? $users : array(); // In case it returns false
|
$users=$users ? $users : array(); // In case it returns false
|
||||||
return $users;
|
return $users;
|
||||||
|
@ -588,7 +588,7 @@ class completion_info {
|
||||||
* @param bool $sortfirstname If true, sort by first name, otherwise sort by
|
* @param bool $sortfirstname If true, sort by first name, otherwise sort by
|
||||||
* last name
|
* last name
|
||||||
* @param int $groupid Group ID or 0 (default)/false for all groups
|
* @param int $groupid Group ID or 0 (default)/false for all groups
|
||||||
* @return Array of user objects (like mdl_user id, firstname, lastname)
|
* @return Array of user objects (like mdl_user id, firstname, lastname, idnumber)
|
||||||
* containing an additional ->progress array of coursemoduleid => completionstate
|
* containing an additional ->progress array of coursemoduleid => completionstate
|
||||||
*/
|
*/
|
||||||
public function get_progress_all($sortfirstname=false,$groupid=0) {
|
public function get_progress_all($sortfirstname=false,$groupid=0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue