You are here

function i18n_translation_admin_overview in Internationalization 7

Overview page for translation sets

Parameters

$type: Translation set type to get a listing for this type only

$query: Base query to build upon

3 calls to i18n_translation_admin_overview()
i18n_path_admin_overview in i18n_path/i18n_path.admin.inc
Path overview page
i18n_taxonomy_translation_sets_overview in i18n_taxonomy/i18n_taxonomy.admin.inc
Generate a tabular listing of translations for vocabularies.
i18n_translation_set_list_manage in i18n_translation/i18n_translation.module
Generate a tabular listing of translations for this type.
1 string reference to 'i18n_translation_admin_overview'
i18n_translation_menu in i18n_translation/i18n_translation.module
Implements hook_menu()

File

i18n_translation/i18n_translation.admin.inc, line 16
Internationalization (i18n) module. Translation sets admin

Code

function i18n_translation_admin_overview($type = NULL, $query = NULL) {

  // Build the sortable table header.
  $header['title'] = array(
    'data' => t('Title'),
    'field' => 't.title',
  );
  if (!$type) {
    $header['type'] = array(
      'data' => t('Type'),
      'field' => 't.type',
    );
  }
  $header['items'] = t('Items');
  $header['created'] = array(
    'data' => t('Created'),
    'field' => 't.created',
  );
  $header['changed'] = array(
    'data' => t('Updated'),
    'field' => 't.changed',
    'sort' => 'desc',
  );
  $header['operations'] = array(
    'data' => t('Operations'),
  );

  // Get the translation sets for this form
  $query = $query ? $query : db_select('i18n_translation_set', 't');
  $query = $query
    ->extend('PagerDefault')
    ->extend('TableSort');
  if ($type) {
    $query
      ->condition('t.type', $type);
  }
  $tsids = $query
    ->fields('t', array(
    'tsid',
  ))
    ->limit(20)
    ->orderByHeader($header)
    ->execute()
    ->fetchCol();
  $translations = $tsids ? entity_load('i18n_translation', $tsids) : array();
  $form = drupal_get_form('i18n_translation_admin_form', $translations, $header);
  $form['pager'] = array(
    '#markup' => theme('pager'),
  );
  return $form;
}