Fork of bibtexbrowser for static publications lists on the website of the ZRD Saar
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

48 lines
1.4 KiB

<?php
/**
* A helper Display class that is just like SimpleDisplay but just never
* outputs section headers (i.e. year numbers). Used by YearCatDisplay.
**/
class NoHeaderDisplay extends SimpleDisplay {
function changeSection($pred, $bib) {
return false;
}
}
/**
* A modified "Academic" display, with reversed grouping. First grouping is by
* year, then by category. Uses NoHeaderDisplay to not have year numbers within
* categories.
*/
class YearCatDisplay extends AcademicDisplay {
/** an array of strings representing years */
var $yearIndex;
/** transforms a query to HTML
* $ query is an array (e.g. array(Q_YEAR=>'2005'))
* $title is a string, the title of the section
*/
function search2html($query, $title) {
$entries = $this->db->multisearch($query);
if (count($entries)>0) {
echo "\n".'<div class="theader">'.$title.'</div>'."\n";
}
$display = new NoHeaderDisplay();
$display->setEntries($entries);
$display->display();
}
function display() {
$this->db = createBibDataBase();
$this->db->bibdb = $this->entries;
$this->yearIndex = $this->db->yearIndex();
foreach($this->yearIndex as $year) {
echo "\n".'<div class="sheader">'.$year.'</div>'."\n";
foreach (_DefaultBibliographySections() as $section) {
$this->search2html(array_merge(array(Q_YEAR=>$year), $section['query']),$section['title']);
}
}
}
}
?>