function _bibtex_export in Bibliography Module 5
2 calls to _bibtex_export()
File
- ./
biblio.module, line 2516
Code
function _bibtex_export($results) {
if (!is_array($results)) {
$result_array[] = $results;
}
else {
$result_array = $results;
}
$bibtex = '';
foreach ($result_array as $pub) {
$type = "article";
$journal = $series = $booktitle = $school = $organization = null;
switch ($pub->biblio_type) {
case 102:
$type = "article";
$journal = $pub->biblio_secondary_title;
break;
case 100:
$type = "book";
$series = $pub->biblio_secondary_title;
break;
case 101:
$type = "inbook";
$booktitle = $pub->biblio_secondary_title;
break;
// case 103:
// $type = "conference";
// break;
case 100:
$type = "incollection";
break;
case 103:
$type = "inproceedings";
$booktitle = $pub->biblio_secondary_title;
$organization = $pub->biblio_publisher;
break;
case 129:
$type = "misc";
break;
case 108:
$type = "phdthesis";
$school = $pub->biblio_publisher;
$pub->biblio_publisher = null;
break;
case 104:
$type = "proceedings";
break;
case 109:
$type = "techreport";
$institution = $pub->biblio_publisher;
$pub->biblio_publisher = null;
break;
case 124:
$type = "unpublished";
break;
}
$bibtex .= '@' . $type . ' { ';
$bibtex .= $pub->biblio_citekey ? $pub->biblio_citekey . ",\n" : ",\n";
if ($pub->title) {
$bibtex .= "\ttitle = {" . $pub->title . "},\n";
}
if ($journal) {
$bibtex .= "\tjournal = {" . $journal . "},\n";
}
if ($booktitle) {
$bibtex .= "\tbooktitle = {" . $booktitle . "},\n";
}
if ($series) {
$bibtex .= "\tseries = {" . $series . "},\n";
}
if ($pub->biblio_volume) {
$bibtex .= "\tvolume = {" . $pub->biblio_volume . "},\n";
}
if ($pub->biblio_number) {
$bibtex .= "\tnumber = {" . $pub->biblio_number . "},\n";
}
if ($pub->biblio_year) {
$bibtex .= "\tyear = {" . $pub->biblio_year . "},\n";
}
if ($pub->biblio_notes) {
$bibtex .= "\tnote = {" . $pub->biblio_notes . "},\n";
}
if ($pub->biblio_date) {
$bibtex .= "\tmonth = {" . $pub->biblio_date . "},\n";
}
if ($pub->biblio_pages) {
$bibtex .= "\tpages = {" . $pub->biblio_pages . "},\n";
}
if ($pub->biblio_publisher) {
$bibtex .= "\tpublisher = {" . $pub->biblio_publisher . "},\n";
}
if ($school) {
$bibtex .= "\tschool = {" . $school . "},\n";
}
if ($organization) {
$bibtex .= "\torganization = {" . $organization . "},\n";
}
if ($institution) {
$bibtex .= "\tinstitution = {" . $institution . "},\n";
}
if ($pub->biblio_type_of_work) {
$bibtex .= "\ttype = {" . $pub->biblio_type_of_work . "},\n";
}
if ($pub->biblio_edition) {
$bibtex .= "\tedition = {" . $pub->biblio_edition . "},\n";
}
if ($pub->biblio_section) {
$bibtex .= "\tchapter = {" . $pub->biblio_section . "},\n";
}
if ($pub->biblio_place_published) {
$bibtex .= "\taddress = {" . $pub->biblio_place_published . "},\n";
}
if ($pub->biblio_abst_e) {
$bibtex .= "\tabstract = {" . $pub->biblio_abst_e . "},\n";
}
if ($pub->biblio_keywords) {
$bibtex .= "\tkeywords = {" . $pub->biblio_keywords . "},\n";
}
if ($pub->biblio_isbn) {
$bibtex .= "\tISBN = {" . $pub->biblio_isbn . "},\n";
}
if ($pub->biblio_url) {
$bibtex .= "\tURL = {" . $pub->biblio_url . "},\n";
}
if ($pub->biblio_authors) {
$bibtex .= "\tauthor = {" . str_replace(";", " and ", $pub->biblio_authors) . "}\n";
}
if ($pub->biblio_secondary_authors) {
$bibtex .= "\teditor = {" . str_replace(";", " and ", $pub->biblio_secondary_authors) . "},\n";
}
$bibtex .= "}\n\n";
}
return $bibtex;
}