icingaweb2/modules/monitoring/application/views/scripts/show/components/comments.phtml

51 lines
1.3 KiB
PHTML
Raw Normal View History

<?php
2014-02-18 20:17:33 +01:00
$cf = $this->getHelper('CommandForm');
$data = array('host' => $object->host_name);
if ($object->service_description) {
$data['service'] = $object->service_description;
}
2014-03-07 11:30:23 +01:00
$list = array();
foreach ($object->comments as $comment) {
// Ticket hook sample
$text = $this->tickets ? preg_replace_callback(
$this->tickets->getPattern(),
array($this->tickets, 'createLink'),
$this->escape($comment->comment)
) : $this->escape($comment->comment);
2014-03-07 11:30:23 +01:00
$deleteData = $data;
$deleteData['commentid'] = $comment->id;
2014-03-07 11:30:23 +01:00
// $iconForm = $cf->iconSubmitForm(
// 'img/icons/remove_petrol.png',
$iconForm = $cf->labelSubmitForm(
'X',
2014-03-07 11:30:23 +01:00
'Remove comment',
'link-like',
2014-03-07 11:30:23 +01:00
'removecomment',
$deleteData
);
2014-03-07 10:41:59 +01:00
2014-03-07 11:30:23 +01:00
$list[] = sprintf(
2014-03-25 09:03:12 +01:00
'<tr><th>%s (%s)</th><td data-base-target="_self">%s (%s) %s</td></tr>',
$this->escape($comment->author),
$this->timeSince($comment->timestamp),
$iconForm,
ucfirst($comment->type),
2014-03-07 11:30:23 +01:00
$text
);
}
?>
<tr>
<th><?= $this->translate('Comments') ?></th>
<td>
<a href="<?= $this->href('monitoring/command/addComment', $data) ?>"><?= $this->icon('comment_petrol.png') ?> <?= $this->translate('Add comment') ?></a>
</td>
</tr>
<?= implode("\n", $list) ?>