function lingotek_grid_download_ready in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lingotek.bulk_grid.inc \lingotek_grid_download_ready()
- 7.5 lingotek.bulk_grid.inc \lingotek_grid_download_ready()
- 7.6 lingotek.bulk_grid.inc \lingotek_grid_download_ready()
1 string reference to 'lingotek_grid_download_ready'
- lingotek_menu in ./
lingotek.module - Implements hook_menu().
File
- ./
lingotek.bulk_grid.inc, line 653 - Bulk Grid form
Code
function lingotek_grid_download_ready() {
$targets = LingotekSync::getTargetsByStatus(LingotekSync::STATUS_READY);
$sync_success_target = LingotekSync::STATUS_CURRENT;
if (!empty($targets)) {
$nids = array();
foreach ($targets as $target) {
$nids[] = $target['nid'];
}
$nodes = node_load_multiple($nids);
$operations = array();
foreach ($targets as $target) {
if ($nodes[$target['nid']]->lingotek['profile'] != LingotekSync::PROFILE_DISABLED) {
// exclude nodes with PROFILE_DISABLED
$operations[] = array(
'lingotek_sync_download_node_target',
array(
$target['nid'],
$target['locale'],
$sync_success_target,
FALSE,
),
);
}
}
$redirect = 'admin/settings/lingotek/manage';
$batch = array(
'title' => t('Downloading Translations'),
'finished' => 'lingotek_sync_download_target_finished',
);
$batch['operations'] = $operations;
batch_set($batch);
batch_process($redirect);
// Run batch operations to upload all of the selected nodes to Lingotek
}
else {
drupal_set_message(t('There are no translations ready for download.'));
drupal_goto('admin/settings/lingotek/manage/list');
}
}