You are here

function _views_data_export_batch_process in Views data export 7.4

Same name and namespace in other branches
  1. 6.3 views_data_export.module \_views_data_export_batch_process()
  2. 6 views_data_export.module \_views_data_export_batch_process()
  3. 6.2 views_data_export.module \_views_data_export_batch_process()
  4. 7 views_data_export.module \_views_data_export_batch_process()
  5. 7.3 views_data_export.module \_views_data_export_batch_process()

Batch API callback. Handles all batching operations by executing the appropriate view.

1 string reference to '_views_data_export_batch_process'
views_data_export_plugin_display_export::execute_initial in plugins/views_data_export_plugin_display_export.inc
Initializes the whole export process and starts off the batch process.

File

./views_data_export.module, line 147
Provides the ability to export to specific

Code

function _views_data_export_batch_process($export_id, $display_id, $exposed_input, &$context) {

  // Don't show the admin menu on batch page, some people don't like it.
  if (module_exists('admin_menu')) {
    module_invoke('admin_menu', 'suppress');
  }

  // Fetch the view in question from our cache
  $view = views_data_export_view_retrieve($export_id);
  $view
    ->set_display($display_id);
  if (!empty($exposed_input)) {
    $view
      ->set_exposed_input($exposed_input);
  }

  // Inform the data_export display which export it corresponds to and execute
  if (!isset($view->display_handler->batched_execution_state)) {
    $view->display_handler->batched_execution_state = new stdClass();
  }
  $view->display_handler->batched_execution_state->eid = $export_id;
  $view->display_handler->views_data_export_cached_view_loaded = TRUE;
  $view
    ->execute_display($display_id);

  // Update batch api progress information
  $sandbox = $view->display_handler->batched_execution_state->sandbox;
  $context['finished'] = $sandbox['finished'];
  $context['message'] = $sandbox['message'];
  views_data_export_view_store($export_id, $view);
}