Added Voiceplan PDF export

This commit is contained in:
Frank Schubert
2024-08-30 13:17:22 +02:00
parent 46c97221eb
commit ebace237da
3 changed files with 99 additions and 0 deletions

View File

@@ -297,4 +297,25 @@ class VoiceplanController extends mfBaseController {
$this->redirect("Voiceplan", "Index");
}
protected function downloadPdf() {
$this->layout()->setTemplate("Voiceplan/export.pdf");
$voiceplan = new Voiceplan($this->request->id);
if(!$voiceplan->id) {
$this->layout()->setFlash("Sprachtarif nicht gefunden", "error");
$this->redirect("Voiceplan", "Index");
}
$pdf_vars = [
"voiceplan" => $voiceplan,
];
$pdf = new PdfForm("Voiceplan/export.pdf", $pdf_vars);
$title = "Xinon Sprachtarif ".$voiceplan->name;
$pdf->render("--footer-center '$title Seite [page] / [topage]' --footer-font-name OpenSans --footer-font-size 9");
$tvalue = $pdf->getReturnedValues();
$pdfname = $tvalue['filename'];
$pdf->download($pdfname);
}
}