function biblio_ui_export in Bibliography Module 7.3
Export a Biblio entity to a file by a given format and array of IDs.
Parameters
array $bids: Array of Biblio IDs.
$style_name: Biblio style string.
$format_name: (Optinal) Biblio export format name.
2 calls to biblio_ui_export()
- biblio_ui_export_menu_item in modules/
biblio_ui/ biblio_ui.module - Export a Biblio entity to a file by a given format.
- biblio_ui_export_view in modules/
biblio_ui/ biblio_ui.module - Export a Biblio entities to a file by a View.
File
- modules/
biblio_ui/ biblio_ui.module, line 1135 - Main functionality file for the biblio UI module.
Code
function biblio_ui_export($bids = array(), $style_name, $format_name = NULL) {
$plugin = biblio_get_exportable_biblio_style($style_name, $format_name);
// Use the first format if not given.
if (!$format_name) {
$format_name = reset(array_keys($plugin['export']));
}
$format = $plugin['export'][$format_name];
$filename = $style_name . '.' . $format['file extension'];
drupal_add_http_header('Content-type', 'application/text; charset=utf-8');
drupal_add_http_header('Content-Disposition', 'attachment; filename="' . $filename . '"');
$options = array();
$options['type'] = $format_name;
foreach (biblio_load_multiple($bids) as $biblio) {
print_r($biblio
->getText($style_name, $options));
}
}