You are here

function data_ui_view in Data 6

Same name and namespace in other branches
  1. 7 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
Implementation of 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) {
    $row = array(
      check_plain($table
        ->get('title')),
      $table
        ->get('name'),
      db_result(db_query('SELECT COUNT(*) FROM {' . db_escape_table($table
        ->get('name')) . '}')),
    );
    if (module_exists('views')) {
      $path = data_ui_get_default_path($table
        ->get('name'));
      $row[] = $path ? l(t('View'), $path) : l(t('Edit schema'), 'admin/build/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', $header, $rows);
}