You are here

function theme_biblio_tabular in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/biblio_theme.inc \theme_biblio_tabular()
  2. 7 includes/biblio_theme.inc \theme_biblio_tabular()
  3. 7.2 includes/biblio.theme.inc \theme_biblio_tabular()

Parameters

$node:

$base:

$teaser:

Return value

unknown_type

1 theme call to theme_biblio_tabular()
biblio_view in ./biblio.module
Implementation of hook_view().

File

./biblio_theme.inc, line 212

Code

function theme_biblio_tabular($node, $base = 'biblio', $teaser = false) {
  if (module_exists('popups')) {
    popups_add_popups();
  }
  $tid = $node->biblio_type;
  $style_name = biblio_get_style();
  $style_function = "biblio_style_{$style_name}" . "_author_options";
  module_load_include('inc', 'biblio', "biblio_style_{$style_name}");
  $fields = _biblio_get_field_information($node->biblio_type, TRUE);
  _biblio_localize_fields($fields);
  $rows[] = array(
    array(
      'data' => t('Title'),
      'class' => 'biblio-row-title biblio-field-title-title',
    ),
    array(
      'data' => filter_xss($node->title, biblio_get_allowed_tags()),
      'class' => 'biblio-field-contents-title',
    ),
  );
  $rows[] = array(
    array(
      'data' => t('Publication Type'),
      'class' => 'biblio-row-title biblio-field-title-type',
    ),
    array(
      'data' => isset($node->biblio_type_name) ? _biblio_localize_type($node->biblio_type, $node->biblio_type_name) : $node->biblio_type,
      'class' => 'biblio-field-contents-type',
    ),
  );
  if ($node->biblio_url) {
    $attrib = variable_get('biblio_links_target_new_window', null) ? array(
      'target' => '_blank',
    ) : array();
    $node->biblio_url = l($node->biblio_url, $node->biblio_url, $attrib);
  }
  if ($node->biblio_doi) {
    $doi_url = '';
    $attrib = variable_get('biblio_links_target_new_window', null) ? array(
      'target' => '_blank',
    ) : array();
    if (($doi_start = strpos($node->biblio_doi, '10.')) !== FALSE) {
      $doi = substr($node->biblio_doi, $doi_start);
      $doi_url .= 'http://dx.doi.org/' . $doi;
    }
    $node->biblio_doi = l($node->biblio_doi, $doi_url, $attrib);
  }
  foreach ($fields as $key => $row) {

    // handling the contributor categories like any other field orders them correctly by weight
    if ($row['type'] == 'contrib_widget' && !empty($node->biblio_contributors[$row['fid']][0]['name'])) {
      $author_options = $style_function();
      $author_options['numberOfAuthorsTriggeringEtAl'] = 100;

      //set really high so we see all authors
      $data = theme('biblio_format_authors', $node->biblio_contributors[$row['fid']], $author_options, $inline);
    }
    else {
      if (empty($node->{$row}['name']) || $row['name'] == 'biblio_coins') {
        continue;
      }
      else {
        switch ($row['name']) {
          case 'biblio_keywords':
            $data = _biblio_keyword_links($node->{$row}['name'], $base);
            break;
          case 'biblio_url':
          case 'biblio_doi':

            // check_plain is not need on these since they have gone through
            // the l() function which does a check_plain
            $data = $node->{$row}['name'];
            break;
          default:
            if ($row['type'] == 'textarea') {
              $data = check_markup($node->{$row}['name'], $node->format, FALSE);
            }
            else {
              $data = check_plain($node->{$row}['name']);
            }
        }
      }
    }
    $rows[] = array(
      array(
        'data' => t($row['title']),
        'class' => 'biblio-row-title biblio-field-title-' . str_replace('_', '-', str_replace('biblio_', '', $row['name'])),
      ),
      array(
        'data' => $data,
        'class' => 'biblio-field-contents-' . str_replace('_', '-', str_replace('biblio_', '', $row['name'])),
      ),
    );
  }
  if (strlen(trim($node->body)) && user_access('view full text')) {
    $rows[] = array(
      array(
        'data' => t('Full Text'),
        'valign' => 'top',
      ),
      array(
        'data' => check_markup($node->body, $node->format, FALSE),
      ),
    );
  }
  $output = '<div id="biblio-node">';
  $output .= filter_xss($node->biblio_coins, array(
    'span',
  ));
  $header = array();
  $output .= theme('table', $header, $rows);
  $output .= '</div>';
  return $output;
}