statusIcons cleanup, this file will probably fade out

This commit is contained in:
Thomas Gelf 2014-03-06 19:00:10 +00:00
parent 3da5c3f064
commit da5f3c191c
1 changed files with 13 additions and 24 deletions

View File

@ -1,6 +1,10 @@
<?php <?php
use Icinga\Module\Monitoring\Object\Service;
$o = $this->object; $o = $this->object;
$isService = (isset($o->service_description)) ? true : false;
$isService = $o instanceof Service;
$obj = new \stdClass(); $obj = new \stdClass();
$obj->handled = $obj->handled =
($isService) ? $o->service_handled : $o->host_handled; ($isService) ? $o->service_handled : $o->host_handled;
@ -18,49 +22,34 @@
($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled; ($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled;
$obj->passive_checks_enabled = $obj->passive_checks_enabled =
($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled; ($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled;
$obj->last_comment =
($isService) ? $o->last_comment : $o->host_last_comment;
$i = array(); $i = array();
if (! $obj->handled && $obj->state > 0) { if (! $obj->handled && $obj->state > 0) {
$i[] = $this->img('img/icons/unhandled.png', array('title' => 'Unhandled')); $i[] = $this->icon('unhandled.png', 'Unhandled');
} }
if ($obj->acknowledged && ! $obj->in_downtime) { if ($obj->acknowledged && ! $obj->in_downtime) {
$i[] = $this->img('img/icons/acknowledgement.png', array('title' => 'Acknowledged')); $i[] = $this->icon('acknowledgement.png', 'Acknowledged');
} }
if ($obj->is_flapping) { if ($obj->is_flapping) {
$i[] = $this->img('img/icons/flapping.png', array('title' => 'Flapping')); $i[] = $this->icon('flapping.png', 'Flapping');
} }
if (!$obj->notifications_enabled) { if (!$obj->notifications_enabled) {
$i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled')); $i[] = $this->icon('notification_disabled.png', 'Notifications Disabled');
} }
if ($obj->in_downtime) { if ($obj->in_downtime) {
$i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime')); $i[] = $this->icon('in_downtime.png', 'In Downtime');
} }
if (! $obj->active_checks_enabled) { if (! $obj->active_checks_enabled) {
if ($obj->passive_checks_enabled) { if ($obj->passive_checks_enabled) {
$i[] = $this->img( $i[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled');
'img/icons/active_checks_disabled.png',
array('title' => 'Active Checks Disabled')
);
} else { } else {
$i[] = $this->img( $i[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled');
'img/icons/active_passive_checks_disabled.png',
array('title' => 'Active And Passive Checks Disabled')
);
} }
} }
if ($obj->last_comment !== null) { ?><?= implode("\n", $i) ?>
$i[] = $this->img('img/icons/comment.png', array('title' => 'Comments'));
}
?><span>
<?= implode("\n ", $i) . "\n" ?>
</span>