You are here

function sheetnode_phpexcel_batch_export in Sheetnode 7.2

Same name and namespace in other branches
  1. 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \sheetnode_phpexcel_batch_export()
  2. 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \sheetnode_phpexcel_batch_export()

API function to batch export several sheets using Batch API.

2 calls to sheetnode_phpexcel_batch_export()
sheetnode_phpexcel_plugin_style::render in modules/sheetnode_phpexcel/sheetnode_phpexcel_plugin_style.inc
Render sheetnode plugin style.
_sheetnode_phpexcel_export in modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc
Helper function to export a node using PHPExcel.

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.module, line 113
Module file for the sheetnode_phpexcel module. This manages handling of files for sheetnode.

Code

function sheetnode_phpexcel_batch_export($sheets, $filename, $format, $destination = NULL, $batch = array()) {
  $batch += array(
    'finished' => '_sheetnode_phpexcel_batch_export_finished',
    'title' => t('Exporting spreadsheets'),
    'init_message' => t('Export process is in progress. This can take a long time for large sheets...'),
    'progress_message' => t('Exported @current out of @total sheets.'),
    'error_message' => t('Export process has encountered an error.'),
    'file' => drupal_get_path('module', 'sheetnode_phpexcel') . '/sheetnode_phpexcel.export.inc',
  );
  foreach ($sheets as $title => $socialcalc) {
    $batch['operations'][] = array(
      '_sheetnode_phpexcel_batch_export_sheet',
      array(
        $title,
        $socialcalc,
        $filename,
        $format,
        $destination ? $destination : $_SERVER['HTTP_REFERER'],
      ),
    );
  }
  batch_set($batch);
  batch_process('sheetnode/export/ready');
}