function lingotek_lang_icons in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lingotek.bulk_grid.inc \lingotek_lang_icons()
- 7.4 lingotek.bulk_grid.inc \lingotek_lang_icons()
- 7.6 lingotek.bulk_grid.inc \lingotek_lang_icons()
1 call to lingotek_lang_icons()
- lingotek_grid_get_rows in ./
lingotek.bulk_grid.inc - Dynamic query processing function for the grid Since the header defines which columns are shown, this query gets all possible values and refines the header using the columns selected in the UI The filters are also processed here
File
- ./
lingotek.bulk_grid.inc, line 1452 - Bulk Grid form
Code
function lingotek_lang_icons($entity_type, $languages, $locales, $statuses, $entity_id = NULL, $disabled = FALSE, $source_language = NULL) {
$html = "";
$legend = array(
LingotekSync::STATUS_PENDING => t('In Progress'),
LingotekSync::STATUS_READY => t('Ready to Download'),
LingotekSync::STATUS_CURRENT => t('Current'),
LingotekSync::STATUS_EDITED => t('Not Current'),
LingotekSync::STATUS_UNTRACKED => t('Untracked'),
'',
);
$default_link = 'lingotek/workbench/' . $entity_type . '/' . $entity_id . '/';
$manual_link = $entity_type . '/' . $entity_id . '/lingotek_pm/';
$untracked_link = 'lingotek/view/' . $entity_type . '/' . $entity_id . '/';
$link_map = array(
LingotekSync::STATUS_PENDING => $default_link,
LingotekSync::STATUS_READY => $default_link,
LingotekSync::STATUS_CURRENT => $default_link,
LingotekSync::STATUS_EDITED => $manual_link,
LingotekSync::STATUS_UNTRACKED => $untracked_link,
);
$lingotek_languages = Lingotek::getLanguages();
foreach ($locales as $key => $original_locale) {
if (key_exists($original_locale, $lingotek_languages)) {
$locale_enabled = $lingotek_languages[$original_locale]->lingotek_enabled;
//array_key_exists($locale, $lingotek_languages) ? $lingotek_languages[$locale]->lingotek_enabled : FALSE;
$lang_code = $lingotek_languages[$original_locale]->language;
$lingotek_locale = $lingotek_languages[$original_locale]->lingotek_locale;
if (!is_null($source_language) && $lang_code === $source_language) {
continue;
// hide source language targets (shouldn't exist anyways)
}
if ($locale_enabled) {
// exclude language translations that are not lingotek_enabled (we may consider showing everything later)
$status = strtoupper($statuses[$key]);
$status = $disabled && strtoupper($status) != LingotekSync::STATUS_CURRENT ? LingotekSync::STATUS_UNTRACKED : $status;
$css_classes = 'target-' . strtolower($status);
$css_classes .= $disabled ? ' target-disabled' : '';
$tip = $languages[$lang_code]->name . ' - ' . $legend[$status];
$status = $disabled ? LingotekSync::STATUS_UNTRACKED : $status;
// all disabled entities should link to view page (not workbench)
$html .= l($lang_code, $link_map[$status] . $lingotek_locale, array(
'attributes' => array(
'target' => '_blank',
'title' => $tip,
'class' => array(
'language-icon',
$css_classes,
),
),
));
}
}
}
return $html;
}