show/activitylog: provice a link to related object

This commit is contained in:
Thomas Gelf 2016-03-02 13:55:11 +01:00
parent 2865efde3f
commit 0d69b9d52e
2 changed files with 25 additions and 9 deletions

View File

@ -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));

View File

@ -37,16 +37,27 @@ $url = $this->url()->without('checksum')->without('show');
<th><?= $this->translate('Date') ?></th>
<td><?= $this->entry->change_time ?></td>
</tr>
<?php if ($this->object_name): ?>
<tr>
<th><?= $this->translate('Action') ?></th>
<td><?= sprintf(
<td><?= $this->entry->action_name ?></td>
</tr>
<?php else: ?>
<tr>
<th><?= $this->translate('Action') ?></th>
<td data-base-target="_next"><?= sprintf(
'%s %s "%s"',
$this->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)
)
)
?></td>
</tr>
<?php endif ?>
<tr>
<th><?= $this->translate('Checksum') ?></th>
<td><?= bin2hex($this->entry->checksum) ?></td>