You are here

function sheetnode_phpexcel_batch_import in Sheetnode 7.2

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

API function to batch import several files using Batch API.

1 call to sheetnode_phpexcel_batch_import()
_sheetnode_phpexcel_import_form_submit in modules/sheetnode_phpexcel/sheetnode_phpexcel.import.inc

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.module, line 94
Module file for the sheetnode_phpexcel module. This manages handling of files for sheetnode.

Code

function sheetnode_phpexcel_batch_import($files, $destination = NULL, $callback = NULL, $params = array(), $batch = array()) {
  $batch += array(
    'finished' => '_sheetnode_phpexcel_batch_import_finished',
    'title' => t('Importing spreadsheets'),
    'init_message' => t('Import process is starting.'),
    'progress_message' => t('Imported @current out of @total files.'),
    'error_message' => t('Import process has encountered an error.'),
    'file' => drupal_get_path('module', 'sheetnode_phpexcel') . '/sheetnode_phpexcel.import.inc',
  );
  foreach ($files as $filename => $filepath) {
    $batch['operations'][] = array(
      '_sheetnode_phpexcel_batch_import_file',
      array(
        $filename,
        $filepath,
        $callback,
        $params,
      ),
    );
  }
  batch_set($batch);
  batch_process($destination);
}