Hostgroup Overview: Use $query->hasResult() instead of $query->count()

refs #9632
This commit is contained in:
Johannes Meyer 2015-08-03 15:06:22 +02:00
parent 9a0e47a3e1
commit 39d29c79d2

View File

@ -13,11 +13,10 @@ if (! $this->compact): ?>
<div class="content"> <div class="content">
<?php <?php
if (count($hostgroups) === 0) { $firstRow = true;
echo $this->translate('No hostgroups found matching the filter') . '</div>'; foreach ($hostgroups as $h): ?>
return; <?php if ($firstRow): ?>
} <?php $firstRow = false; ?>
?>
<table class="groupview action" data-base-target="_next"> <table class="groupview action" data-base-target="_next">
<thead> <thead>
<th><?= $this->translate('Last Problem'); ?></th> <th><?= $this->translate('Last Problem'); ?></th>
@ -28,7 +27,9 @@ if (count($hostgroups) === 0) {
<th><?= $this->translate('Service States'); ?></th> <th><?= $this->translate('Service States'); ?></th>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($hostgroups as $h): <?php endif ?>
<?php
if ($h->hosts_down_unhandled) { if ($h->hosts_down_unhandled) {
$handled = false; $handled = false;
$state = Host::STATE_DOWN; $state = Host::STATE_DOWN;
@ -53,6 +54,7 @@ if (count($hostgroups) === 0) {
$lastStateChange = $h->hosts_pending_last_state_change; $lastStateChange = $h->hosts_pending_last_state_change;
} }
} }
?> ?>
<tr class="state <?= Host::getStateText($state) ?><?= $handled ? ' handled' : '' ?>" href="<?= <tr class="state <?= Host::getStateText($state) ?><?= $handled ? ' handled' : '' ?>" href="<?=
$this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name)) $this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name))
@ -462,6 +464,10 @@ if (count($hostgroups) === 0) {
</td> </td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
<?php if ($hostgroups->hasResult()): ?>
</tbody> </tbody>
</table> </table>
<?php else: ?>
<?= $this->translate('No hostgroups found matching the filter'); ?>
<?php endif ?>
</div> </div>