-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2, 4.2.1, 4.2.2
-
MOODLE_401_STABLE, MOODLE_402_STABLE
-
MDL-79372-core_gradeexport_modification
-
Problem statement:
A request has been made to create a solution in relation to the grade exporter (/grade/export) that allows the following:
- Show the group the students belong to in the resulting file. As the Grade Export currently works, in the case that a user belongs to more than one group (and the group selection has not been previously made) will be display separated.
- Create a form that allows to decide, for each export, which User Profile Fields (either custom or default) will appear in the resulting file.
When analyzing the operation of the rating exporter, we have detected that the logic for the export is not generic, but that it resides in each of the export subplugins, since the export form is rendered in the index.php of the export subplugin that has been chosen:
- /grade/export/ods/index.php?id=xx
- /grade/export/txt/index.php?id=xx
- /grade/export/xls/index.php?id=xx
- /grade/export/xml/index.php?id=xx
This causes that any change that we want to make, if we do not want to touch core, would have to create a subplugin that acts modifying the logics of the other 4 subplugins, something that at architecture level we do not see adequate.
This applies to two major functionalities:
- The possibility of adding a form that is common for all the formats to be exported.
- The print of the different files to be exported.
Solution proposal:
We believe that the best solution to this problem would be to move all the export logic to a higher level, so that any modification can be made at a general level without having to modify the different subplugins or creating an extra one that acts against them.
To introduce this improvement, there are 3 key points, the rendering of the form, the processing of the form and the rendering/downloading of the file.
Rendering of the form:
How it currently works:
- Currently, all export subplugins instantiate the grade/export/grade_export_form.php form to render the form.
Changes to realize:
- New field additions (if applicable to all export types), are made in the grade/export/grade_export_form.php file centrally.
- The group selector field will only be shown to users with permissions to view the groups.
Processing of the form:
How it currently works:
- The processing of the parameters sent by the form is done from grade/export/{gradeexport_type}/export.php
- Once processed, those parameters are injected into the constructor, when creating a new instance of grade_export_{gradeexport_type}.
- Currently, user fields and custom user fields are taken into account, taking those values from the global configs: $CFG->grade_export_userprofilefields and from $CFG->grade_export_customprofilefields.
- Currently, the filtering by groups is taken into account but only when the course is configured by separate groups and the user does not have permissions to see the other groups.
Changes to realize:
- Extend the implementation of filtering groups and user fields so that if there is a filter defined in the form, it will be followed.
Rendering/downloading of the file:
How it currently works:
- The function print_grades@grade/export/{gradeexport_type}/grade_export_{gradeexport_type}.php (from the object instantiated in grade/export/{gradeexport_type}/export.php) takes care of formatting the data, deciding which columns will appear and triggering the file download.
- Currently, the gradeexport plugins already provide for filtering of user fields by the global settings, but does not add a column specifying the group that has been selected (in case it has been filtered by one by the separate group course settings).
Changes to realize:
- Update the print_grades functions of the exporters to add the group column, having filtered the export by group in the grade_export_form.
- has been marked as being related by
-
MDL-44939 grade_export_userprofilefields does not display any additional fields
- Reopened
-
MDL-66991 Removal of grade_export_userprofilefields from gradebook configuration
- Open
-
MDL-32304 add groups and cohorts information to Grade export
- Development in progress
- will be (partly) resolved by
-
MDL-79978 Provide code guidance to Grade export modification for UniMoodle project
- Closed