function biblio_show_results in Bibliography Module 6
Same name and namespace in other branches
- 5 biblio.module \biblio_show_results()
- 6.2 includes/biblio.pages.inc \biblio_show_results()
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
Parameters
$result:
$count:
$attrib:
$args:
$inline:
Return value
unknown_type
1 call to biblio_show_results()
File
- ./
biblio.pages.inc, line 456
Code
function biblio_show_results($nodes, $query_info, $inline = false) {
global $pager_total_items;
$profile = false;
$attrib = $query_info['sort_attrib'];
$args = $query_info['args'];
$base = variable_get('biblio_base', 'biblio');
$style = biblio_get_style();
if ($inline === 'profile') {
$profile = true;
$inline = false;
}
if (module_exists('popups')) {
popups_add_popups();
}
if (!$inline && !$profile) {
if (variable_get('biblio_rss', 0)) {
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="' . variable_get('site_name', 'Drupal') . ' RSS" href="' . url("{$base}/rss.xml") . '" />');
}
// Search box. Has same permissions as the filter tab.
$content = '<div id="biblio-header" class="clear-block">';
if (variable_get('biblio_search', 0) && user_access('show filter tab')) {
$content .= drupal_get_form('biblio_search_form');
}
if (biblio_access('export')) {
$content .= '<div class="biblio-export">' . theme('biblio_export_links') . '</div>';
}
else {
$content .= '<div class="biblio-export">' . t('Found @count results', array(
'@count' => $pager_total_items[0],
)) . '</div><br />';
}
// Add some links to the top of the page to change the sorting/ordering...
if (user_access('show sort links')) {
$content .= _biblio_sort_tabs($attrib);
}
$content .= '</div>';
if (user_access('show filter tab')) {
$content .= $query_info['filter_line'];
}
}
if ($inline === true) {
print '<div class="biblio-inline">';
}
if ($_GET['sort'] == 'title' || $_GET['sort'] == 'author' || $_GET['sort'] == 'keyword') {
if (strpos($_GET['q'], 'ag') || strpos($_GET['q'], 'tg') || strpos($_GET['q'], 'keyword')) {
$value = substr($_GET['q'], strrpos($_GET['q'], '/') + 1);
}
$content .= theme('biblio_alpha_line', $_GET['sort'], $value);
}
$count = 0;
// Reset separator bar status for repeated calls to biblio_db_search.
_biblio_category_separator_bar(NULL, NULL, TRUE);
foreach ($nodes as $node) {
$count++;
if (is_array($node)) {
$node = (object) $node;
}
if (variable_get('biblio_hide_bibtex_braces', 0)) {
$node->title = biblio_remove_brace($node->title);
}
if (variable_get('biblio_fix_isi_links', 0)) {
biblio_fix_isi_links($node);
}
// output separator bar if needed
$content .= _biblio_category_separator_bar($attrib, $node);
$inline_links = $inline && variable_get('biblio_inlinemode_in_links', 0) ? true : false;
$content .= theme('biblio_entry', $node, $base, $style, $inline_links);
}
//end while
if ($count) {
$content .= '</div><!-- end category-section -->';
}
$content .= theme('pager', 0, variable_get('biblio_rowsperpage', 25));
if ($count == 0) {
$content .= "<h3>" . t("No items found") . "</h3>";
if (strstr($content, "Filters:")) {
$content .= t('!modify_link or !remove_link your filters and try again.', array(
'!modify_link' => l(t('Modify'), "{$base}/filter"),
'!remove_link' => l(t('remove'), "{$base}/filter/clear"),
));
}
}
if ($profile === true) {
return $content;
}
if ($inline === true) {
return $content . "</div>";
}
if ($inline === false) {
drupal_set_title(check_plain(variable_get('biblio_base_title', 'Biblio')));
return $content;
}
}