You are here

function _sheetnode_phpexcel_export_download in Sheetnode 6

Same name and namespace in other branches
  1. 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_export_download()
  2. 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
Implementation of hook_menu().

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc, line 106

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($download['tempname'], $headers);
}