You are here

function webform_results_batch_eof in Webform 7.4

Batch API callback; Write the closing bytes in the export file.

1 string reference to 'webform_results_batch_eof'
webform_results_export_batch in includes/webform.report.inc
Return a Batch API array of commands that will generate an export.

File

includes/webform.report.inc, line 1553
This file includes helper functions for creating reports for webform.module.

Code

function webform_results_batch_eof($node, $format = 'delimited', $options = array(), &$context = NULL) {
  module_load_include('inc', 'webform', 'includes/webform.export');
  $exporter = webform_export_create_handler($format, $options);

  // We open the file for reading and writing, rather than just appending for
  // exporters that need to adjust the beginning of the files as well as the
  // end, i.e. webform_exporter_excel_xlsx::eof().
  $handle = fopen($options['file_name'], 'r+');
  if (!$handle) {
    return;
  }

  // Move pointer to the end of the file.
  fseek($handle, 0, SEEK_END);
  $exporter
    ->eof($handle, $context['results']['row_count'], $context['results']['col_count']);
  @fclose($handle);
}