From 6273a58046d86355b66ab3df2a4b54d70c213860 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 21 Mar 2018 14:54:42 +0100 Subject: [PATCH] [module.professor.pdf] Generate PDF link --- .gitignore | 3 ++- build/api/module/professor/pdfController.php | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e62f8c8..242c5f3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /public_html/js /node_modules /backup -/tmp \ No newline at end of file +/tmp +/public_html/tmp \ No newline at end of file diff --git a/build/api/module/professor/pdfController.php b/build/api/module/professor/pdfController.php index 48c64a0..2971bd4 100644 --- a/build/api/module/professor/pdfController.php +++ b/build/api/module/professor/pdfController.php @@ -140,9 +140,15 @@ class pdfController{ $body = self::generate_pdf_body($data); /* (2) Set headers */ + + $fullname = $data['prof']['firstName'].' '.$data['prof']['lastName']; + $date = date('d-m-Y'); + $title = "Fiche enseignant - $fullname ($date)"; + $headers = [ - 'Content-Description' => 'File Transfer', + // 'Content-Description' => 'File Transfer', 'Content-Transfer-Encoding' => 'binary', + 'Content-Disposition' => 'attachment; filename=\"'.$title.'\"', 'Cache-Control' => 'public, must-revalidate, max-age=0', 'Pragma' => 'public', 'X-Generator' => 'mPDF',