You are here

function lingotek_update_target_progress_batch_create in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.batch.inc \lingotek_update_target_progress_batch_create()
  2. 7.5 lingotek.batch.inc \lingotek_update_target_progress_batch_create()
  3. 7.6 lingotek.batch.inc \lingotek_update_target_progress_batch_create()
2 calls to lingotek_update_target_progress_batch_create()
lingotek_grid_action_submit in ./lingotek.bulk_grid.inc
Submit function for The Grid's actions The action corresponds to the key of the option selected Often redirects to batch operations or to other pages entirely
lingotek_grid_update in ./lingotek.bulk_grid.inc

File

./lingotek.batch.inc, line 706
Central location for batch create functions, before control is handed off to individual batch command files.

Code

function lingotek_update_target_progress_batch_create($nids) {
  $document_ids = LingotekSync::getDocIdsFromNodeIds($nids);
  $batch = array(
    'title' => t('Syncing Translation Progress with Lingotek'),
  );
  $operations = array();
  $segment = array();
  $offset = 0;
  $offset_interval = 5;
  do {
    $segment = array_slice($document_ids, $offset, $offset_interval, TRUE);
    if (!empty($segment)) {
      $operations[] = array(
        'lingotek_get_and_update_target_progress',
        array(
          $segment,
        ),
      );
    }
    $offset += $offset_interval;
  } while (count($segment) >= $offset_interval);
  $batch['operations'] = $operations;
  $redirect = 'admin/settings/lingotek/manage/list';
  batch_set($batch);
  batch_process($redirect);
}