function _biblio_tagged_export in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 modules/endnote/biblio_tagged.module \_biblio_tagged_export()
- 7 modules/endnote/biblio_tagged.module \_biblio_tagged_export()
2 calls to _biblio_tagged_export()
- BiblioImportExportUnitTest::testBiblioNodeExport in tests/
import.export.test - biblio_tagged_biblio_export in modules/
endnote/ biblio_tagged.module
File
- modules/
endnote/ biblio_tagged.module, line 270
Code
function _biblio_tagged_export($node) {
$export = TRUE;
$tagged = "";
$tagged .= "%0 " . _biblio_tagged_type_map($node->biblio_type, $export) . "\r\n";
switch ($node->biblio_type) {
case 100:
case 101:
case 103:
case 104:
case 105:
case 108:
case 119:
if (!empty($node->biblio_secondary_title)) {
$tagged .= "%B " . trim($node->biblio_secondary_title) . "\r\n";
}
break;
case 102:
if (!empty($node->biblio_secondary_title)) {
$tagged .= "%J " . trim($node->biblio_secondary_title) . "\r\n";
}
break;
}
if (isset($node->biblio_year) && $node->biblio_year < 9998) {
$tagged .= "%D " . trim($node->biblio_year) . "\r\n";
}
if (!empty($node->title)) {
$tagged .= "%T " . trim($node->title) . "\r\n";
}
foreach (biblio_get_contributor_category($node->biblio_contributors, 1) as $auth) {
$tagged .= "%A " . trim($auth['name']) . "\r\n";
}
foreach (biblio_get_contributor_category($node->biblio_contributors, 2) as $auth) {
$tagged .= "%E " . trim($auth['name']) . "\r\n";
}
foreach (biblio_get_contributor_category($node->biblio_contributors, 3) as $auth) {
$tagged .= "%Y " . trim($auth['name']) . "\r\n";
}
foreach (biblio_get_contributor_category($node->biblio_contributors, 4) as $auth) {
$tagged .= "%? " . trim($auth['name']) . "\r\n";
}
$kw_array = array();
if (!empty($node->terms)) {
foreach ($node->terms as $term) {
$kw_array[] = $term->name;
}
}
if (!empty($node->biblio_keywords)) {
foreach ($node->biblio_keywords as $term) {
$kw_array[] = $term;
}
}
if (!empty($kw_array)) {
$kw_array = array_unique($kw_array);
foreach ($kw_array as $term) {
$tagged .= "%K " . trim($term) . "\r\n";
}
}
$abst = "";
if (!empty($node->biblio_abst_e)) {
$abst .= trim($node->biblio_abst_e);
}
if ($abst) {
$search = array(
"/\r/",
"/\n/",
);
$replace = " ";
$abst = preg_replace($search, $replace, $abst);
$tagged .= "%X " . $abst . "\r\n";
}
$skip_fields = array(
'biblio_year',
'biblio_abst_e',
'biblio_abst_f',
'biblio_type',
);
$fields = drupal_schema_fields_sql('biblio');
$fields = array_diff($fields, $skip_fields);
foreach ($fields as $field) {
if (!empty($node->{$field})) {
$tagged .= _biblio_tagged_format_entry($field, $node->{$field});
}
}
if (!empty($node->upload) && count($node->upload['und']) && user_access('view uploaded files')) {
foreach ($node->upload['und'] as $file) {
$tagged .= "%> " . file_create_url($file['uri']) . "\r\n";
// insert file here.
}
}
$tagged .= "\r\n";
return $tagged;
}