function _sheetnode_phpexcel_batch_export_finished in Sheetnode 7.2
Same name and namespace in other branches
- 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_batch_export_finished()
- 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_batch_export_finished()
Batch API callback upon export completion.
1 string reference to '_sheetnode_phpexcel_batch_export_finished'
- sheetnode_phpexcel_batch_export in modules/
sheetnode_phpexcel/ sheetnode_phpexcel.module - API function to batch export several sheets using Batch API.
File
- modules/
sheetnode_phpexcel/ sheetnode_phpexcel.export.inc, line 57 - Export sheetnodes through PHPExcel to xls or xlsx spreadsheets.
Code
function _sheetnode_phpexcel_batch_export_finished($success, $results, $operations) {
if ($success) {
PHPExcel_Settings::setPdfRenderer(PHPExcel_Settings::PDF_RENDERER_TCPDF, variable_get('sheetnode_phpexcel_pdf_renderer_path', DEFAULT_SHEETNODE_PHPEXCEL_PDF_RENDERER_PATH));
// Save to temporary file.
@set_time_limit(0);
$workbook = unserialize($results['workbook']);
$plugins = sheetnode_phpexcel_get_plugins();
$plugin = $plugins[$results['format']];
$writer = PHPExcel_IOFactory::createWriter($workbook, $plugin['php-excel-type']);
$tempname = tempnam(file_directory_temp(), 'sheetnode_phpexcel_');
$writer
->save($tempname);
// Save information for download link.
$_SESSION['sheetnode_phpexcel_download'] = array(
'tempname' => $tempname,
'filename' => _sheetnode_phpexcel_sanitize_filename($results['filename']) . '.' . $results['format'],
'format' => $results['format'],
'destination' => $results['destination'],
);
}
}