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

50 lines
1.4 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_data)
) : $this->escape($comment->comment_data);
$deleteData = $data;
$deleteData['commentid'] = $object->comment_internal_id;
$iconForm = $cf->iconSubmitForm(
'img/icons/remove.png',
'Remove comment',
'btn-small',
'removecomment',
$deleteData
);
2014-03-07 10:41:59 +01:00
2014-03-07 11:30:23 +01:00
$list[] = sprintf(
"<br />%s [%s] %s (%s): %s\n",
//'<input type="submit" value="x" style="width: 2em" />',
'<a href="#">' . $this->icon('remove_petrol.png') . '</a>' . $iconForm, // Test
$this->escape($comment->comment_author),
$this->timeSince($comment->comment_timestamp),
$comment->comment_type,
$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>
<?= implode('', $list) ?>
</td>
</tr>