From 99710309658da8866210d3ad4391113408403b35 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 6 Mar 2014 11:15:28 +0000 Subject: [PATCH] Send PDF BEFORE we take care of custom headers --- .../Web/Controller/ActionController.php | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 8e512ebe2..181e84625 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -283,6 +283,21 @@ class ActionController extends Zend_Controller_Action $this->addModuleContainer(); + if ($user = $this->getRequest()->getUser()) { + // Cast preference app.showBenchmark to bool because preferences loaded from a preferences storage are + // always strings + if ((bool) $user->getPreferences()->get('app.showBenchmark', false) === true) { + Benchmark::measure('Response ready'); + $this->_helper->layout()->benchmark = $this->renderBenchmark(); + } + } + + if ($this->_request->getParam('format') === 'pdf') { + $this->_helper->layout()->setLayout('pdf'); + $this->sendAsPdf(); + exit; + } + if ($this->_request->isXmlHttpRequest() || $this->getParam('view') === 'compact') { $this->_helper->layout()->setLayout('inline'); } @@ -301,20 +316,6 @@ class ActionController extends Zend_Controller_Action if ($this->autorefreshInterval !== null) { header('X-Icinga-Refresh: ' . $this->autorefreshInterval); } - if ($user = $this->getRequest()->getUser()) { - // Cast preference app.showBenchmark to bool because preferences loaded from a preferences storage are - // always strings - if ((bool) $user->getPreferences()->get('app.showBenchmark', false) === true) { - Benchmark::measure('Response ready'); - $this->_helper->layout()->benchmark = $this->renderBenchmark(); - } - } - if ($this->_request->getParam('format') === 'pdf' && $this->_request->getControllerName() !== 'static') { - $this->sendAsPdf(); - exit; - } - - } protected function addModuleContainer()