department/export now uses the download system

This commit is contained in:
xdrm-brackets 2018-05-12 16:42:28 +02:00
parent 9093ce2d38
commit 56eb72ac55
2 changed files with 10 additions and 3 deletions

View File

@ -149,7 +149,7 @@ class exportController
} }
//set content type headers //set content type headers
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
//reating writer //reating writer
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet); $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet);
@ -170,7 +170,13 @@ class exportController
$writer->save("$tmpFilename"); $writer->save("$tmpFilename");
//get file content //get file content
echo file_get_contents($tmpFilename); return [
'headers' => [
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'Content-Disposition' => 'attachment; filename=archive.xsl'
],
'body' => file_get_contents($tmpFilename)
];
} }
} }

View File

@ -121,7 +121,8 @@
"GET": { "GET": {
"des": "Export the data of the current department and version to a Excel file", "des": "Export the data of the current department and version to a Excel file",
"per": [["cas_admin"]], "per": [["cas_admin"]],
"par": {} "par": {},
"opt": { "download": true }
} }
}, },
"version":{ "version":{