2014-09-12 16:52:45 +02:00
|
|
|
<tr>
|
2015-02-23 17:27:13 +01:00
|
|
|
<th><?= $this->translate('Comments'); ?></th>
|
2014-09-12 16:52:45 +02:00
|
|
|
<td>
|
2015-01-23 10:15:55 +01:00
|
|
|
<?php if ($this->hasPermission('monitoring/command/comment/add')) {
|
2015-03-12 13:39:17 +01:00
|
|
|
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
2015-01-23 10:15:55 +01:00
|
|
|
if ($object->getType() === $object::TYPE_HOST) {
|
2015-02-23 17:27:13 +01:00
|
|
|
echo $this->qlink(
|
2015-02-24 11:35:25 +01:00
|
|
|
$this->translate('Add comment'),
|
2015-01-23 10:15:55 +01:00
|
|
|
'monitoring/host/add-comment',
|
2015-04-20 16:11:08 +02:00
|
|
|
array('host' => $object->getName()),
|
2015-02-23 17:27:13 +01:00
|
|
|
array(
|
2015-02-24 11:35:25 +01:00
|
|
|
'icon' => 'comment',
|
2015-02-23 17:27:13 +01:00
|
|
|
'data-base-target' => '_self',
|
|
|
|
'title' => $this->translate('Add a new comment to this host')
|
2015-02-24 11:35:25 +01:00
|
|
|
)
|
2015-01-23 10:15:55 +01:00
|
|
|
);
|
|
|
|
} else {
|
2015-02-23 17:27:13 +01:00
|
|
|
echo $this->qlink(
|
2015-02-24 11:35:25 +01:00
|
|
|
$this->translate('Add comment'),
|
2015-01-23 10:15:55 +01:00
|
|
|
'monitoring/service/add-comment',
|
2015-04-20 16:11:08 +02:00
|
|
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
2015-02-23 17:27:13 +01:00
|
|
|
array(
|
2015-02-24 11:35:25 +01:00
|
|
|
'icon' => 'comment',
|
2015-02-23 17:27:13 +01:00
|
|
|
'data-base-target' => '_self',
|
|
|
|
'title' => $this->translate('Add a new comment to this service')
|
2015-02-24 11:35:25 +01:00
|
|
|
)
|
2015-01-23 10:15:55 +01:00
|
|
|
);
|
|
|
|
}
|
2015-02-23 17:27:13 +01:00
|
|
|
} else {
|
2015-01-23 10:15:55 +01:00
|
|
|
echo '-';
|
2015-02-23 17:27:13 +01:00
|
|
|
} ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2014-02-18 20:17:33 +01:00
|
|
|
|
2014-09-12 16:52:45 +02:00
|
|
|
<?php
|
2014-02-18 20:17:33 +01:00
|
|
|
|
2014-03-07 11:30:23 +01:00
|
|
|
foreach ($object->comments as $comment) {
|
|
|
|
// Ticket hook sample
|
2015-01-23 09:45:43 +01:00
|
|
|
$commentText = $this->tickets ? preg_replace_callback(
|
2014-03-07 11:30:23 +01:00
|
|
|
$this->tickets->getPattern(),
|
|
|
|
array($this->tickets, 'createLink'),
|
2014-03-09 19:29:23 +01:00
|
|
|
$this->escape($comment->comment)
|
|
|
|
) : $this->escape($comment->comment);
|
2014-03-07 11:30:23 +01:00
|
|
|
|
2014-09-12 16:52:45 +02:00
|
|
|
?>
|
|
|
|
<tr>
|
2015-05-18 14:36:35 +02:00
|
|
|
<th><?= $this->escape($comment->author); ?> (<?= $this->timeAgo($comment->timestamp); ?>)</th>
|
2015-03-13 08:32:39 +01:00
|
|
|
<td data-base-target="_self">
|
|
|
|
<?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
|
|
|
|
$delCommentForm = clone $delCommentForm;
|
2015-05-07 16:20:59 +02:00
|
|
|
$delCommentForm->populate(
|
|
|
|
array(
|
|
|
|
'comment_id' => $comment->id,
|
|
|
|
'comment_is_service' => isset($comment->service_description)
|
|
|
|
)
|
|
|
|
);
|
2015-03-13 08:32:39 +01:00
|
|
|
echo $delCommentForm;
|
|
|
|
} ?>
|
|
|
|
<span class="sr-only">(<?= $this->translate('Comment'); ?>): </span><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2015-01-23 09:45:43 +01:00
|
|
|
<?php } // endforeach ?>
|