Skip to content

Commit 87a7422

Browse files
committed
Quiz: #add configuration option to add official code in the quiz result pdf export file name - refs BT#23065
1 parent 7f2006f commit 87a7422

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

main/exercise/exercise_show.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,9 +974,15 @@ class="exercise_mark_select"
974974

975975
$content = Security::remove_XSS($content);
976976

977+
$includeOfficialCode = "";
978+
if (true === api_get_configuration_value('quiz_result_pdf_export_include_official_code_in_file_name')) {
979+
$includeOfficialCode = $user_info['official_code'] . ' ';
980+
}
981+
977982
$params = [
978983
'filename' => api_replace_dangerous_char(
979984
$objExercise->name.' '.
985+
$includeOfficialCode.
980986
$user_info['complete_name'].' '.
981987
api_get_local_time()
982988
),
@@ -999,7 +1005,7 @@ class="exercise_mark_select"
9991005
if (!is_dir($exportFolderPath)) {
10001006
@mkdir($exportFolderPath);
10011007
}
1002-
$pdfFileName = $user_info['firstname'].' '.$user_info['lastname'].'-attemptId'.$id.'.pdf';
1008+
$pdfFileName = $includeOfficialCode.$user_info['firstname'].' '.$user_info['lastname'].'-attemptId'.$id.'.pdf';
10031009
$pdfFileName = api_replace_dangerous_char($pdfFileName);
10041010
$fileNameToSave = $exportFolderPath.'/'.$pdfFileName;
10051011
$pdf->html_to_pdf_with_template($content, true, false, true, [], 'F', $fileNameToSave);

main/install/configuration.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@
776776
//$_configuration['quiz_question_edit_open_advanced_params_by_default'] = false;
777777
// Define how many seconds an AJAX request should be started to avoid loss of connection.
778778
//$_configuration['quiz_keep_alive_ping_interval'] = 0;
779+
// Add the official code of the user in the pdf export of the results.
780+
//$_configuration['quiz_result_pdf_export_include_official_code_in_file_name'] = false;
779781
// Hide search form in session list
780782
//$_configuration['hide_search_form_in_session_list'] = false;
781783
// Allow exchange of messages from teachers/bosses about a user.

0 commit comments

Comments
 (0)