Skip to content

Commit

Permalink
pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
smartinkc committed Oct 9, 2019
1 parent b62b873 commit fb8588d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@
"required": false,
"type": "text",
"repeatable": false
},
{
"key": "pdf-title",
"name": "PDF Title",
"required": false,
"type": "text",
"repeatable": false
}
]
},
Expand Down
11 changes: 10 additions & 1 deletion multilingualPDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
//encoding
$encodingLanguage = $module->getProjectSetting('encoding-language', $_GET['pid']);
$encoding = $module->getProjectSetting('encoding-type', $_GET['pid']);
$languageTitles = $module->getProjectSetting('pdf-title', $_GET['pid']);

$pdf_encoding = '';
$pdf_title = '';
foreach($encodingLanguage AS $key => $value){
if($value == $language){
$pdf_encoding = $encoding[$key];
$pdf_title = $languageTitles[$key];
}
}

Expand Down Expand Up @@ -60,6 +63,12 @@

//replace labels and element_enum with translations
foreach($metadata AS $key => $values){
//remove PDF-HIDDEN
if(strpos($values['misc'], '@PDF-HIDDEN') !== false){
unset($metadata[$key]);
continue;
}

if($translations['questions'][$values['field_name']]['text']){
$metadata[$key]['element_label'] = $translations['questions'][$values['field_name']]['text'];
}
Expand All @@ -79,5 +88,5 @@
// Render the PDF
header("Content-type:application/pdf");
header("Content-Disposition:attachment; filename={$filename}");
renderPDF($metadata, $acknowledgement, strip_tags($app_title), $Data, isset($_GET['compact']));
renderPDF($metadata, $acknowledgement, strip_tags($pdf_title), $Data, isset($_GET['compact']));
?>

0 comments on commit fb8588d

Please sign in to comment.