function _biblio_marc_export in Bibliography Module 7
1 call to _biblio_marc_export()
- biblio_marc_biblio_export in modules/
marcParse/ biblio_marc.module
File
- modules/
marcParse/ biblio_marc.module, line 319
Code
function _biblio_marc_export($node) {
module_load_include('php', 'biblio_marc', 'php-marc');
$record = new Record();
// Case '008':
// $data = $field->data();
// $node->biblio_year = substr($data, 7, 4);
// $node->biblio_lang = substr($data, 35, 3);
// break;.
$leader = $record
->leader();
if ($node->biblio_type == 100) {
$type = 'nam a';
}
else {
$type = 'nas a';
}
$record
->leader(substr_replace($leader, $type, 5, 5));
$rec_eight = str_repeat(' ', 40);
$rec_eight = substr_replace($rec_eight, $node->biblio_year, 7, 4);
$rec_eight = substr_replace($rec_eight, $node->biblio_lang, 35, 3);
$rec_eight = substr_replace($rec_eight, 'd', 39, 1);
$field = new Field("008", $rec_eight);
$record
->append_fields($field);
if (!empty($node->biblio_isbn)) {
$field = new Field("020", "", "", array(
"a" => $node->biblio_isbn,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_issn)) {
$field = new Field("022", "", "", array(
"a" => $node->biblio_issn,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_other_number)) {
$field = new Field("024", "", "", array(
"a" => $node->biblio_other_number,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_call_number)) {
$field = new Field("050", "", "", array(
"a" => $node->biblio_call_number,
));
$record
->append_fields($field);
}
if (!empty($node->title)) {
$field = new Field("245", "0", "0", array(
"a" => $node->title,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_sort_title)) {
$field = new Field("210", "0", "#", array(
"a" => $node->biblio_sort_title,
));
$record
->append_fields($field);
}
// Case '245':
// $node->title = str_replace(' /', '', $field->subfield('a')) . ' ' . $field->subfield('b');
// break;.
if (!empty($node->biblio_edition)) {
$field = new Field("250", "", "", array(
"a" => $node->biblio_edition,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_place_published)) {
$subfields['a'] = $node->biblio_place_published;
}
if (!empty($node->biblio_publisher)) {
$subfields['b'] = $node->biblio_publisher;
}
if (!empty($node->biblio_date)) {
$subfields['c'] = $node->biblio_date;
}
if (!empty($subfields)) {
$field = new Field("260", "", "", $subfields);
$record
->append_fields($field);
}
if (!empty($node->biblio_pages)) {
$field = new Field("300", "", "", array(
"a" => $node->biblio_pages,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_volume)) {
$field = new Field("490", "0", "", array(
"v" => $node->biblio_volume,
));
$record
->append_fields($field);
}
if (!empty($node->biblio_abst_e)) {
$field = new Field("520", "3", "#", array(
"a" => $node->biblio_abst_e,
));
$record
->append_fields($field);
}
// Case ($tagnum >= 500 && $tagnum <= 599):
// $value = $field->subfield('a');
// if (!empty($value)) {
// $node->biblio_notes .= $value;
// }.
if (!empty($node->biblio_keywords)) {
foreach ($node->biblio_keywords as $keyword) {
$field = new Field("653", "1", "0", array(
"a" => $keyword,
));
$record
->append_fields($field);
}
}
if (!empty($node->biblio_contributors)) {
foreach ($node->biblio_contributors as $i => $author) {
$first = $author['firstname'];
$last = $author['lastname'];
$init = $author['initials'];
$cat = $author['auth_category'];
$name = $last . ($first ? ', ' . $first : '') . ($init ? ', ' . $init : '');
$tag = $i == 0 ? $cat == 5 ? 110 : 100 : ($cat == 5 ? 710 : 700);
$field = new Field($tag, "1", "#", array(
"a" => $name,
));
$record
->append_fields($field);
}
}
if (!empty($node->biblio_url)) {
$url = $node->biblio_url;
}
else {
$options['absolute'] = TRUE;
$url = url("node/{$node->nid}", $options);
}
if (!empty($url)) {
$field = new Field("856", "", "", array(
"u" => $url,
));
$record
->append_fields($field);
}
return $record
->raw();
}