2013-07-03 14:37:49 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2013-07-22 16:03:36 +02:00
|
|
|
|
2014-09-04 13:07:03 +02:00
|
|
|
/* use Icinga\Module\Monitoring\Object\MonitoredObject; */
|
2013-09-24 15:26:10 +02:00
|
|
|
|
2013-07-03 14:37:49 +02:00
|
|
|
/**
|
2013-10-07 16:46:20 +02:00
|
|
|
* Rendering helper for object's properties which may be either enabled or disabled
|
2013-07-03 14:37:49 +02:00
|
|
|
*/
|
|
|
|
class Zend_View_Helper_MonitoringFlags extends Zend_View_Helper_Abstract
|
|
|
|
{
|
|
|
|
/**
|
2013-10-07 16:46:20 +02:00
|
|
|
* Object's properties which may be either enabled or disabled and their human readable description
|
|
|
|
*
|
2013-07-03 14:37:49 +02:00
|
|
|
* @var string[]
|
|
|
|
*/
|
2013-10-07 16:46:20 +02:00
|
|
|
private static $flags = array(
|
|
|
|
'passive_checks_enabled' => 'Passive Checks',
|
|
|
|
'active_checks_enabled' => 'Active Checks',
|
|
|
|
'obsessing' => 'Obsessing',
|
|
|
|
'notifications_enabled' => 'Notifications',
|
|
|
|
'event_handler_enabled' => 'Event Handler',
|
|
|
|
'flap_detection_enabled' => 'Flap Detection',
|
2013-07-03 14:37:49 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2013-10-07 16:46:20 +02:00
|
|
|
* Retrieve flags as array with either true or false as value
|
|
|
|
*
|
2014-09-04 13:07:03 +02:00
|
|
|
* @param MonitoredObject $object
|
2013-10-07 16:46:20 +02:00
|
|
|
*
|
|
|
|
* @return array
|
2013-07-03 14:37:49 +02:00
|
|
|
*/
|
2014-09-04 13:07:03 +02:00
|
|
|
public function monitoringFlags(/*MonitoredObject*/ $object)
|
2013-07-03 14:37:49 +02:00
|
|
|
{
|
2013-10-07 16:46:20 +02:00
|
|
|
$flags = array();
|
|
|
|
foreach (self::$flags as $column => $description) {
|
|
|
|
$flags[$description] = (bool) $object->{$column};
|
2013-07-03 14:37:49 +02:00
|
|
|
}
|
2013-10-07 16:46:20 +02:00
|
|
|
return $flags;
|
2013-07-03 14:37:49 +02:00
|
|
|
}
|
2013-08-07 10:27:50 +02:00
|
|
|
}
|