$ref,
'ref' => $ref,
'search' => $search,
'order_by' => $order_by,
'offset' => $offset,
'restypes' => $restypes,
'archive' => $archive,
'default_sort_direction' => $default_sort_direction,
'sort' => $sort,
'curpos' => $curpos,
"modal" => ($modal ? "true" : "")
);
// Process text file download
if ($download && $download_file_type == 'text') {
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=" . $lang["metadata"] . "_" . $filename . ".txt");
foreach ($metadata as $metadata_entry) { // Go through each entry
if (!empty($metadata_entry['value'])) {
// This is the field title - the function got this by joining to the resource_type_field in the sql query
echo $metadata_entry['title'] . ': ';
// This is the value for the field from the resource_data table
echo tidylist(i18n_get_translated($metadata_entry['value'])) . "\r\n";
}
}
ob_flush();
exit();
}
// Process PDF file download
if ($download && $download_file_type === 'pdf') {
$logo_src_path = $baseurl . '/gfx/titles/logo.png';
$PDF_filename = $lang['metadata'] . '_' . $filename . '.pdf';
$content = '';
?>
|
page [[page_cu]]/[[page_nb]] |
|
WriteHTML($content);
$html2pdf->Output($PDF_filename);
}
/*
Data only PDFs generation
These PDFs will be based on templates found on the server which will be interpreted and then rendered
*/
if ($download && $data_only) {
$pdf_template_path = get_pdf_template_path($resource['resource_type'], $pdf_template);
$PDF_filename = 'data_only_resource_' . $ref . '.pdf';
// Go through fields and decide which ones we add to the template
$placeholders = array(
'resource_type_name' => get_resource_type_name($resource['resource_type'])
);
foreach ($metadata as $metadata_field) {
$metadata_field_value = trim(tidylist(i18n_get_translated($metadata_field['value'])));
// Skip if empty
if ('' == $metadata_field_value) {
continue;
}
$placeholders['metadatafield-' . $metadata_field['ref'] . ':title'] = $metadata_field['title'];
$placeholders['metadatafield-' . $metadata_field['ref'] . ':value'] = $metadata_field_value;
}
if (!generate_pdf($pdf_template_path, $PDF_filename, $placeholders)) {
$GLOBALs["onload_message"] = array(
'title' => 'Warning',
'message' => 'ResourceSpace could not generate PDF for data only type!'
);
}
}
include "../include/header.php";
?>