Skip to content

Commit

Permalink
Do not display table when there are no results and fix code style
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
majentsch committed Sep 29, 2015
1 parent 1db966b commit 8704c8b
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 96 deletions.
@@ -1,5 +1,4 @@
<?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;

if (! $this->compact): ?>
<div class="controls">
Expand All @@ -12,46 +11,44 @@ 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">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Hostgroup') ?></th>
<th><?= $this->translate('Alias') ?></th>
</tr>
</thead>
<tbody>

<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Hostgroup') ?></th>
<th><?= $this->translate('Alias') ?></th>
</tr>
</thead>
<tbody>

<?php foreach ($groupData as $groupName => $groupInfo): ?>
<tr>
<td class="count-col">
<span class="badge"><?= count($groupInfo['contacts']) ?></span>
</td>
<td>
<?= $this->qlink(
$groupName,
'monitoring/list/contacts',
array('contactgroup' => $groupName),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$groupName
))
); ?>
</td>
<td>
<?php if ($groupInfo['alias'] !== $groupName): ?>
<?= $groupInfo['alias'] ?>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php foreach ($groupData as $groupName => $groupInfo): ?>
<tr>
<td class="count-col">
<span class="badge"><?= count($groupInfo['contacts']) ?></span>
</td>
<td>
<?= $this->qlink(
$groupName,
'monitoring/list/contacts',
array('contactgroup' => $groupName),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$groupName
))
) ?>
</td>
<td>
<?php if ($groupInfo['alias'] !== $groupName): ?>
<?= $groupInfo['alias'] ?>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
118 changes: 59 additions & 59 deletions modules/monitoring/application/views/scripts/list/contacts.phtml
Expand Up @@ -8,71 +8,71 @@
</div>
<?php endif ?>

<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<th><?= $this->translate('Name') ?></th>
<th><?= $this->translate('Email') ?></th>
<th><?= $this->translate('Pager') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($contacts->peekAhead($this->compact) as $contact): ?>
<div class="content">
<?php if ($contacts->hasResult()): ?>
<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<td>
<?= $this->qlink(
$contact->contact_name,
'monitoring/show/contact',
array('contact_name' => $contact->contact_name),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$contact->contact_alias
), 'class' => 'rowaction')
); ?>
</td>
<td>
<?= $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); ?>">
<?= $this->escape($contact->contact_email); ?>
</a>
</td>
<th><?= $this->translate('Name') ?></th>
<th><?= $this->translate('Email') ?></th>
<th><?= $this->translate('Pager') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($contacts->peekAhead($this->compact) as $contact): ?>
<tr>
<td>
<?php if ($contact->contact_pager): ?>
<div>
<?= $this->escape($contact->contact_pager) ?>
</div>
<?php endif; ?>
<?= $this->qlink(
$contact->contact_name,
'monitoring/show/contact',
array('contact_name' => $contact->contact_name),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$contact->contact_alias
), 'class' => 'rowaction')
); ?>
</td>

<?php if ($contact->contact_notify_service_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
<?= $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); ?>">
<?= $this->escape($contact->contact_email); ?>
</a>
</td>
<?php endif; ?>
<td>
<?php if ($contact->contact_pager): ?>
<?= $this->escape($contact->contact_pager) ?>
<?php endif; ?>
</td>

<?php if ($contact->contact_notify_host_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($contact->contact_notify_service_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
</td>
<?php endif; ?>

<?php if (! $contacts->hasResult()): ?>
<?php if ($contact->contact_notify_host_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($contacts->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right show-more'
)
); ?>
<?php endif ?>
<?php else: ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php elseif ($contacts->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right show-more'
)
); ?>
<?php endif ?>

</div>

0 comments on commit 8704c8b

Please sign in to comment.