You are here

function data_ui_view in Data 7

Same name and namespace in other branches
  1. 6 data_ui/data_ui.admin.inc \data_ui_view()

List all tables for viewing content.

1 string reference to 'data_ui_view'
data_ui_menu in data_ui/data_ui.module
Implements hook_menu().

File

data_ui/data_ui.admin.inc, line 10
Admin UI functions.

Code

function data_ui_view() {
  $tables = data_get_all_tables();
  $rows = array();
  foreach ($tables as $table) {

    // TODO Please convert this statement to the D7 database API syntax.
    $row = array(
      check_plain($table
        ->get('title')),
      $table
        ->get('name'),
      db_query('SELECT COUNT(*) FROM {' . db_escape_table($table
        ->get('name')) . '}')
        ->fetchField(),
    );
    if (module_exists('views')) {
      $path = data_ui_get_default_path($table
        ->get('name'));
      $row[] = $path ? l(t('View'), $path) : l(t('Edit schema'), 'admin/structure/data/edit/' . $table
        ->get('name'));
    }
    $rows[] = $row;
  }
  $header = array(
    t('Title'),
    t('Name'),
    t('Number of rows'),
  );
  if (module_exists('views')) {
    $header[] = ' ';
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}