You are here

function sheetnode_google_batch_import in Sheetnode 7.2

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

API function to batch import several files using Batch API.

1 call to sheetnode_google_batch_import()
_sheetnode_google_import_form_submit in modules/sheetnode_google/sheetnode_google.import.inc
Internal google import form submit.

File

modules/sheetnode_google/sheetnode_google.module, line 13
Module file for the sheetnode_google module.

Code

function sheetnode_google_batch_import($username, $password, $keys, $destination = NULL, $callback = NULL, $params = array(), $batch = array()) {
  $batch += array(
    'finished' => '_sheetnode_google_batch_import_finished',
    'title' => t('Importing spreadsheets'),
    'init_message' => t('Import process is starting.'),
    'progress_message' => t('Imported @current out of @total spreadsheets.'),
    'error_message' => t('Import process has encountered an error.'),
    'file' => drupal_get_path('module', 'sheetnode_google') . '/sheetnode_google.import.inc',
  );
  foreach ($keys as $key) {
    $batch['operations'][] = array(
      '_sheetnode_google_batch_import',
      array(
        $username,
        $password,
        $key,
        $callback,
        $params,
      ),
    );
  }
  batch_set($batch);
  batch_process($destination);
}