Internal: Fix PDF export formatting and encoding issues for exercise results - refs BT#22053

pull/5833/head
christianbeeznst 2 months ago
parent 2dc3a78518
commit 3e5f466017
  1. 4
      public/main/exercise/exercise_report.php
  2. 8
      public/main/inc/lib/pdf.lib.php

@ -699,7 +699,7 @@ if ($is_allowedToEdit || $is_tutor) {
['name' => 'duration', 'index' => 'exe_duration', 'width' => '150', 'align' => 'left', 'search' => 'true'],
['name' => 'start_date', 'index' => 'start_date', 'width' => '150', 'align' => 'left', 'search' => 'true'],
['name' => 'exe_date', 'index' => 'exe_date', 'width' => '150', 'align' => 'left', 'search' => 'true'],
['name' => 'score', 'index' => 'score', 'width' => '100', 'align' => 'center', 'search' => 'true'],
['name' => 'score', 'index' => 'score', 'width' => '120', 'align' => 'center', 'search' => 'true'],
['name' => 'ip', 'index' => 'user_ip', 'width' => '120', 'align' => 'center', 'search' => 'true'],
[
'name' => 'status',
@ -721,7 +721,7 @@ if ($is_allowedToEdit || $is_tutor) {
],
],
['name' => 'lp', 'index' => 'orig_lp_id', 'width' => '150', 'align' => 'left', 'search' => 'false'],
['name' => 'actions', 'index' => 'actions', 'width' => '120', 'align' => 'left', 'search' => 'false', 'sortable' => 'false'],
['name' => 'actions', 'index' => 'actions', 'width' => '180', 'align' => 'left', 'search' => 'false', 'sortable' => 'false'],
];
if ('true' === $officialCodeInList) {

@ -137,6 +137,10 @@ class PDF
}
}
if (!empty($this->params['session_info']['title'])) {
$this->params['session_info']['title'] = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $this->params['session_info']['title']);
}
$tpl->assign('pdf_course', $this->params['course_code']);
$tpl->assign('pdf_course_info', $this->params['course_info']);
$tpl->assign('pdf_session_info', $this->params['session_info']);
@ -413,7 +417,7 @@ class PDF
$basicStyles = [];
$doc = new DOMDocument();
@$doc->loadHTML($document_html);
@$doc->loadHTML('<?xml encoding="UTF-8">' . $document_html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$linksToRemove = [];
@ -476,7 +480,7 @@ class PDF
$document_html
);
$document_html = str_replace(api_get_path(WEB_ARCHIVE_PATH), api_get_path(SYS_ARCHIVE_PATH), $document_html);
$document_html = str_replace('<?xml encoding="UTF-8">', '', $document_html);
// The library mPDF expects UTF-8 encoded input data.
api_set_encoding_html($document_html, 'UTF-8');
// At the moment the title is retrieved from the html document itself.

Loading…
Cancel
Save