You are here

function webform_results_export_batch in Webform 7.4

Return a Batch API array of commands that will generate an export.

Parameters

$node: The webform node on which to generate the analysis.

string $format: (optional) Delimiter of the exported file.

array $options: (optional) An associative array of options that define the output format. These are generally passed through from the GUI interface. Possible options include:

  • sids: An array of submission IDs to which this export may be filtered. May be used to generate exports that are per-user or other groups of submissions.

Return value

array A Batch API array suitable to pass to batch_set().

2 calls to webform_results_export_batch()
drush_webform_export in ./webform.drush.inc
Exports a webform via drush.
webform_results_download_form_submit in includes/webform.report.inc
Submit handler for webform_results_download_form().

File

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

Code

function webform_results_export_batch($node, $format = 'delimited', array $options = array()) {
  $defaults = webform_results_download_default_options($node, $format);
  $options += $defaults;
  $options['range'] += $defaults['range'];
  return array(
    'operations' => array(
      array(
        'webform_results_batch_bof',
        array(
          $node,
          $format,
          $options,
        ),
      ),
      array(
        'webform_results_batch_headers',
        array(
          $node,
          $format,
          $options,
        ),
      ),
      array(
        'webform_results_batch_rows',
        array(
          $node,
          $format,
          $options,
        ),
      ),
      array(
        'webform_results_batch_eof',
        array(
          $node,
          $format,
          $options,
        ),
      ),
      array(
        'webform_results_batch_post_process',
        array(
          $node,
          $format,
          $options,
        ),
      ),
      array(
        'webform_results_batch_results',
        array(
          $node,
          $format,
          $options,
        ),
      ),
    ),
    'finished' => 'webform_results_batch_finished',
    'title' => t('Exporting submissions'),
    'init_message' => t('Creating export file'),
    'error_message' => t('The export file could not be created because an error occurred.'),
    'file' => drupal_get_path('module', 'webform') . '/includes/webform.report.inc',
  );
}