Plugin: Test2pdf: Improve PDF download filename so it is possible to identify the test

pull/4739/head
Yannick Warnier 2 years ago
parent 30e9d2851e
commit 01f8a3e256
  1. 16
      plugin/test2pdf/src/download-pdf.php

@ -156,4 +156,18 @@ if ($_GET['type'] == 'answer' || $_GET['type'] == 'all') {
}
}
$pdf->Output();
$typeSuffix = 'q';
switch ($_GET['type']) {
case 'question':
$typeSuffix = 'Q';
break;
case 'answer':
$typeSuffix = 'A';
break;
case 'all':
$typeSuffix = 'QA';
break;
}
// Name the file download as something like 'C2-S0-Q34-QA' where C is course ID, S is session ID, Q is quiz ID & QA is the type
$filename = 'C'.$courseId.'-S'.(empty($sessionId) ? '0' : $sessionId).'-Q'.$quizId.'-'.$typeSuffix;
$pdf->Output($filename, 'I');

Loading…
Cancel
Save