Style comment list

This commit is contained in:
Thomas Gelf 2014-03-09 12:10:05 +01:00
parent 7202e13837
commit 6bea9e8b43

View File

@ -1,55 +1,23 @@
<?php
$dateHelper = $this->getHelper('DateFormat');
$commandHelper = $this->getHelper('CommandForm');
$viewHelper = $this->getHelper('MonitoringState');
?>
<div class="controls"> <div class="controls">
<?= $this->tabs ?> <?= $this->tabs ?>
<?= $this->sortControl->render($this); ?> <?= $this->sortControl->render($this); ?>
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?> <?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
</div> </div>
<div class="content"> <div class="content">
<table class="action"> <table class="action">
<tbody> <tbody>
<?php foreach ($comments as $comment): <?php
$objectType = ($comment->comment_objecttype_id === '1') ? 'host' : 'service'; $cf = $this->getHelper('CommandForm');
$objectName = ($objectType === 'host') ? $comment->host_name : $comment->service_name;
$hrefParameters = array(
$objectType => $objectName,
'comment_id' => $comment->comment_id
);
if ($objectType === 'service') {
$hrefParameters['host'] = $comment->host_name;
}
$detailLink = $this->href( foreach ($comments as $comment):
'monitoring/show/' . $objectType,
$hrefParameters
);
$hostLink = $this->href( $objectType = (int) $comment->comment_objecttype_id === 1 ? 'host' : 'service';
'monitoring/show/host',
array( ?>
'host' => $comment->host_name
)
);
?>
<tr> <tr>
<td style="width: 100px;"> <td style="width: 5em; text-align: center;">
<?= date('d.m. H:i', $comment->comment_timestamp); ?>
</td>
<td style="width: 80px;">
<?php if ($comment->comment_objecttype_id === '1'): ?>
<?= $this->icon('host.png', 'Host comment') ?>
<?php elseif ($comment->comment_objecttype_id === '2'): ?>
<?= $this->icon('service.png', 'Service comment') ?>
<?php endif; ?>
<small>
<?php <?php
switch ($comment->comment_type) { switch ($comment->comment_type) {
case 'flapping': case 'flapping':
@ -68,50 +36,35 @@ $viewHelper = $this->getHelper('MonitoringState');
$tooltip = 'Comment was caused by an acknowledgement.'; $tooltip = 'Comment was caused by an acknowledgement.';
} }
?> ?>
<?= $this->icon($icon . '.png', $tooltip) ?> <?= $this->icon($icon . '.png', $tooltip) ?><br />
</small> <?= $this->timeSince($comment->comment_timestamp) ?>
</td> </td>
<td> <td>
<a class="hidden" href="<?= $detailLink; ?>"></a> <?php if ($objectType === 'service'): ?><?= $this->icon('service.png', 'Service comment') ?> <?= $this->qlink(
$comment->service_name,
<div rel="tooltip" title="Comment #<?=$comment->comment_id ?>"> 'monitoring/show/service',
array(
<strong> 'host' => $comment->host_name,
<?php if ($comment->service_name): ?> 'service' => $comment->service_name,
<a href="<?= $detailLink ?>"> )
<?= $comment->service_name ?> ) ?> on<?php else: ?><?= $this->icon('host.png', 'Host comment') ?> <?php endif ?> <?= $this->qlink(
on $comment->service_name,
<?= $comment->host_name; ?> 'monitoring/show/host',
</a> array(
<?php else: ?> 'host' => $comment->host_name
<a href="<?= $hostLink ?>"> )
<?= $comment->host_name; ?> ) ?> by <strong><?= $this->escape($comment->comment_author) ?></strong><br />
</a> <?= $this->escape($comment->comment_data) ?><br />
<?php endif; ?> <?php if ($comment->comment_is_persistent): ?>Comment is persistent<br /><?php endif ?>
</strong>
by
<?= $comment->comment_author; ?>
<div class="small-row">
<?= $comment->comment_data; ?>
</div>
<small>
<span>
<b>Persists: </b><?= ($comment->comment_is_persistent === '1') ? 'Yes' : 'No'; ?>
</span>
<span>
<b>Expires: </b> <?= <b>Expires: </b> <?=
($comment->comment_expiration_timestamp) ? ($comment->comment_expiration_timestamp) ?
'at ' . date('d.m H:i', $comment->comment_expiration_timestamp) : $this->timeUnless($comment->comment_expiration_timestamp) :
'Never'; 'Never'
?> ?>
</span>
</small>
</td> </td>
<td style="width: 40px;" href="#"> <td style="width: 2em">
<?php <?php
$data = array( $data = array(
'commentid' => $comment->comment_id, 'commentid' => $comment->comment_id,
'host' => $comment->host_name 'host' => $comment->host_name
@ -121,16 +74,16 @@ $viewHelper = $this->getHelper('MonitoringState');
$data['service'] = $comment->service_name; $data['service'] = $comment->service_name;
} }
echo $commandHelper->iconSubmitForm( echo $cf->iconSubmitForm(
'img/icons/remove.png', 'img/icons/remove.png',
'Remove comment', 'Remove comment',
'btn-small', 'link-like',
'removecomment', 'removecomment',
$data $data
); );
?>
?>
</td> </td>
</div>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>