MDL-44447 grade_export: Added multiple grade display types to grade export.

This commit is contained in:
Simey Lameze 2014-08-22 10:50:08 +08:00
parent 482abd0f70
commit be289f57b2
17 changed files with 150 additions and 47 deletions

View file

@ -37,7 +37,7 @@ if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('
print_error('cannotaccessgroup', 'grades');
}
}
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true));
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true, 'multipledisplaytypes' => true));
$data = $mform->get_data();
// print all the exported data here

View file

@ -67,7 +67,9 @@ class grade_export_ods extends grade_export {
$myxls->write_string(0, $pos++, get_string("suspended"));
}
foreach ($this->columns as $grade_item) {
$myxls->write_string(0, $pos++, $this->format_column_name($grade_item));
foreach ($this->displaytype as $gradedisplayname => $gradedisplayconst) {
$myxls->write_string(0, $pos++, $this->format_column_name($grade_item, false, $gradedisplayname));
}
// Add a column_feedback column.
if ($this->export_feedback) {
@ -101,12 +103,13 @@ class grade_export_ods extends grade_export {
$status = $geub->track($grade);
}
$gradestr = $this->format_grade($grade);
if (is_numeric($gradestr)) {
$myxls->write_number($i,$j++,$gradestr);
}
else {
$myxls->write_string($i,$j++,$gradestr);
foreach ($this->displaytype as $gradedisplayconst) {
$gradestr = $this->format_grade($grade, $gradedisplayconst);
if (is_numeric($gradestr)) {
$myxls->write_number($i, $j++, $gradestr);
} else {
$myxls->write_string($i, $j++, $gradestr);
}
}
// writing feedback if requested

View file

@ -43,7 +43,8 @@ if (!empty($CFG->gradepublishing)) {
$actionurl = new moodle_url('/grade/export/ods/export.php');
$formoptions = array(
'publishing' => true,
'simpleui' => true
'simpleui' => true,
'multipledisplaytypes' => true
);
$mform = new grade_export_form($actionurl, $formoptions);