diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:44:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:44:46 +0000 |
commit | b18bc644404e02b57635bfcc8258e85abb141146 (patch) | |
tree | 686512eacb2dba0055277ef7ec2f28695b3418ea /library/Icingadb/Widget/ItemList/HistoryList.php | |
parent | Initial commit. (diff) | |
download | icingadb-web-b18bc644404e02b57635bfcc8258e85abb141146.tar.xz icingadb-web-b18bc644404e02b57635bfcc8258e85abb141146.zip |
Adding upstream version 1.1.1.upstream/1.1.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | library/Icingadb/Widget/ItemList/HistoryList.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/library/Icingadb/Widget/ItemList/HistoryList.php b/library/Icingadb/Widget/ItemList/HistoryList.php new file mode 100644 index 0000000..d3b6232 --- /dev/null +++ b/library/Icingadb/Widget/ItemList/HistoryList.php @@ -0,0 +1,57 @@ +<?php + +/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */ + +namespace Icinga\Module\Icingadb\Widget\ItemList; + +use Icinga\Module\Icingadb\Common\CaptionDisabled; +use Icinga\Module\Icingadb\Common\DetailActions; +use Icinga\Module\Icingadb\Common\LoadMore; +use Icinga\Module\Icingadb\Common\NoSubjectLink; +use Icinga\Module\Icingadb\Common\TicketLinks; +use Icinga\Module\Icingadb\Common\ViewMode; +use ipl\Orm\ResultSet; +use ipl\Web\Common\BaseItemList; +use ipl\Web\Url; + +class HistoryList extends BaseItemList +{ + use CaptionDisabled; + use NoSubjectLink; + use ViewMode; + use LoadMore; + use TicketLinks; + use DetailActions; + + protected $defaultAttributes = ['class' => 'history-list']; + + protected function init(): void + { + /** @var ResultSet $data */ + $data = $this->data; + $this->data = $this->getIterator($data); + $this->initializeDetailActions(); + $this->setDetailUrl(Url::fromPath('icingadb/event')); + } + + protected function getItemClass(): string + { + switch ($this->getViewMode()) { + case 'minimal': + return HistoryListItemMinimal::class; + case 'detailed': + $this->removeAttribute('class', 'default-layout'); + + return HistoryListItemDetailed::class; + default: + return HistoryListItem::class; + } + } + + protected function assemble(): void + { + $this->addAttributes(['class' => $this->getViewMode()]); + + parent::assemble(); + } +} |