mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 10:56:56 +02:00
MDL-11069 grade export refactoring + removing internally calculated totals (we have already various totals in categories and calculations can be used too for that)
This commit is contained in:
parent
8a275c7242
commit
11745964a5
5 changed files with 92 additions and 139 deletions
|
@ -26,23 +26,22 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
|||
|
||||
class grade_export_ods extends grade_export {
|
||||
|
||||
var $format = 'ods'; // export format
|
||||
|
||||
/**
|
||||
* To be implemented by child classes
|
||||
*/
|
||||
function print_grades($feedback = false) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$this->load_grades();
|
||||
|
||||
require_once($CFG->dirroot.'/lib/odslib.class.php');
|
||||
|
||||
/// Whether this plugin is entitled to update export time
|
||||
if ($expplugins = explode(",", $CFG->gradeexport)) {
|
||||
if (in_array($this->format, $expplugins)) {
|
||||
if (in_array('ods', $expplugins)) {
|
||||
$export = true;
|
||||
} else {
|
||||
$export = false;
|
||||
$export = false;
|
||||
}
|
||||
} else {
|
||||
$export = false;
|
||||
|
@ -73,7 +72,6 @@ class grade_export_ods extends grade_export {
|
|||
$myxls->write_string(0,$pos++,strip_tags($column."_feedback"));
|
||||
}
|
||||
}
|
||||
$myxls->write_string(0,$pos,get_string("total"));
|
||||
|
||||
/// Print all the lines of data.
|
||||
$i = 0;
|
||||
|
@ -94,7 +92,7 @@ class grade_export_ods extends grade_export {
|
|||
$j=6;
|
||||
foreach ($studentgrades as $gradeitemid => $grade) {
|
||||
if (is_numeric($grade)) {
|
||||
$myxls->write_number($i,$j++,strip_tags($grade));
|
||||
$myxls->write_number($i,$j++,$grade);
|
||||
}
|
||||
else {
|
||||
$myxls->write_string($i,$j++,strip_tags($grade));
|
||||
|
@ -102,7 +100,7 @@ class grade_export_ods extends grade_export {
|
|||
|
||||
// writing comment if requested
|
||||
if ($feedback) {
|
||||
$myxls->write_string($i,$j++,array_shift($this->comments[$student->id]));
|
||||
$myxls->write_string($i,$j++,$this->comments[$student->id][$gradeitemid]);
|
||||
}
|
||||
|
||||
/// if export flag needs to be set
|
||||
|
@ -119,7 +117,6 @@ class grade_export_ods extends grade_export {
|
|||
$grade_grade->update();
|
||||
}
|
||||
}
|
||||
$myxls->write_number($i,$j,$this->totals[$student->id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue