function lingotek_config_upload_selected in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.6 lingotek.config.inc \lingotek_config_upload_selected()
2 calls to lingotek_config_upload_selected()
- config_upload_edited in ./
lingotek.bulk_grid.inc - 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
File
- ./
lingotek.config.inc, line 519 - Config grid form elements
Code
function lingotek_config_upload_selected($lid_map) {
//allows for passing in an array of lids, not as efficient as passing a textgroup-lid map
//in some cases
if (is_array($lid_map) && isset($lid_map[0]) && !is_array($lid_map[0])) {
$lids = $lid_map;
$query = db_select('locales_source', 'ls');
$query
->addField('ls', 'textgroup');
$query
->addField('ls', 'lid');
$query
->condition('lid', $lids, 'IN');
$results = $query
->execute();
$lid_map = array();
foreach ($results as $result) {
$lid_map[$result->textgroup][$result->lid] = $result->lid;
}
}
$unique_set_ids = LingotekConfigSet::bulkGetSetId($lid_map);
$not_current_lids = !empty($unique_set_ids) ? LingotekConfigSet::getEditedLidsInSets($unique_set_ids) : array();
if (empty($not_current_lids) && empty($lid_map)) {
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');
}
foreach ($lid_map as $textgroup) {
LingotekConfigSet::markLidsNotCurrent($textgroup);
}
if (!empty($not_current_lids)) {
LingotekConfigSet::markLidsNotCurrent($not_current_lids);
}
// Update the translation_agent_id in the locales_target table to be owned by Lingotek
LingotekSync::updateLingotekTranslationAgentId($lid_map, LingotekSync::TRANSLATION_AGENT_ID_LINGOTEK);
$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, $lid_map);
$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
}