You are here

function biblio_ris_biblio_export in Bibliography Module 6.2

Same name and namespace in other branches
  1. 7 modules/RIS/biblio_ris.module \biblio_ris_biblio_export()
  2. 7.2 modules/RIS/biblio_ris.module \biblio_ris_biblio_export()
1 string reference to 'biblio_ris_biblio_export'
biblio_ris_menu in modules/RIS/biblio_ris.module

File

modules/RIS/biblio_ris.module, line 158

Code

function biblio_ris_biblio_export($nid = null) {
  $popup = FALSE;
  if ($nid === null && isset($_SESSION['last_biblio_query']) && !empty($_SESSION['last_biblio_query'])) {
    $query = $_SESSION['last_biblio_query'];
    $params = $_SESSION['last_biblio_query_terms'];
  }
  elseif (!empty($nid)) {
    $query = db_rewrite_sql("SELECT DISTINCT(n.nid) FROM {node} n  WHERE n.nid=%d ");
    $params[] = $nid;
  }
  else {
    return;
  }
  $result = db_query($query, $params);
  $count = 0;
  if (module_exists('popups') && $nid) {
    $popup = TRUE;
  }
  else {
    drupal_set_header('Content-type: applications/x-research-info-systems');
    drupal_set_header('Content-Disposition: attachment; filename="Drupal-Biblio.ris"');
  }
  while ($node = db_fetch_object($result)) {
    $node = node_load($node->nid, FALSE, TRUE);
    if (variable_get('biblio_hide_bibtex_braces', 0)) {
      $node->title = biblio_remove_brace($node->title);
    }
    if (!$popup) {
      print _biblio_ris_export($node);
    }
    else {
      $popup_data .= _biblio_ris_export($node);
    }
  }
  if ($popup && !empty($popup_data)) {
    return '<pre>' . $popup_data . '</pre>';
  }
}