From b50d68553f0b9a9c29f0e567c95558bd66fe922f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 28 Feb 2022 17:31:05 +0100 Subject: [PATCH] ActionController: Utilize `Icinga\Common\PdfExport` --- .../Icinga/Web/Controller/ActionController.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 434e07f8b..608159971 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -3,6 +3,9 @@ namespace Icinga\Web\Controller; +use Icinga\Application\Modules\Module; +use Icinga\Common\PdfExport; +use Icinga\File\Pdf; use ipl\I18n\Translation; use Zend_Controller_Action; use Zend_Controller_Action_HelperBroker; @@ -14,7 +17,6 @@ use Icinga\Authentication\Auth; use Icinga\Exception\Http\HttpMethodNotAllowedException; use Icinga\Exception\IcingaException; use Icinga\Exception\ProgrammingError; -use Icinga\File\Pdf; use Icinga\Forms\AutoRefreshForm; use Icinga\Security\SecurityException; use Icinga\Web\Session; @@ -41,6 +43,9 @@ use Icinga\Web\Window; class ActionController extends Zend_Controller_Action { use Translation; + use PdfExport { + sendAsPdf as private newSendAsPdf; + } /** * The login route to use when requiring authentication @@ -522,8 +527,12 @@ class ActionController extends Zend_Controller_Action protected function sendAsPdf() { - $pdf = new Pdf(); - $pdf->renderControllerAction($this); + if (Module::exists('pdfexport')) { + $this->newSendAsPdf(); + } else { + $pdf = new Pdf(); + $pdf->renderControllerAction($this); + } } protected function shutdownSession()