function tmgmt_local_tasks_languages in Translation Management Tool 7
Same name and namespace in other branches
- 8 translators/tmgmt_local/tmgmt_local.module \tmgmt_local_tasks_languages()
Gets all involved language pairs for given tasks.
Parameters
array $tasks: Array of tasks ids.
Return value
array Array of involved languages.
2 calls to tmgmt_local_tasks_languages()
- TMGMTLocalTestCase::testTranslatorSkillsForTasks in translators/
tmgmt_local/ tmgmt_local.test - tmgmt_local_get_translators_for_tasks in translators/
tmgmt_local/ tmgmt_local.module - Gets translators able to translate all given tasks.
File
- translators/
tmgmt_local/ tmgmt_local.module, line 554 - Main module file for the local translation module.
Code
function tmgmt_local_tasks_languages($tasks) {
$query = db_select('tmgmt_local_task', 't');
$query
->condition('tltid', $tasks);
$query
->join('tmgmt_job', 'j', 't.tjid = j.tjid');
$query
->fields('j', array(
'source_language',
'target_language',
));
$query
->groupBy('target_language');
$result = $query
->execute();
$languages = array();
foreach ($result as $row) {
if (empty($languages[$row->source_language]) || !in_array($row->target_language, $languages[$row->source_language])) {
$languages[$row->source_language][] = $row->target_language;
}
}
return $languages;
}