function lingotek_config_upload_selected in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.config.inc \lingotek_config_upload_selected()
2 calls to lingotek_config_upload_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_upload_edited in ./
lingotek.bulk_grid.inc
File
- ./
lingotek.config.inc, line 344 - Config grid form elements
Code
function lingotek_config_upload_selected($lids) {
$set_ids = array();
// You need to iterate through this (with multiple db queries) because this function will also assign the item to a new set and create a new set if necessary. With one query to get all set_ids, it might not do that.
foreach ($lids as $lid) {
$set_id = LingotekConfigSet::getSetId($lid);
$set_ids[] = $set_id;
}
$unique_set_ids = array_unique($set_ids);
$edited_lids = !empty($unique_set_ids) ? LingotekConfigSet::getEditedLidsInSets($unique_set_ids) : array();
$not_current_lids = array_merge($lids, $edited_lids);
if (empty($not_current_lids)) {
drupal_set_message(t('No config items have been edited and need to be uploaded at this time. To translate a config item for the first time, check the corresponding box and upload.'), 'status', FALSE);
drupal_goto('admin/settings/lingotek/manage/config');
}
LingotekConfigSet::markLidsNotCurrent($not_current_lids);
$batch = array(
'title' => t('Uploading Content To Lingotek'),
'finished' => 'lingotek_sync_upload_config_finished',
);
$operations = lingotek_get_sync_upload_config_batch_elements($unique_set_ids);
$batch['operations'] = $operations;
$redirect = 'admin/settings/lingotek/manage/config';
batch_set($batch);
batch_process($redirect);
// Run batch operations to upload all of the selected nodes to Lingotek
}