function _biblio_ris_export in Bibliography Module 6.2
Same name and namespace in other branches
- 7 modules/RIS/biblio_ris.module \_biblio_ris_export()
- 7.2 modules/RIS/biblio_ris.module \_biblio_ris_export()
1 call to _biblio_ris_export()
- biblio_ris_biblio_export in modules/
RIS/ biblio_ris.module
File
- modules/
RIS/ biblio_ris.module, line 371
Code
function _biblio_ris_export($node) {
$reverse = TRUE;
$ris = "";
$ris .= "TY - " . _biblio_ris_type_map($node->biblio_type, $reverse) . "\r\n";
if (!empty($node->title)) {
$ris .= "T1 - " . trim($node->title) . "\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)) {
$ris .= "T2 - " . trim($node->biblio_secondary_title) . "\r\n";
}
break;
case 102:
if (!empty($node->biblio_secondary_title)) {
$ris .= "JF - " . trim($node->biblio_secondary_title) . "\r\n";
}
unset($node->biblio_secondary_title);
break;
}
if (isset($node->biblio_year) && $node->biblio_year < 9998) {
$ris .= "Y1 - " . trim($node->biblio_year) . "\r\n";
}
if (isset($node->biblio_contributors[1])) {
foreach ($node->biblio_contributors[1] as $auth) {
$ris .= "A1 - " . trim($auth['name']) . "\r\n";
}
}
if (isset($node->biblio_contributors[2])) {
foreach ($node->biblio_contributors[2] as $auth) {
$ris .= "ED - " . 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) {
$ris .= "KW - " . 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);
$ris .= "AB - " . $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})) {
$ris .= _biblio_ris_format_entry($field, $node->{$field});
}
}
$ris .= "ER - \r\n\r\n";
return $ris;
}