function biblio_show_node in Bibliography Module 5
1 call to biblio_show_node()
- biblio_view in ./
biblio.module - Implementation of hook_view().
File
- ./
biblio.module, line 998
Code
function biblio_show_node($node, $base, $teaser = false) {
$tid = $node->biblio_type;
$result = db_query('SELECT * FROM {biblio_fields} as b ORDER BY b.weight ASC');
while ($row = db_fetch_array($result)) {
if ($row['common']) {
$fields[$row['fid']] = $row;
}
}
// $result = db_query('SELECT t.* FROM {biblio_types} as t WHERE t.tid = %d', $tid);
// $row = db_fetch_array($result);
// $type_name=$row['name'];
$result = db_query('SELECT d.*, f.name, f.type FROM {biblio_type_details} as d INNER JOIN {biblio_fields} as f on d.fid=f.fid where d.tid=%d ORDER BY d.weight ASC', $tid);
while ($row = db_fetch_array($result)) {
$fields[$row['fid']] = isset($fields[$row['fid']]) ? array_merge($fields[$row['fid']], $row) : $row;
}
uasort($fields, "_biblio_form_sort");
// resort the fields since the weight may have changed
if ($teaser) {
// $rows[] =array(array('data' => '<hr>', 'colspan'=>'3'));
// $rows[] =array(array('data' => '<span class="biblio-row-title">'.t('Title').'</span>','align'=>'right'),
// array('data' => ' '),
// array('data' => l($node->title, 'node/'.$node->nid)));
unset($fields[21]);
}
$rows[] = array(
array(
'data' => '<span class="biblio-row-title">' . t('Publication Type') . '</span>',
'align' => 'right',
),
array(
'data' => ' ',
),
array(
'data' => theme('biblio_type_link', $node->biblio_type_name, $tid, $base),
),
);
if ($node->biblio_authors) {
if (variable_get('biblio_normalize', 0)) {
$node->biblio_authors = _biblio_parse_authors($node->biblio_authors);
}
$node->biblio_authors = _biblio_author_links($node->biblio_authors, $base);
}
if ($node->biblio_keywords) {
$node->biblio_keywords = _biblio_keyword_links($node->biblio_keywords, $base);
}
if ($node->biblio_publisher) {
$node->biblio_publisher = theme('biblio_publisher_link', $node->biblio_publisher, $base);
}
if ($node->biblio_url) {
$node->biblio_url = l($node->biblio_url, $node->biblio_url);
}
foreach ($fields as $key => $row) {
if (!empty($node->{$row}['name']) && $row['name'] != 'biblio_coins') {
switch ($row['name']) {
case 'biblio_authors':
case 'biblio_keywords':
case 'biblio_url':
case 'biblio_publisher':
// 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' => '<span class="biblio-row-title">' . $row['title'] . '</span>',
'align' => 'right',
'valign' => 'top',
'width' => '20%',
),
array(
'data' => ' ',
),
array(
'data' => $data,
),
);
}
}
if (strlen(trim($node->body)) && $teaser == false && user_access('view full text')) {
$rows[] = array(
array(
'data' => '<span class="biblio-row-title">' . t('Full Text') . '</span>',
'align' => 'right',
'valign' => 'center',
'width' => '20%',
),
array(
'data' => ' ',
),
array(
'data' => check_markup($node->body, $node->format, FALSE),
),
);
}
if (biblio_access('export', $node) && $teaser == false) {
$rows[] = array(
array(
'data' => '<span class="biblio-row-title">' . t('Export') . '</span>',
'align' => 'right',
'valign' => 'center',
'width' => '20%',
),
array(
'data' => ' ',
),
array(
'data' => theme('biblio_tagged_link', $base, $node) . ' ' . l(t("XML"), "{$base}/export/xml/{$node->nid}") . ' ' . theme('biblio_bibtex_link', $base, $node),
),
);
}
$output = '<div id="biblio-node">';
$output .= $node->biblio_coins;
$output .= theme('table', $header, $rows);
$output .= '</div>';
return $output;
}