ActionController: Utilize Icinga\Common\PdfExport

This commit is contained in:
Johannes Meyer 2022-02-28 17:31:05 +01:00
parent 466a6189a7
commit b50d68553f

View File

@ -3,6 +3,9 @@
namespace Icinga\Web\Controller; namespace Icinga\Web\Controller;
use Icinga\Application\Modules\Module;
use Icinga\Common\PdfExport;
use Icinga\File\Pdf;
use ipl\I18n\Translation; use ipl\I18n\Translation;
use Zend_Controller_Action; use Zend_Controller_Action;
use Zend_Controller_Action_HelperBroker; use Zend_Controller_Action_HelperBroker;
@ -14,7 +17,6 @@ use Icinga\Authentication\Auth;
use Icinga\Exception\Http\HttpMethodNotAllowedException; use Icinga\Exception\Http\HttpMethodNotAllowedException;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\File\Pdf;
use Icinga\Forms\AutoRefreshForm; use Icinga\Forms\AutoRefreshForm;
use Icinga\Security\SecurityException; use Icinga\Security\SecurityException;
use Icinga\Web\Session; use Icinga\Web\Session;
@ -41,6 +43,9 @@ use Icinga\Web\Window;
class ActionController extends Zend_Controller_Action class ActionController extends Zend_Controller_Action
{ {
use Translation; use Translation;
use PdfExport {
sendAsPdf as private newSendAsPdf;
}
/** /**
* The login route to use when requiring authentication * The login route to use when requiring authentication
@ -522,8 +527,12 @@ class ActionController extends Zend_Controller_Action
protected function sendAsPdf() protected function sendAsPdf()
{ {
$pdf = new Pdf(); if (Module::exists('pdfexport')) {
$pdf->renderControllerAction($this); $this->newSendAsPdf();
} else {
$pdf = new Pdf();
$pdf->renderControllerAction($this);
}
} }
protected function shutdownSession() protected function shutdownSession()