function lingotek_update_target_progress_batch_create in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.batch.inc \lingotek_update_target_progress_batch_create()
- 7.4 lingotek.batch.inc \lingotek_update_target_progress_batch_create()
- 7.5 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 513 - Central location for batch create functions, before control is handed off to individual batch command files.
Code
function lingotek_update_target_progress_batch_create($entity_type, $nids) {
$document_ids = LingotekSync::getDocIdsFromEntityIds($entity_type, $nids);
$batch = array(
'title' => t('Syncing Translation Progress with Lingotek'),
);
$operations = array();
$segment = array();
$offset = 0;
$offset_interval = 5;
$total_count = count($nids);
do {
$segment = array_slice($document_ids, $offset, $offset_interval, TRUE);
if ($segment_count = count($segment)) {
$operations[] = array(
'lingotek_get_and_update_target_progress',
array(
$entity_type,
$segment,
$offset,
$total_count,
),
);
}
$offset += $offset_interval;
} while (count($segment) >= $offset_interval);
$batch['operations'] = $operations;
$redirect = 'admin/settings/lingotek/manage/' . $entity_type;
batch_set($batch);
batch_process($redirect);
}