From a0901c4b7f2db488cb4fb3be2dd921a0308f4659 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:36:40 +0200 Subject: Adding upstream version 1.0.2. Signed-off-by: Daniel Baumann --- application/controllers/EventController.php | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 application/controllers/EventController.php (limited to 'application/controllers/EventController.php') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php new file mode 100644 index 0000000..7108606 --- /dev/null +++ b/application/controllers/EventController.php @@ -0,0 +1,71 @@ +addTitleTab(t('Event')); + + $id = $this->params->getRequired('id'); + + $query = History::on($this->getDb()) + ->with([ + 'host', + 'host.state', + 'service', + 'service.state', + 'comment', + 'downtime', + 'downtime.parent', + 'downtime.parent.host', + 'downtime.parent.host.state', + 'downtime.parent.service', + 'downtime.parent.service.state', + 'downtime.triggered_by', + 'downtime.triggered_by.host', + 'downtime.triggered_by.host.state', + 'downtime.triggered_by.service', + 'downtime.triggered_by.service.state', + 'flapping', + 'notification', + 'acknowledgement', + 'state' + ]) + ->filter(Filter::equal('id', hex2bin($id))); + + $this->applyRestrictions($query); + + $event = $query->first(); + if ($event === null) { + $this->httpNotFound(t('Event not found')); + } + + $this->event = $event; + } + + public function indexAction() + { + $this->addControl((new HistoryList(new ResultSet(new ArrayObject([$this->event])))) + ->setViewMode('minimal') + ->setPageSize(1) + ->setCaptionDisabled() + ->setNoSubjectLink() + ->setDetailActionsDisabled()); + $this->addContent((new EventDetail($this->event))->setTicketLinkEnabled()); + } +} -- cgit v1.2.3