function theme_biblio_alpha_line in Bibliography Module 6
Same name and namespace in other branches
- 6.2 includes/biblio_theme.inc \theme_biblio_alpha_line()
- 7 includes/biblio_theme.inc \theme_biblio_alpha_line()
- 7.2 includes/biblio.theme.inc \theme_biblio_alpha_line()
This function creates a string of letters (A - Z), which depending on the sorting are either linked to author or title filters i.e. clicking on the A when in the listing is sorted by authors will bring up a list of all the entries where the first character of the primary authors last name is "A"
Parameters
$type either "author or title":
Return value
a chunk of HTML code as described above
3 theme calls to theme_biblio_alpha_line()
- 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
- _biblio_format_author_page in ./
biblio.pages.inc - _biblio_format_keyword_page in ./
biblio.pages.inc
File
- ./
biblio_theme.inc, line 1085
Code
function theme_biblio_alpha_line($type = 'author', $current = NULL, $path = NULL) {
$options = array();
$base = variable_get('biblio_base', 'biblio');
$all = '';
switch ($type) {
case 'authors':
case 'keywords':
$path = ord(substr($_GET['q'], -1)) > 97 ? $_GET['q'] . "/" : substr($_GET['q'], 0, -1);
$all = '[' . l(t('Show ALL'), substr($_GET['q'], 0, -2)) . ']';
break;
case 'keyword':
$options['query'] = array(
'sort' => 'keyword',
);
$path = "{$base}/keyword/";
$all_query['query'] = array(
'sort' => 'keyword',
'order' => $_GET['order'],
);
$all = '[' . l(t('Show ALL'), $base, $all_query) . ']';
break;
case 'author':
$options['query'] = array(
'sort' => 'author',
);
$path = "{$base}/ag/";
$all_query['query'] = array(
'sort' => 'author',
'order' => $_GET['order'],
);
$all = '[' . l(t('Show ALL'), $base, $all_query) . ']';
break;
case 'title':
$options['query'] = array(
'sort' => 'title',
);
$path = "{$base}/tg/";
$all_query['query'] = array(
'sort' => 'title',
'order' => $_GET['order'],
);
$all = '[' . l(t('Show ALL'), $base, $all_query) . ']';
break;
default:
if (!isset($_GET['sort']) || $_GET['sort'] == 'year' || $_GET['sort'] == 'type') {
return;
}
$inline = $inline ? "/inline" : "";
if (isset($_GET['sort'])) {
$options['query']['sort'] = $_GET['sort'];
if ($_GET['sort'] == 'author') {
$path = "{$base}/ag/";
}
if ($_GET['sort'] == 'title') {
$path = "{$base}/tg/";
}
}
}
if (isset($_GET['order'])) {
$options['query']['order'] = $_GET['order'];
}
$output = '<div class="biblio-alpha-line">';
for ($i = 65; $i <= 90; $i++) {
if ($i == ord(strtoupper($current))) {
$output .= '<b>[' . chr($i) . ']</b> ';
}
else {
$output .= l(chr($i), $path . chr($i), $options) . ' ';
}
}
if ($current) {
$output .= ' ' . $all;
}
$output .= '</div>';
return $output;
}