function sheetnode_google_batch_import in Sheetnode 7
Same name and namespace in other branches
- 6 modules/sheetnode_google/sheetnode_google.module \sheetnode_google_batch_import()
- 7.2 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
File
- modules/
sheetnode_google/ sheetnode_google.module, line 11 - Module file for the sheetnode_google module. This extends sheetnodes to enable importing of Google sheets.
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);
}