function lingotek_get_target_status in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.3 lingotek.dashboard.inc \lingotek_get_target_status()
- 7.4 lingotek.dashboard.inc \lingotek_get_target_status()
Get the status of the target given by locale
2 calls to lingotek_get_target_status()
- lingotek_dashboard_command_ajax in ./
lingotek.dashboard.inc - Ajax Command Processing for the Lingotek dashboard.
- lingotek_get_dashboard_code in ./
lingotek.dashboard.inc - Generates the code for the embedded Javascript dashboard.
File
- ./
lingotek.dashboard.inc, line 431 - Lingotek Dashboard.
Code
function lingotek_get_target_status($lingotek_locale = NULL) {
$response = array();
$target_languages = LingotekAccount::instance()
->getManagedTargets(TRUE);
// If we get a parameter, only return that language. Otherwise return all the codes (dont return the source language).
if (!is_null($lingotek_locale)) {
$drupal_language_code = Lingotek::convertLingotek2Drupal($lingotek_locale);
$target_is_active = in_array($lingotek_locale, array_keys($target_languages));
$edited = lingotek_count_node_targets(LINGOTEK_TARGET_SYNC_STATUS_EDITED, $lingotek_locale);
$pending = lingotek_count_node_targets(LINGOTEK_TARGET_SYNC_STATUS_PENDING, $lingotek_locale);
$current = lingotek_count_node_targets(LINGOTEK_TARGET_SYNC_STATUS_CURRENT, $lingotek_locale);
$total = $edited + $pending + $current;
$response = array(
'code' => $lingotek_locale,
// Return this language code as the Lingotek language code.
'dcode' => $drupal_language_code,
'active' => $target_is_active,
'docs' => $total,
'pending' => $pending,
'edited' => $edited,
'current' => $current,
);
}
else {
// Otherwise Return a List of all the Active Languages
foreach ($target_languages as $target) {
$drupal_language_code = $target->language;
$lingotek_locale = $target->lingotek_locale;
//Lingotek::convertDrupal2Lingotek($drupal_language_code)
$edited = lingotek_count_node_targets(LINGOTEK_TARGET_SYNC_STATUS_EDITED, $lingotek_locale);
$pending = lingotek_count_node_targets(LINGOTEK_TARGET_SYNC_STATUS_PENDING, $lingotek_locale);
$current = lingotek_count_node_targets(LINGOTEK_TARGET_SYNC_STATUS_CURRENT, $lingotek_locale);
$total = $edited + $pending + $current;
$response[] = array(
'code' => $lingotek_locale,
// Return this language code as the Lingotek language code.
'dcode' => $drupal_language_code,
'active' => $target->lingotek_enabled,
'docs' => $total,
'pending' => $pending,
'edited' => $edited,
'current' => $current,
);
}
// END: foreach target language
}
// END: Language List
return $response;
}