You are here

function biblio_admin_orphans_form in Bibliography Module 7

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

_state

Parameters

$form:

Return value

array

1 string reference to 'biblio_admin_orphans_form'
biblio_menu in ./biblio.module
Implements hook_menu().

File

includes/biblio.admin.inc, line 2623
biblio.admin.inc

Code

function biblio_admin_orphans_form($form, &$form_state) {
  module_load_include('inc', 'biblio', 'includes/biblio.contributors');
  $orphans = $options = $names = array();
  $base = variable_get('biblio_base', 'biblio');
  $orphans = biblio_get_orphan_authors();
  foreach ($orphans as $author) {
    $options[$author->cid] = array(
      'author' => array(
        'data' => array(
          '#type' => 'link',
          '#title' => $author->name,
          '#href' => $base . '/authors/' . $author->cid . '/edit',
        ),
      ),
      'affiliation' => check_plain($author->affiliation),
    );
    $names[$author->cid] = $author->name;
  }
  $form['names'] = array(
    '#type' => 'hidden',
    '#value' => $names,
  );
  $header = array(
    'author' => t('Author name'),
    'affiliation' => t('Author affiliation'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Delete Selected'),
    '#disabled' => !count($options),
    '#submit' => array(
      'biblio_admin_orphans_form_submit',
    ),
  );
  $form['delete_all'] = array(
    '#type' => 'submit',
    '#value' => t('Delete ALL'),
    '#disabled' => !count($options),
    '#submit' => array(
      'biblio_admin_orphans_form_submit',
    ),
  );
  $form['authors'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#empty' => t('No orphaned authors.'),
  );
  return $form;
}