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

View File

@ -8,6 +8,8 @@
</div> </div>
<?php endif ?> <?php endif ?>
<div class="content">
<?php if ($contacts->hasResult()): ?>
<table class="action action-table listing-table" data-base-target="_next"> <table class="action action-table listing-table" data-base-target="_next">
<thead> <thead>
<tr> <tr>
@ -31,7 +33,7 @@
); ?> ); ?>
</td> </td>
<td> <td>
<?= $this->translate('Email'); ?>: <?= $this->translate('Email') ?>:
<a href="mailto:<?= $contact->contact_email; ?>" <a href="mailto:<?= $contact->contact_email; ?>"
title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>" 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); ?>"> aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>">
@ -40,9 +42,7 @@
</td> </td>
<td> <td>
<?php if ($contact->contact_pager): ?> <?php if ($contact->contact_pager): ?>
<div>
<?= $this->escape($contact->contact_pager) ?> <?= $this->escape($contact->contact_pager) ?>
</div>
<?php endif; ?> <?php endif; ?>
</td> </td>
@ -61,10 +61,7 @@
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?php if ($contacts->hasMore()): ?>
<?php if (! $contacts->hasResult()): ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php elseif ($contacts->hasMore()): ?>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Show More'), $this->translate('Show More'),
$this->url()->without(array('view', 'limit')), $this->url()->without(array('view', 'limit')),
@ -75,4 +72,7 @@
) )
); ?> ); ?>
<?php endif ?> <?php endif ?>
<?php else: ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php endif ?>
</div>