You are here

function biblio_save_node in Bibliography Module 6.2

Same name and namespace in other branches
  1. 6 biblio.import.export.inc \biblio_save_node()
  2. 7 includes/biblio.import.export.inc \biblio_save_node()
  3. 7.2 includes/biblio.import.export.inc \biblio_save_node()
9 calls to biblio_save_node()
biblio_import_batch_operations in includes/biblio.import.export.inc
biblio_marc_biblio_import in modules/marcParse/biblio_marc.module
biblio_save_imported_nodes in includes/biblio.import.export.inc
Saves a biblio node imported from a file.
EndNoteXMLParser::endnote7_endElement in modules/endnote/endnote_xml_parser.inc
EndNoteXMLParser::endnote8_endElement in modules/endnote/endnote_xml_parser.inc

... See full list

File

includes/biblio.import.export.inc, line 582
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->uid = $user->uid;
  $node->type = 'biblio';
  $node->comment = variable_get('comment_biblio', 0);
  $node->promote = in_array('promote', $options);
  $node->moderate = in_array('moderate', $options);
  $node->sticky = in_array('sticky', $options);

  //  $node->format = 0;
  $node->status = in_array('status', $options);
  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 : 0;
  }
  else {

    // $save_node = FALSE, primarily used to parse data and return it to the input form
    return (array) $node;
  }
}