Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-30422 SCORM Fixing old variable use in interraction report

  • Loading branch information...
commit 6348043461a856a7e981769c4764cce17c7bdf05 1 parent 79b0fec
@ankitagarwal ankitagarwal authored
Showing with 14 additions and 7 deletions.
  1. +14 −7 mod/scorm/report/interactions/report.php
View
21 mod/scorm/report/interactions/report.php
@@ -111,6 +111,7 @@ function display($scorm, $cm, $course, $download) {
}
if ( !$nostudents ) {
// Now check if asked download of data
+ $coursecontext = context_course::instance($course->id);
if ($download) {
$filename = clean_filename("$course->shortname ".format_string($scorm->name, true,$formattextoptions));
}
@@ -128,9 +129,11 @@ function display($scorm, $cm, $course, $download) {
}
$columns[] = 'fullname';
$headers[] = get_string('name');
- if ($CFG->grade_report_showuseridnumber) {
- $columns[] = 'idnumber';
- $headers[] = get_string('idnumber');
+
+ $extrafields = get_extra_user_fields($coursecontext);
+ foreach ($extrafields as $field) {
+ $columns[] = $field;
+ $headers[] = get_user_field_name($field);
}
$columns[] = 'attempt';
$headers[] = get_string('attempt', 'scorm');
@@ -154,7 +157,8 @@ function display($scorm, $cm, $course, $download) {
// Construct the SQL
$select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
$select .= 'st.scormid AS scormid, st.attempt AS attempt, ' .
- 'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email ';
+ 'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email'.
+ get_extra_user_fields_sql($coursecontext, 'u', '', array('idnumber')) . ' ';
// This part is the same for all cases - join users and scorm_scoes_track tables
$from = 'FROM {user} u ';
@@ -207,7 +211,10 @@ function display($scorm, $cm, $course, $download) {
$table->column_suppress('picture');
$table->column_suppress('fullname');
- $table->column_suppress('idnumber');
+ // This is done to prevent redundant data, when a user has multiple attempts
+ foreach ($extrafields as $field) {
+ $table->column_suppress($field);
+ }
$table->no_sorting('start');
$table->no_sorting('finish');
@@ -410,8 +417,8 @@ function display($scorm, $cm, $course, $download) {
} else {
$row[] = fullname($scouser);
}
- if (in_array('idnumber', $columns)) {
- $row[] = $scouser->idnumber;
+ foreach ($extrafields as $field) {
+ $row[] = s($scouser->{$field});
}
if (empty($timetracks->start)) {
$row[] = '-';
Please sign in to comment.
Something went wrong with that request. Please try again.