You are here

function data_ui_manage in Data 6

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

Main page for data table management.

1 string reference to 'data_ui_manage'
data_ui_menu in data_ui/data_ui.module
Implementation of hook_menu()

File

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

Code

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

    // Build operations depending on configuration status.
    $operations = array();
    if ($table
      ->get('export_type') == EXPORT_IN_CODE) {
      $status = t('Default');
      $operations[] = l(t('Override'), 'admin/build/data/edit/' . $table
        ->get('name'));
    }
    else {
      if ($table
        ->get('export_type') == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
        $status = t('Overridden');
        $operations[] = l(t('Edit'), 'admin/build/data/edit/' . $table
          ->get('name'));
        $operations[] = l(t('Revert'), 'admin/build/data/revert/' . $table
          ->get('name'));
      }
      else {
        $status = t('Normal');
        $operations[] = l(t('Edit'), 'admin/build/data/edit/' . $table
          ->get('name'));
        $operations[] = l(t('Drop'), 'admin/build/data/drop/' . $table
          ->get('name'));
      }
    }
    if (module_exists('ctools')) {
      $operations[] = l(t('Export'), 'admin/build/data/export/' . $table
        ->get('name'));
    }
    $row = array();
    $row[] = check_plain($table
      ->get('title'));
    $row[] = check_plain($table
      ->get('name'));
    $row[] = $status;
    $row[] = implode(' | ', $operations);
    $rows[] = $row;
  }
  $rows[] = array(
    l(t('Create new table'), 'admin/build/data/create'),
    ' ',
    ' ',
    ' ',
  );
  $header = array(
    t('Title'),
    t('Name'),
    t('Status'),
    t('Operations'),
  );
  return theme('table', $header, $rows);
}