function lingotek_bulk_grid_parse_table_data in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.bulk_grid.inc \lingotek_bulk_grid_parse_table_data()
1 call to lingotek_bulk_grid_parse_table_data()
- 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 1593
Code
function lingotek_bulk_grid_parse_table_data($table_data_raw, $entity_properties, $entity_id_key) {
$languages = language_list();
$profiles = lingotek_get_profiles();
$api = LingotekApi::instance();
$workflows = $api
->listWorkflows();
$table_data = array();
foreach ($table_data_raw as $row) {
$entity_id = $row->{$entity_id_key};
$row->title = lingotek_truncate_grid_text($row->title, 55);
$icon = lingotek_source_uploaded_icon($row);
$locales_statuses = lingotek_build_locales_statuses($row);
ksort($locales_statuses);
$disabled = $row->lingotek['profile'] == LingotekSync::PROFILE_DISABLED;
$disabled_class = $disabled ? ' ltk-disabled-icon' : '';
$allow_source_overwriting = !empty($row->lingotek['allow_source_overwriting']);
$allow_target_localization = !empty($profiles[$row->lingotek['profile']]['allow_target_localization']);
$translation_icons = lingotek_lang_icons($entity_properties['type'], $languages, $entity_id, $locales_statuses, $disabled, $row->language, $allow_source_overwriting, $allow_target_localization);
// show translation statuses
if (!empty($translation_icons['source'])) {
$row->overridden_source_target_icon = $translation_icons['source'];
unset($translation_icons['source']);
}
$target_icons_str = implode('', array_values($translation_icons));
$configuration = lingotek_render_configuration($row, $profiles, $disabled_class);
$source = lingotek_render_source($entity_properties['type'], $row, $icon, $languages, $entity_properties['language_col']);
$actions = lingotek_render_actions($entity_properties['type'], $entity_id, $disabled_class);
$title = $entity_properties['label_col'] ? lingotek_render_title($row, $entity_properties, $GLOBALS['language']) : '';
// Build the data to be output for this row
$data = array(
'nid' => $row->{$entity_id_key} ?: t('??'),
'title' => $title,
'language' => $source,
'translations' => $target_icons_str,
'configuration' => $configuration,
'document_id' => $row->document_id ?: t('N/A'),
'content_type' => isset($entity_properties['info']['bundles'][$row->type]['label']) ? $entity_properties['info']['bundles'][$row->type]['label'] : $row->type,
'last_uploaded' => $row->last_uploaded ? t('@time ago', array(
'@time' => lingotek_human_readable_timestamp($row->last_uploaded),
)) : t('Never'),
'workflow' => $row->lingotek['workflow_id'] ? isset($workflows[$row->lingotek['workflow_id']]) ? check_plain($workflows[$row->lingotek['workflow_id']]) : $row->lingotek['workflow_id'] : '',
'actions' => '<span class="lingotek-node-actions">' . $actions . '</span>',
'description' => isset($row->description) ? $row->description : '',
);
if (isset($entity_properties['changed'])) {
$data['changed'] = $row->changed ? t('@time ago', array(
'@time' => lingotek_human_readable_timestamp($row->changed),
)) : t('Never');
}
$table_data[$entity_id] = $data;
}
return $table_data;
}