Do not display table when there are no results and fix code style

refs #5543
This commit is contained in:
Matthias Jentsch 2015-09-29 11:12:45 +02:00 committed by Eric Lippmann
parent a0b9a06461
commit 77f5203bbf
2 changed files with 97 additions and 100 deletions

View File

@ -1,5 +1,4 @@
<?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;
if (! $this->compact): ?>
<div class="controls">
@ -12,14 +11,12 @@ if (! $this->compact): ?>
<?php endif ?>
<div class="content">
<?php
if (count($groupData) === 0) {
echo $this->translate('No contactgroups found matching the filter') . '</div>';
return;
}
?>
<table class="action action-table listing-table" data-base-target="_next">
<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<th></th>
@ -43,7 +40,7 @@ if (count($groupData) === 0) {
$this->translate('Show detailed information about %s'),
$groupName
))
); ?>
) ?>
</td>
<td>
<?php if ($groupInfo['alias'] !== $groupName): ?>
@ -53,5 +50,5 @@ if (count($groupData) === 0) {
</tr>
<?php endforeach ?>
</tbody>
</table>
</table>
</div>

View File

@ -8,7 +8,9 @@
</div>
<?php endif ?>
<table class="action action-table listing-table" data-base-target="_next">
<div class="content">
<?php if ($contacts->hasResult()): ?>
<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<th><?= $this->translate('Name') ?></th>
@ -31,7 +33,7 @@
); ?>
</td>
<td>
<?= $this->translate('Email'); ?>:
<?= $this->translate('Email') ?>:
<a href="mailto:<?= $contact->contact_email; ?>"
title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"
aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>">
@ -40,9 +42,7 @@
</td>
<td>
<?php if ($contact->contact_pager): ?>
<div>
<?= $this->escape($contact->contact_pager) ?>
</div>
<?php endif; ?>
</td>
@ -60,11 +60,8 @@
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (! $contacts->hasResult()): ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php elseif ($contacts->hasMore()): ?>
</table>
<?php if ($contacts->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
@ -74,5 +71,8 @@
'class' => 'pull-right show-more'
)
); ?>
<?php endif ?>
<?php else: ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php endif ?>
</div>