You are here

function quicktabs_list in Quick Tabs 6.3

Same name and namespace in other branches
  1. 5 quicktabs.module \quicktabs_list()
  2. 6 quicktabs.module \quicktabs_list()
  3. 6.2 includes/admin.inc \quicktabs_list()
  4. 7.3 quicktabs.admin.inc \quicktabs_list()
  5. 7.2 includes/admin.inc \quicktabs_list()

Page callback for quicktabs admin landing page.

1 string reference to 'quicktabs_list'
quicktabs_menu in ./quicktabs.module
Implementation of hook_menu().

File

includes/admin.inc, line 6

Code

function quicktabs_list() {
  $header = array(
    array(
      'data' => t('Quicktab'),
    ),
    array(
      'data' => t('Storage'),
    ),
    array(
      'data' => t('Operations'),
      'colspan' => module_exists('ctools') ? 4 : 3,
    ),
  );
  $rows = array();
  foreach (quicktabs_get_all_quicktabs() as $quicktabs) {
    if (module_exists('ctools')) {

      // Determine storage
      switch ($quicktabs['export_type']) {
        case EXPORT_IN_DATABASE | EXPORT_IN_CODE:
          $storage = t('Overridden');
          $delete = l(t('Revert'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/delete');
          break;
        case EXPORT_IN_DATABASE:
          $storage = t('Normal');
          $delete = l(t('Delete'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/delete');
          break;
        case EXPORT_IN_CODE:
          $storage = t('Default');
          $delete = '';
          break;
      }
      $tablerow = array(
        array(
          'data' => check_plain($quicktabs['title']),
        ),
        array(
          'data' => $storage,
        ),
        array(
          'data' => l(t('Edit'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/edit'),
        ),
        array(
          'data' => l(t('Export'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/export'),
        ),
        array(
          'data' => l(t('Clone'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/clone'),
        ),
        array(
          'data' => $delete,
        ),
      );
    }
    else {
      $tablerow = array(
        array(
          'data' => check_plain($quicktabs['title']),
        ),
        array(
          'data' => t('Normal'),
        ),
        array(
          'data' => l(t('Edit'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/edit'),
        ),
        array(
          'data' => l(t('Clone'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/clone'),
        ),
        array(
          'data' => l(t('Delete'), 'admin/build/quicktabs/' . $quicktabs['machine_name'] . '/delete'),
        ),
      );
    }
    $rows[] = $tablerow;
  }
  if (!empty($rows)) {
    $output = theme('table', $header, $rows, array(
      'id' => 'quicktabs',
    ));
  }
  else {
    $output = '<p>' . t('Click on the "New QT block" tab to get started.') . '</p>';
  }
  return $output;
}