From e293a8cbb0aab7678e44304806b2ac00e447ecbd Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 3 Mar 2022 09:17:12 +0100 Subject: [PATCH] servicegroup: Add missing details to pdf exports --- .../controllers/ServicegroupController.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/application/controllers/ServicegroupController.php b/application/controllers/ServicegroupController.php index 7ee8e862..65d92326 100644 --- a/application/controllers/ServicegroupController.php +++ b/application/controllers/ServicegroupController.php @@ -11,6 +11,7 @@ use Icinga\Module\Icingadb\Redis\VolatileStateResults; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ItemList\ServiceList; use Icinga\Module\Icingadb\Widget\ItemList\ServicegroupList; +use ipl\Html\Html; use ipl\Stdlib\Filter; class ServicegroupController extends Controller @@ -40,6 +41,7 @@ class ServicegroupController extends Controller } $this->servicegroup = $servicegroup; + $this->view->title = $servicegroup->display_name; } public function indexAction() @@ -67,10 +69,20 @@ class ServicegroupController extends Controller yield $this->export($services); - $this->addControl((new ServicegroupList([$this->servicegroup])) - ->setViewMode('minimal') - ->setDetailActionsDisabled() - ->setNoSubjectLink()); + // ICINGAWEB_EXPORT_FORMAT is not set yet and $this->format is inaccessible, yeah... + if ($this->getRequest()->getParam('format') === 'pdf') { + $this->addContent((new ServicegroupList([$this->servicegroup])) + ->setViewMode('minimal') + ->setDetailActionsDisabled() + ->setNoSubjectLink()); + $this->addContent(Html::tag('h2', null, t('Services'))); + } else { + $this->addControl((new ServicegroupList([$this->servicegroup])) + ->setViewMode('minimal') + ->setDetailActionsDisabled() + ->setNoSubjectLink()); + } + $this->addControl($paginationControl); $this->addControl($viewModeSwitcher); $this->addControl($limitControl);