monitoring: Count hosts once in hosts/show.phtml

This commit is contained in:
Eric Lippmann 2014-12-30 10:26:19 +01:00
parent 973a56c984
commit c87733debc

View File

@ -2,11 +2,12 @@
<?= $this->tabs ?> <?= $this->tabs ?>
</div> </div>
<div class="content"> <div class="content">
<?php if (count($objects) === 0): ?> <?php $hostCount = count($objects) ?>
<?php if ($hostCount === 0): ?>
<?= $this->translate('No hosts matching the filter') ?> <?= $this->translate('No hosts matching the filter') ?>
<?php else: ?> <?php else: ?>
<div class="hbox-item"> <div class="hbox-item">
<b><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', array_sum(array_values($hostStates))), array_sum(array_values($hostStates))) ?></b> <b><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount) ?></b>
</div> </div>
<div class="hbox-item"> <div class="hbox-item">
<?= $this->hostStatesPieChart ?> <?= $this->hostStatesPieChart ?>
@ -22,9 +23,9 @@
$this->translatePlural( $this->translatePlural(
'%u Host', '%u Host',
'%u Hosts', '%u Hosts',
count($objects) $hostCount
), ),
count($objects) $hostCount
) ?> ) ?>
</h3> </h3>