Johannes Meyer 7987fb3f5a Use the Host and Service object class helpers instead of the Util view helper
This also ensures that all state names that are shown to the user are
properly translated.

refs #7996
2014-12-12 12:22:20 +01:00

40 lines
1.4 KiB
PHTML

<?php
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
$showService = $object->getType() === $object::TYPE_SERVICE;
?>
<?php if (!$this->compact): ?>
<?= $tabs ?>
<?php endif ?>
<table class="objectstate">
<tr class="state <?= Host::getStateText($object->host_state); ?><?= $object->host_handled ? ' handled' : '' ?>">
<td class="state"<?= $showService ? '' : ' rowspan="2"' ?>>
<strong><?= strtoupper(Host::getStateText($object->host_state, true)); ?></strong><br />
<?= $this->prefixedTimeSince($object->host_last_state_change, true) ?>
</td>
<td><b><?= $this->escape($object->host_name) ?></b><?php
if ($object->host_address && $object->host_address !== $object->host_name): ?>
<br><?= $this->escape($object->host_address) ?>
<?php endif ?>
</td>
</tr>
<?php if ($showService): ?>
<tr class="state <?= Service::getStateText($object->service_state); ?><?= $object->service_handled ? ' handled' : '' ?>">
<td class="state">
<strong><?= strtoupper(Service::getStateText($object->service_state, true)); ?></strong><br />
<?= $this->prefixedTimeSince($object->service_last_state_change, true) ?>
</td>
<td><b><?= $this->translate('Service') ?>: <?= $this->escape($object->service_description) ?></b>
<?= $this->render('show/components/statusIcons.phtml') ?>
</td>
</tr>
<?php else: ?>
<tr><td><!--<b>Host state</b>-->&nbsp;</td></tr>
<?php endif ?>
</table>