You are here

function lingotek_config_update_selected in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lingotek.batch.inc \lingotek_config_update_selected()
2 calls to lingotek_config_update_selected()
lingotek_config_action_submit in ./lingotek.config.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 769
Central location for batch create functions, before control is handed off to individual batch command files.

Code

function lingotek_config_update_selected($lids) {
  $set_ids = !empty($lids) ? array_unique(LingotekSync::getSetIdsFromLids($lids)) : array();
  if (empty($set_ids)) {
    drupal_set_message(t('No statuses to be updated.'), 'status', FALSE);
    return;
  }
  $document_ids = LingotekSync::getConfigDocIdsFromSetIds($set_ids);
  $batch = array(
    'title' => t('Syncing Translation Progress with Lingotek'),
    'finished' => 'lingotek_config_progress_update_finished',
  );
  $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_update_config_progress',
        array(
          $segment,
        ),
      );
    }
    $offset += $offset_interval;
  } while (count($segment) >= $offset_interval);
  $batch['operations'] = $operations;
  $redirect = 'admin/settings/lingotek/manage/config';
  batch_set($batch);
  batch_process($redirect);
}