Permalink
Browse files

MDL-34336 scorm: Updating export of interaction reports as csv, to us…

…e new csv exporter class
  • Loading branch information...
1 parent 87e9331 commit 0253b2603498756385304d6cfad957917dcd0e3a @ankitagarwal ankitagarwal committed Jul 30, 2012
Showing with 5 additions and 9 deletions.
  1. +5 −9 mod/scorm/report/interactions/report.php
@@ -327,13 +327,9 @@ function display($scorm, $cm, $course, $download) {
}
$rownum = 1;
} else if ($download == 'CSV') {
- $filename .= ".txt";
- header("Content-Type: application/download\n");
- header("Content-Disposition: attachment; filename=\"$filename\"");
- header("Expires: 0");
- header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
- header("Pragma: public");
- echo implode("\t", $headers)." \n";
+ $csvexport = new csv_export_writer("tab");
+ $csvexport->set_filename($filename, ".txt");
+ $csvexport->add_data($headers);
}
if (!$download) {
@@ -546,8 +542,7 @@ function display($scorm, $cm, $course, $download) {
}
$rownum++;
} else if ($download == 'CSV') {
- $text = implode("\t", $row);
- echo $text." \n";
+ $csvexport->add_data($row);
}
}
if (!$download) {
@@ -606,6 +601,7 @@ function display($scorm, $cm, $course, $download) {
$workbook->close();
exit;
} else if ($download == 'CSV') {
+ $csvexport->download_file();
exit;
}
} else {

0 comments on commit 0253b26

Please sign in to comment.