function _biblio_export in Bibliography Module 6
Same name and namespace in other branches
- 5 biblio.module \_biblio_export()
1 call to _biblio_export()
- biblio_export in ./
biblio.import.export.inc - Export nodes in a given file format.
File
- ./
biblio.import.export.inc, line 523 - Functions that are used to import and export biblio data.
Code
function _biblio_export($nids, $format = "tagged", $popup = false, $version = 8) {
$count = 0;
if ($format == 'xml') {
$format = 'endnote8';
}
foreach ($nids as $nid) {
$node = node_load($nid, FALSE, TRUE);
if (variable_get('biblio_hide_bibtex_braces', 0) && $format != "bibtex") {
$node->title = biblio_remove_brace($node->title);
}
if (variable_get('biblio_filter_exports', 0)) {
_biblio_export_filter($node, $format);
}
$count++;
set_time_limit(30);
switch ($format) {
case "tagged":
if (!$popup && $count == 1) {
drupal_set_header('Content-type: application/x-endnote-refer');
drupal_set_header('Content-Disposition: filename="Drupal-Biblio.enw"');
}
if (!$popup) {
print biblio_endnote_tagged_export($node);
}
else {
$popup_data .= biblio_endnote_tagged_export($node);
}
break;
case "xml":
case "endnote8":
$format = 'xml';
module_load_include('inc', 'biblio', 'endnote8_export');
if ($count == 1) {
drupal_set_header('Content-type: application/xml; charset=utf-8');
drupal_set_header('Content-Disposition: attachment; filename="Biblio-EndNote' . $version . '.xml"');
print _endnote8_XML_export('', 'begin');
}
print _endnote8_XML_export($node);
break;
case "bibtex":
if (!$popup && $count == 1) {
drupal_set_header('Content-type: application/text; charset=utf-8');
drupal_set_header('Content-Disposition: filename="Biblio-Bibtex.bib"');
}
if (!$popup) {
print biblio_bibtex_export($node);
}
else {
$popup_data .= biblio_bibtex_export($node);
}
break;
case "csv":
drupal_set_header('Content-Type: application/text; charset=utf-8');
drupal_set_header('Content-Disposition: attachment; filename=Biblio-export.csv');
print biblio_csv_export($node);
break;
case 'rtf':
if ($count == 1) {
$style_name = biblio_get_style();
module_load_include('inc', 'biblio', "biblio_style_{$style_name}");
module_load_include('php', 'biblio', "class_rtf");
$style_function = "biblio_style_{$style_name}";
$rtf = new rtf();
$rtf
->setPaperSize(5);
$rtf
->setPaperOrientation(1);
$rtf
->setDefaultFontFace(1);
$rtf
->setDefaultFontSize(24);
$rtf
->setAuthor("Biblio");
$rtf
->setOperator("");
$rtf
->setTitle("Biblio RTF Export");
$rtf
->addColour("#000000");
}
$rtf
->addText(filter_xss($style_function($node, $base, $inline) . '<br><br>', array(
'i',
'b',
'br',
'u',
'p',
'strong',
'em',
'sub',
'sup',
'ul',
'li',
)));
break;
}
}
if ($format == 'xml' && $count > 0) {
print _endnote8_XML_export('', 'end');
}
if ($format == 'rtf' && $count > 0) {
$rtf
->getDocument();
}
if ($popup && !empty($popup_data)) {
return '<pre>' . $popup_data . '</pre>';
}
}