function _get_biblio_filters in Bibliography Module 6
Same name and namespace in other branches
- 5 biblio.module \_get_biblio_filters()
- 6.2 includes/biblio.pages.inc \_get_biblio_filters()
- 7 includes/biblio.pages.inc \_get_biblio_filters()
- 7.2 includes/biblio.pages.inc \_get_biblio_filters()
2 calls to _get_biblio_filters()
- biblio_form_filter in ./
biblio.pages.inc - biblio_form_filter_submit in ./
biblio.pages.inc - _state
File
- ./
biblio.pages.inc, line 892
Code
function _get_biblio_filters() {
$pub_authors[0] = '';
$pub_years[0] = '';
$pub_type[0] = '';
$pub_taxo[0] = '';
$pub_keywords[0] = '';
$fields = " b.biblio_year, t.name , t.tid ";
$order = " b.biblio_year DESC";
$taxo_fields = "td.name as termname,td.tid as taxid, v.name as vocab_name";
$taxo_order = "vocab_name ASC, termname ASC";
$table = "{node} as n inner join {biblio} as b on n.vid=b.vid ";
$join = "left join {biblio_types} as t on b.biblio_type = t.tid";
$taxo_join = array(
"inner join {term_node} as tn on n.vid = tn.vid",
"left join {term_data} as td on tn.tid= td.tid",
"left join {vocabulary} as v on v.vid= td.vid",
);
$taxo_joins = implode(' ', $taxo_join);
$result = db_query("SELECT {$fields} FROM {$table} {$join} ORDER BY {$order}");
$authors = db_query("SELECT firstname, initials, lastname, cid FROM {biblio_contributor_data} ORDER BY lastname ASC");
$keywords = db_query("SELECT word, kid FROM {biblio_keyword_data} ORDER BY word ASC");
$taxoresult = db_query("SELECT {$taxo_fields} FROM {$table} {$taxo_joins} ORDER BY {$taxo_order}");
while ($option = db_fetch_object($result)) {
if (isset($option->biblio_year)) {
$option->biblio_year = _biblio_text_year($option->biblio_year);
}
$pub_years["{$option->biblio_year}"] = $option->biblio_year;
$pub_type["{$option->tid}"] = _biblio_localize_type($option->tid, $option->name);
}
while ($auth = db_fetch_object($authors)) {
$pub_authors[$auth->cid] = $auth->lastname . (!empty($auth->firstname) || !empty($auth->initials) ? ', ' . $auth->firstname . ' ' . $auth->initials : '');
}
while ($keyword = db_fetch_object($keywords)) {
$pub_keywords[$keyword->kid] = $keyword->word;
}
while ($tax = db_fetch_object($taxoresult)) {
$pub_taxo["{$tax->taxid}"] = "{$tax->vocab_name} - {$tax->termname}";
}
$author_select = count($pub_authors) > 1 ? array(
'title' => t('Author'),
'options' => $pub_authors,
) : null;
$years_select = count($pub_years) > 1 ? array(
'title' => t('Year'),
'options' => array_unique($pub_years),
) : null;
$type_select = count($pub_type) > 1 ? array(
'title' => t('Type'),
'options' => array_unique($pub_type),
) : null;
$tax_select = count($pub_taxo) > 1 ? array(
'title' => t('Term'),
'options' => array_unique($pub_taxo),
) : null;
$keyword_select = count($pub_keywords) > 1 ? array(
'title' => t('Keyword'),
'options' => $pub_keywords,
) : null;
$filters = array(
'author' => $author_select,
'type' => $type_select,
'term_id' => $tax_select,
'year' => $years_select,
'keyword' => $keyword_select,
);
return $filters;
}