You are here

function biblio_csv_export in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.import.export.inc \biblio_csv_export()
  2. 6 biblio.import.export.inc \biblio_csv_export()
  3. 7.2 includes/biblio.import.export.inc \biblio_csv_export()
1 call to biblio_csv_export()
biblio_backup in includes/biblio.import.export.inc

File

includes/biblio.import.export.inc, line 875
Functions that are used to import and export biblio data.

Code

function biblio_csv_export($results) {
  $csv = '';
  if (!is_array($results)) {
    $result_array[] = (array) $results;
  }
  else {
    $result_array = $results;
  }
  $fieldnames = NULL;
  foreach ((array) $result_array as $rec) {
    if (empty($fieldnames)) {
      $fieldnames = array_keys($rec);
      $csv .= biblio_strcsv($fieldnames);
    }
    $csv .= biblio_strcsv($rec);
  }
  return $csv;
}