You are here

function lingotek_config_get_rows in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.config.inc \lingotek_config_get_rows()
1 call to lingotek_config_get_rows()
lingotek_bulk_grid_form in ./lingotek.bulk_grid.inc

File

./lingotek.config.inc, line 40
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);
  return $table_data;
}