You are here

function webform_clear_batch_rows in Webform 7.4

Batch API callback; Write the rows of the export to the export file.

1 string reference to 'webform_clear_batch_rows'
webform_results_clear_form_submit in includes/webform.report.inc
Form submit handler.

File

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

Code

function webform_clear_batch_rows($node, $batch_size, &$context) {

  // Initialize the results if this is the first execution of the batch
  // operation.
  if (!isset($context['results']['count'])) {
    $context['results'] = array(
      'count' => 0,
      'total' => webform_get_submission_count($node->nid),
      'node' => $node,
    );
  }

  // Clear a batch of submissions.
  $count = webform_results_clear($node->nid, $batch_size);
  $context['results']['count'] += $count;

  // Display status message.
  $context['message'] = t('Cleared @count of @total submissions...', array(
    '@count' => $context['results']['count'],
    '@total' => $context['results']['total'],
  ));
  $context['finished'] = $count > 0 ? $context['results']['count'] / $context['results']['total'] : 1.0;
}