From 0d69b9d52e99728750f051b2bd0477bc892f8577 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 2 Mar 2016 13:55:11 +0100 Subject: [PATCH] show/activitylog: provice a link to related object --- application/controllers/ShowController.php | 19 ++++++++++++------- .../views/scripts/show/activitylog.phtml | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/application/controllers/ShowController.php b/application/controllers/ShowController.php index 51e9b45a..15c4f9f0 100644 --- a/application/controllers/ShowController.php +++ b/application/controllers/ShowController.php @@ -148,20 +148,25 @@ class ShowController extends ActionController public function activitylogAction() { + $v = $this->view; + + $v->object_type = $this->params->get('type'); + $v->object_name = $this->params->get('name'); + if ($id = $this->params->get('id')) { - $this->view->entry = $this->db()->fetchActivityLogEntryById($id); + $v->entry = $this->db()->fetchActivityLogEntryById($id); } elseif ($checksum = $this->params->get('checksum')) { - $this->view->entry = $this->db()->fetchActivityLogEntry(Util::hex2binary($checksum)); - $id = $this->view->entry->id; + $v->entry = $this->db()->fetchActivityLogEntry(Util::hex2binary($checksum)); + $id = $v->entry->id; } - $this->view->neighbors = $this->db()->getActivitylogNeighbors( + $v->neighbors = $this->db()->getActivitylogNeighbors( $id, - $this->params->get('type'), - $this->params->get('name') + $v->object_type, + $v->object_name ); - $entry = $this->view->entry; + $entry = $v->entry; $this->activityTabs($entry); $this->showInfo($entry); $func = 'show' . ucfirst($this->params->get('show', $this->defaultTab)); diff --git a/application/views/scripts/show/activitylog.phtml b/application/views/scripts/show/activitylog.phtml index 175bfb2f..f3829f06 100644 --- a/application/views/scripts/show/activitylog.phtml +++ b/application/views/scripts/show/activitylog.phtml @@ -37,16 +37,27 @@ $url = $this->url()->without('checksum')->without('show'); translate('Date') ?> entry->change_time ?> +object_name): ?> translate('Action') ?> - entry->action_name ?> + + + + translate('Action') ?> + entry->action_name, $this->entry->object_type, - $this->entry->object_name + $this->qlink( + $this->entry->object_name, + 'director/' . preg_replace('/^icinga_/', '', $this->entry->object_type), + array('name' => $this->entry->object_name) + ) ) ?> + translate('Checksum') ?> entry->checksum) ?>