Additional field in Quiz Results table for download to xls

Additional field in Quiz Results table for download to xls

by Bernard Bailey -
Number of replies: 3
Hi team,

Using Moodle 1.9 (20080430)

I require an additional field from the mdl_user table to be included in the Quiz Results export file.

The field I want to add is 'department'.

Is this possible in 1.9?
Cheers
Bernard
Average of ratings: -
In reply to Bernard Bailey

Re: Additional field in Quiz Results table for download to xls

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Bernard,
Ideally, all such export to Excel or text/csv or whatever processes should contain settings so that the teacher would be able to select from those student profile fields availabe to teacher the ones he would like to include in the report.
A general feature should be made available in moodle libraries so that the feature I am describing would be available to all modules, not just Quiz. Maybe something along the lines of MDL-17346.
It so happens that a similar feature has recently been requested for exporting data from the Questionnaire module.
Tim, what do you think?
Joseph
In reply to Bernard Bailey

Re: Additional field in Quiz Results table for download to xls

by Bernard Bailey -
Hi team,

I was able to edit C:\server\moodle19\moodle\mod\quiz\report\overview\report.php

Added at ~ line 185

$columns[]= 'department';
$headers[]= get_string('department');

Edited at ~line 347 to include mdl_user.department field.

'u.id AS userid, u.idnumber, u.department, u.firstname, u.lastname, u.picture, u.imagealt, ' .

Added at ~ line 488

if (in_array('department', $columns)){
$row[] = $attempt->department;
}

This provided the answer that I needed. I'm now looking into adding additional fields which appear in the mdl_user_info_data table.

Cheers
Bernard
In reply to Bernard Bailey

Ang: Re: Additional field in Quiz Results table for download to xls

by Ole Djurhuus -

Hi Bernard
I'm looking for the same solution.
Did you manage to add fields form the mdl_user_info_data table?
regards
Ole