Browse Source

added compare_bib_entry_by_name()

pull/25/head
Markus Jochim 11 years ago
committed by Martin Monperrus
parent
commit
724eea77e4
  1. 20
      bibtexbrowser.php

20
bibtexbrowser.php

@ -1805,6 +1805,26 @@ function compare_bib_entry_by_raw_abbrv($a, $b)
return strcmp($a->getRawAbbrv(),$b->getRawAbbrv()); return strcmp($a->getRawAbbrv(),$b->getRawAbbrv());
} }
/** compares two instances of BibEntry by author or editor
*/
function compare_bib_entry_by_name($a, $b)
{
if ($a->hasField(AUTHOR))
$namesA = $a->getAuthor();
else if ($a->hasField(EDITOR))
$namesA = $a->getField(EDITOR);
else
$namesA = __('No author');
if ($b->hasField(AUTHOR))
$namesB = $b->getAuthor();
else if ($b->hasField(EDITOR))
$namesB = $b->getField(EDITOR);
else
$namesB = __('No author');
return strcmp($namesA, $namesB);
}
/** compares two instances of BibEntry by month /** compares two instances of BibEntry by month
* @author Jan Geldmacher * @author Jan Geldmacher

Loading…
Cancel
Save