You are here

function biblio_page_header in Bibliography Module 7.2

Same name and namespace in other branches
  1. 7 includes/biblio.pages.inc \biblio_page_header()
1 call to biblio_page_header()
biblio_page in includes/biblio.pages.inc

File

includes/biblio.pages.inc, line 100

Code

function biblio_page_header($filter = array()) {
  $header = array();
  $header = array(
    '#prefix' => '<div id="biblio-header" class="clear-block">',
    '#suffix' => '</div>',
    '#weight' => -100,
  );

  // Search box. Has same permissions as the filter tab.
  if (variable_get('biblio_search', 0) && user_access('show filter tab')) {
    $header += array(
      'search_form' => drupal_get_form('biblio_search_form'),
    );
  }
  $header += array(
    'export_links' => array(
      '#prefix' => '<div class="biblio-export">',
      '#biblio' => NULL,
      '#filter' => $filter,
      '#theme' => 'biblio_export_links',
      '#suffix' => '</div>',
    ),
  );
  if (!biblio_access('export')) {
    global $pager_total_items;
    $header['export_links']['#markup'] = t('Found @count results', array(
      '@count' => $pager_total_items[0],
    ));
    unset($header['export_links']['#theme']);
  }

  // Add some links to the top of the page to change the sorting/ordering...
  if (user_access('show sort links')) {
    $header += array(
      'sort_links' => array(
        '#markup' => _biblio_sort_tabs(),
      ),
    );
  }
  $header += array(
    'filter_status' => array(
      '#prefix' => '<div class="biblio-filter-status">',
      '#suffix' => '</div>',
      '#markup' => _biblio_filter_info_line($filter),
    ),
  );
  if (isset($_GET['s'])) {
    if ($_GET['s'] == 'title' || $_GET['s'] == 'author' || $_GET['s'] == 'keyword') {
      if (strpos($_GET['q'], 'ag') || strpos($_GET['q'], 'tg') || strpos($_GET['q'], 'keyword')) {
        $value = substr($_GET['q'], strrpos($_GET['q'], '/') + 1);
      }
      else {
        $value = '';
      }
      $header += array(
        'alpha_line' => array(
          '#prefix' => '<div class="biblio-alpha-line">',
          '#suffix' => '</div>',
          '#markup' => theme('biblio_alpha_line', array(
            'type' => $_GET['s'],
            'current' => $value,
            'path' => variable_get('biblio_base', 'biblio'),
          )),
        ),
      );
    }
  }
  return $header;
}