function lingotek_config_get_rows in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.6 lingotek.config.inc \lingotek_config_get_rows()
1 call to lingotek_config_get_rows()
File
- ./
lingotek.config.inc, line 63 - Config grid form elements
Code
function lingotek_config_get_rows($entity_type, $form, &$form_state, $count_only = FALSE) {
$columns = isset($form_state['values']['columns']) ? $form_state['values']['columns'] : array();
$header = lingotek_config_header();
$form_state['values']['grid_header'] = lingotek_bulk_grid_refine_source_header($header, $columns);
$query1 = lingotek_config_start_query($form_state, 'not taxonomy');
lingotek_config_add_query_filters($query1);
$query2 = lingotek_config_start_query($form_state, 'taxonomy name');
lingotek_config_add_query_filters($query2);
$query3 = lingotek_config_start_query($form_state, 'taxonomy desc');
lingotek_config_add_query_filters($query3);
$query1
->union($query2, 'UNION');
$query1
->union($query3, 'UNION');
if ($count_only) {
$result = $query1
->execute();
return $result
->rowCount();
}
$query = db_select($query1, 'query_union')
->fields('query_union');
$limit = isset($_SESSION['limit_select']) ? $_SESSION['limit_select'] : 10;
$table_data_raw = $query
->extend('PagerDefault')
->extend('TableSort')
->limit($limit)
->orderByHeader($form_state['values']['grid_header'])
->execute()
->fetchAllAssoc('lid');
$table_data = lingotek_bulk_grid_parse_config_data($table_data_raw, $entity_type);
if (isset($_SESSION['grid_filters'][$entity_type])) {
$all_filtered_results = $query
->extend('PagerDefault')
->limit(500000)
->execute();
$all_filtered_lids = array();
foreach ($all_filtered_results as $filtered_result) {
$all_filtered_lids[$filtered_result->lid] = $filtered_result->lid;
}
$_SESSION['grid_filters'][$entity_type]['filtered_config_lids'] = $all_filtered_lids;
}
return $table_data;
}