You are here

function dba_table_overview in Database Administration 7

Same name and namespace in other branches
  1. 5 dba.module \dba_table_overview()

Show a list of all tables.

1 string reference to 'dba_table_overview'
dba_menu in ./dba.module
Implements hook_menu().

File

./dba.admin.inc, line 49

Code

function dba_table_overview($form, &$form_state) {
  $form = dba_show_active_database();
  $conn = db_set_active(variable_get('dba_active_database', 'default'));
  $tables = Database::getConnection('default', variable_get('dba_active_database', 'default'))
    ->schema()
    ->findTables('%');
  db_set_active($conn);
  $form['tables'] = array(
    '#type' => 'select',
    '#title' => t('Select one or more tables'),
    '#options' => $tables,
    '#multiple' => TRUE,
    '#required' => TRUE,
    '#size' => 10,
  );

  // TODO: only enable button if one table is selected
  $form['view'] = array(
    '#type' => 'submit',
    '#value' => t('View'),
  );

  // TODO: only enable button if one or more tables is selected
  $form['describe'] = array(
    '#type' => 'submit',
    '#value' => t('Describe'),
  );

  /*
    // TODO: only enable button if one or more tables is selected, and MySQL database
    $form['check'] = array(
      '#type' => 'submit',
      '#value' => t('Check'),
    );
    // TODO: only enable button if one or more tables is selected, and MySQL database
    $form['optimize'] = array(
      '#type' => 'submit',
      '#value' => t('Optimize'),
    );
  */

  // TODO: only enable button if one or more tables is selected
  $form['export'] = array(
    '#type' => 'submit',
    '#value' => t('Export'),
  );

  // TODO: only enable button if one or more tables is selected
  $form['empty'] = array(
    '#type' => 'submit',
    '#value' => t('Empty'),
  );

  /*
    // TODO: only enable button if one or more tables is selected
    $form['drop'] = array(
      '#type' => 'submit',
      '#value' => t('Drop'),
    );
  */
  return $form;
}