You are here

function biblio_bibtex_biblio_export in Bibliography Module 6.2

Same name and namespace in other branches
  1. 7 modules/bibtexParse/biblio_bibtex.module \biblio_bibtex_biblio_export()
  2. 7.2 modules/bibtexParse/biblio_bibtex.module \biblio_bibtex_biblio_export()
1 string reference to 'biblio_bibtex_biblio_export'
biblio_bibtex_menu in modules/bibtexParse/biblio_bibtex.module

File

modules/bibtexParse/biblio_bibtex.module, line 187

Code

function biblio_bibtex_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:  application/text; charset=utf-8');
    drupal_set_header('Content-Disposition:  filename="Biblio-Bibtex.bib"');
  }
  while ($node = db_fetch_object($result)) {
    $node = node_load($node->nid, FALSE, TRUE);
    if (!$popup) {
      print _biblio_bibtex_export($node);
    }
    else {
      $popup_data .= _biblio_bibtex_export($node);
    }
  }
  if ($popup && !empty($popup_data)) {
    return '<pre>' . $popup_data . '</pre>';
  }
}