icingaweb2/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml

67 lines
2.2 KiB
PHTML

<?php
$o = $this->object;
$isService = (isset($o->service_description)) ? true : false;
$obj = new \stdClass();
$obj->handled =
($isService) ? $o->service_handled : $o->host_handled;
$obj->state =
($isService) ? $o->service_state : $o->host_state;
$obj->acknowledged =
($isService) ? $o->service_acknowledged : $o->host_acknowledged;
$obj->in_downtime =
($isService) ? $o->in_downtime : $o->host_in_downtime;
$obj->is_flapping =
($isService) ? $o->is_flapping : $o->host_is_flapping;
$obj->notifications_enabled =
($isService) ? $o->notifications_enabled : $o->service_notifications_enabled;
$obj->active_checks_enabled =
($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled;
$obj->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();
if (! $obj->handled && $obj->state > 0) {
$i[] = $this->img('img/icons/unhandled.png', array('title' => 'Unhandled'));
}
if ($obj->acknowledged && ! $obj->in_downtime) {
$i[] = $this->img('img/icons/acknowledgement.png', array('title' => 'Acknowledged'));
}
if ($obj->is_flapping) {
$i[] = $this->img('img/icons/flapping.png', array('title' => 'Flapping'));
}
if (!$obj->notifications_enabled) {
$i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled'));
}
if ($obj->in_downtime) {
$i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime'));
}
if (! $obj->active_checks_enabled) {
if ($obj->passive_checks_enabled) {
$i[] = $this->img(
'img/icons/active_checks_disabled.png',
array('title' => 'Active Checks Disabled')
);
} else {
$i[] = $this->img(
'img/icons/active_passive_checks_disabled.png',
array('title' => 'Active And Passive Checks Disabled')
);
}
}
if ($obj->last_comment !== null) {
$i[] = $this->img('img/icons/comment.png', array('title' => 'Comments'));
}
?><span>
<?= implode("\n ", $i) . "\n" ?>
</span>