You are here

function _biblio_category_separator_bar in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/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()
1 call to _biblio_category_separator_bar()
biblio_show_results in ./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

./biblio.pages.inc, line 697

Code

function _biblio_category_separator_bar($attrib, $node, $reset = FALSE) {
  static $_text = '';
  if ($reset) {
    $_text = '';
    return;
  }
  $content = '';
  switch ($attrib['sort']) {
    case 'title':
      $first = drupal_substr(drupal_ucfirst(ltrim($node->title)), 0, 1);
      if (drupal_substr(drupal_ucfirst(ltrim($node->title)), 0, 1) == '"') {
        $first = drupal_ucfirst(drupal_substr(ltrim($node->title), 1, 1));
      }
      if (drupal_substr(drupal_ucfirst(ltrim($node->title)), 0, 1) == "'") {
        $first = drupal_ucfirst(drupal_substr(ltrim($node->title), 1, 1));
      }
      if (drupal_substr(drupal_ucfirst(ltrim($node->title)), 0, 2) == "A ") {
        $first = drupal_ucfirst(drupal_substr(ltrim($node->title), 2, 1));
      }
      if (drupal_substr(drupal_ucfirst(ltrim($node->title)), 0, 3) == "An ") {
        $first = drupal_ucfirst(drupal_substr(ltrim($node->title), 3, 1));
      }
      if (drupal_substr(drupal_ucfirst(ltrim($node->title)), 0, 4) == "The ") {
        $first = drupal_ucfirst(drupal_substr(ltrim($node->title), 4, 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;

        //      $name = db_result(db_query("SELECT name FROM {biblio_types} as t where t.tid=%d", $node->biblio_type)) ;
        $content .= theme_biblio_separator_bar(_biblio_localize_type($node->biblio_type, $_text));
      }
      break;
    case 'keyword':

      // added msh 08 aug 07
      // $kw = array_shift($node->biblio_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);
      }
  }

  //end switch
  return $content;
}