You are here

function _biblio_category_separator_bar in Bibliography Module 6.2

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

Parameters

$attrib:

$node:

bool $reset: (optional)

Return value

string

1 call to _biblio_category_separator_bar()
biblio_show_results in includes/biblio.pages.inc
biblio_show_results takes the query results from biblio_db_search and adds some controls to the page then loops through the results applying the selected style to each entry

File

includes/biblio.pages.inc, line 767
Functions in the biblio module related to filtering and page generation.

Code

function _biblio_category_separator_bar($attrib, $node, $reset = FALSE) {
  static $_text = '';
  if ($reset) {
    $_text = '';
    return;
  }
  $content = '';
  switch ($attrib['sort']) {
    case 'title':
      $title = $node->biblio_sort_title;
      $first = drupal_substr(drupal_ucfirst(ltrim($title)), 0, 1);
      if ($first != $_text) {
        if ($_text != '') {
          $content .= theme_biblio_end_category_section();
        }
        $_text = $first;
        $content .= theme_biblio_separator_bar($_text);
      }
      break;
    case 'author':
      if (isset($node->biblio_contributors[1][0]['lastname']) && drupal_substr(drupal_ucfirst(ltrim($node->biblio_contributors[1][0]['lastname'])), 0, 1) != $_text) {
        if ($_text != '') {
          $content .= theme_biblio_end_category_section();
        }
        $_text = drupal_substr(drupal_ucfirst(ltrim($node->biblio_contributors[1][0]['lastname'])), 0, 1);
        $content .= theme_biblio_separator_bar($_text);
      }
      break;
    case 'type':
      if ($node->biblio_type_name != $_text) {
        if ($_text != '') {
          $content .= theme_biblio_end_category_section();
        }
        $_text = $node->biblio_type_name;
        $content .= theme_biblio_separator_bar(_biblio_localize_type($node->biblio_type, $_text));
      }
      break;
    case 'keyword':
      $tok = $node->biblio_keyword;
      if (empty($tok)) {
        $tok = t("No Keywords");
      }
      if ($tok != $_text) {
        if ($_text != '') {
          $content .= theme_biblio_end_category_section();
        }
        $_text = $tok;
        if ($_text != '') {
          $content .= theme_biblio_separator_bar($_text);
        }
      }
      break;
    case 'year':
    default:
      if ($node->biblio_year != $_text) {
        if ($_text != '') {
          $content .= theme_biblio_end_category_section();
        }
        $_text = $node->biblio_year;
        $content .= theme_biblio_separator_bar($_text);
      }
      break;
  }
  return $content;
}