monitoring: Fix code style in the show/components/comments.phtml view script
refs #9611
This commit is contained in:
parent
b6caeb6c17
commit
a379a448d9
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
$addLink = '';
|
||||
|
||||
$addLink = false;
|
||||
if ($this->hasPermission('monitoring/command/comment/add')) {
|
||||
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||
if ($object->getType() === $object::TYPE_HOST) {
|
||||
|
@ -28,55 +26,49 @@ if ($this->hasPermission('monitoring/command/comment/add')) {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($object->comments) && ! $addLink) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th><?php
|
||||
|
||||
echo $this->translate('Comments');
|
||||
|
||||
if (! empty($object->comments) && $addLink) {
|
||||
echo '<br />' . $addLink;
|
||||
}
|
||||
|
||||
?></th>
|
||||
<td data-base-target="_self">
|
||||
<?php if (empty($object->comments)): ?>
|
||||
<?= $addLink ?>
|
||||
<?php else: ?>
|
||||
<ul class="inline-comments">
|
||||
<?php foreach ($object->comments as $comment): ?>
|
||||
<?php
|
||||
|
||||
// Form is unset if the current user lacks the respective permission
|
||||
if (isset($delCommentForm)) {
|
||||
$deleteButton = clone($delCommentForm);
|
||||
$deleteButton->populate(
|
||||
array(
|
||||
'comment_id' => $comment->id,
|
||||
'comment_is_service' => isset($comment->service_description)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$deleteButton = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="comment-item">
|
||||
<h3>
|
||||
<span class="author"><?= $this->escape($comment->author) ?></span>
|
||||
<?= $this->timeAgo($comment->timestamp) ?>
|
||||
<?php if (empty($object->comments)):
|
||||
echo $addLink;
|
||||
else: ?>
|
||||
<ul class="inline-comments">
|
||||
<?php foreach ($object->comments as $comment):
|
||||
// Form is unset if the current user lacks the respective permission
|
||||
if (isset($delCommentForm)) {
|
||||
$deleteButton = clone($delCommentForm);
|
||||
$deleteButton->populate(
|
||||
array(
|
||||
'comment_id' => $comment->id,
|
||||
'comment_is_service' => isset($comment->service_description)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$deleteButton = '';
|
||||
}
|
||||
?>
|
||||
<li class="comment-item">
|
||||
<h3>
|
||||
<span class="author"><?= $this->escape($comment->author) ?></span>
|
||||
<?= $this->timeAgo($comment->timestamp) ?>
|
||||
<?= $deleteButton ?>
|
||||
</h3>
|
||||
<p><span class="sr-only">(<?= $this->translate('Comment'); ?>): </span><?= str_replace(array('\r\n', '\n'), '<br>', $this->createTicketLinks($comment->comment)) ?></p>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
||||
</h3>
|
||||
<p>
|
||||
<span class="sr-only">(<?= $this->translate('Comment') ?>): </span>
|
||||
<?= str_replace(array('\r\n', '\n'), '<br>', $this->createTicketLinks($comment->comment)) ?>
|
||||
</p>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue