PDFs should be inline not attachments #153

This commit is contained in:
Brendan Heywood 2020-11-04 14:25:36 +11:00 committed by Mark Nelson
parent 75dbbf661d
commit ebfc1c029d
2 changed files with 4 additions and 2 deletions

View file

@ -320,7 +320,7 @@ class template {
return $pdf->Output('', 'S'); return $pdf->Output('', 'S');
} }
$pdf->Output($filename, 'D'); $pdf->Output($filename, 'I');
} }
} }

View file

@ -139,7 +139,7 @@ if (!$downloadown && !$downloadissue) {
if ($canreceive) { if ($canreceive) {
$linkname = get_string('getcustomcert', 'customcert'); $linkname = get_string('getcustomcert', 'customcert');
$link = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id, 'downloadown' => true)); $link = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id, 'downloadown' => true));
$downloadbutton = new single_button($link, $linkname, 'post', true); $downloadbutton = new single_button($link, $linkname, 'get', true);
$downloadbutton->class .= ' m-b-1'; // Seems a bit hackish, ahem. $downloadbutton->class .= ' m-b-1'; // Seems a bit hackish, ahem.
$downloadbutton = $OUTPUT->render($downloadbutton); $downloadbutton = $OUTPUT->render($downloadbutton);
} }
@ -179,6 +179,8 @@ if (!$downloadown && !$downloadissue) {
redirect(new moodle_url('/mod/customcert/view.php', array('id' => $cm->id))); redirect(new moodle_url('/mod/customcert/view.php', array('id' => $cm->id)));
} }
\core\session\manager::write_close();
// Now we want to generate the PDF. // Now we want to generate the PDF.
$template = new \mod_customcert\template($template); $template = new \mod_customcert\template($template);
$template->generate_pdf(false, $userid); $template->generate_pdf(false, $userid);