You are here

function theme_biblio_admin_author_types_form in Bibliography Module 6.2

Same name and namespace in other branches
  1. 6 biblio.admin.inc \theme_biblio_admin_author_types_form()
  2. 7 includes/biblio.admin.inc \theme_biblio_admin_author_types_form()
  3. 7.2 includes/biblio.admin.inc \theme_biblio_admin_author_types_form()

File

includes/biblio.admin.inc, line 1863
Administrative files for the biblio module.

Code

function theme_biblio_admin_author_types_form($form) {

  // We need this complex query to realize author_types which are not in use (cid is NULL)
  $db_result = db_query("SELECT ctd.*, cid FROM {biblio_contributor_type_data} ctd\n                         LEFT JOIN {biblio_contributor} c ON ctd.auth_type = c.auth_type\n                         GROUP BY ctd.auth_type");
  while ($row = db_fetch_object($db_result)) {
    $ops = l(t('edit'), 'admin/settings/biblio/author/type/' . $row->auth_type . '/edit');
    if (!isset($row->cid) && $row->auth_type >= 10) {

      // allow delete only if type not in use
      $ops .= '  ';
      $ops .= l(t('delete'), 'admin/settings/biblio/author/type/' . $row->auth_type . '/delete/');
    }
    $rows[] = array(
      $row->auth_type,
      check_plain($row->title),
      check_plain($row->hint),
      $ops,
    );
  }
  $header = array(
    t('Type Id'),
    t('Contributor Type'),
    t('Description'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $output = '<p>[ ' . l(t('Add New Type'), 'admin/settings/biblio/author/type/new') . ' ]';
  $output .= theme('table', $header, $rows);
  $output .= '<p>[ ' . l(t('Add New Type'), 'admin/settings/biblio/author/type/new') . ' ]';

  // $output .= ' [ '. l(t('Reset all types to defaults'), 'admin/settings/biblio/authors/reset') .' ]';
  return $output;
}