function biblio_save_node in Bibliography Module 6
Same name and namespace in other branches
- 6.2 includes/biblio.import.export.inc \biblio_save_node()
- 7 includes/biblio.import.export.inc \biblio_save_node()
- 7.2 includes/biblio.import.export.inc \biblio_save_node()
10 calls to biblio_save_node()
- biblio_import_batch_operations in ./
biblio.import.export.inc - biblio_marc_import in ./
biblio.import.export.inc - biblio_save_imported_nodes in ./
biblio.import.export.inc - Save node imported from a file.
- en7_endElement in ./
endnote7_parser.inc - en8_endElement in ./
endnote8_parser.inc
File
- ./
biblio.import.export.inc, line 892 - Functions that are used to import and export biblio data.
Code
function biblio_save_node($node, $batch = FALSE, $session_id = NULL, $save_node = TRUE) {
global $user;
if ($batch && $session_id) {
// we are batch processing some import data
$node = base64_encode(serialize($node));
// base64_encode to avoid problems unserializing strings with embeded quotes.
db_query("INSERT INTO {biblio_import_cache} (session_id, data) VALUES ('%s', %b)", $session_id, $node);
return;
}
$options = variable_get('node_options_biblio', array(
'status',
));
if (module_exists('i18n') && variable_get('i18n_node_biblio', 0) && variable_get('language_content_type_biblio', 0)) {
$node['language'] = module_invoke('i18n', 'default_language');
}
$node_template = array(
'uid' => $user->uid,
'type' => 'biblio',
'comment' => variable_get('comment_biblio', 0),
'promote' => in_array('promote', $options),
'moderate' => in_array('moderate', $options),
'sticky' => in_array('sticky', $options),
'format' => 0,
'status' => in_array('status', $options),
);
$node = (object) array_merge((array) $node, $node_template);
if (!isset($node->biblio_type)) {
$node->biblio_type = 129;
// default to misc if not set.
}
if ($save_node) {
// $save_node = TRUE, the normal save path
node_save($node);
return isset($node->nid) ? $node->nid : FALSE;
}
else {
// $save_node = FALSE, primarily used to parse data and return it to the input form
return (array) $node;
}
}