department/export now uses the download system
This commit is contained in:
parent
9093ce2d38
commit
56eb72ac55
|
@ -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)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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":{
|
||||||
|
|
Loading…
Reference in New Issue