function _sheetnode_phpexcel_export_download in Sheetnode 7.2
Same name and namespace in other branches
- 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_export_download()
- 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_export_download()
Page callback for 'sheetnode/export/download'.
1 string reference to '_sheetnode_phpexcel_export_download'
- sheetnode_phpexcel_menu in modules/
sheetnode_phpexcel/ sheetnode_phpexcel.module - Implements hook_menu().
File
- modules/
sheetnode_phpexcel/ sheetnode_phpexcel.export.inc, line 105 - Export sheetnodes through PHPExcel to xls or xlsx spreadsheets.
Code
function _sheetnode_phpexcel_export_download() {
if (empty($_SESSION['sheetnode_phpexcel_download'])) {
drupal_not_found();
}
$download = $_SESSION['sheetnode_phpexcel_download'];
$plugins = sheetnode_phpexcel_get_plugins();
$plugin = $plugins[$download['format']];
$headers = array(
'Content-Type' => $plugin['content-type'],
'Content-Disposition' => 'attachment; filename="' . $download['filename'] . '"',
'Cache-Control' => 'max-age=0',
);
file_transfer('temporary://' . drupal_basename($download['tempname']), $headers);
}