mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-29 18:19:33 -05:00
32 lines
828 B
PHP
32 lines
828 B
PHP
<?php
|
|
|
|
class Zend_View_Helper_RenderStateBadges extends Zend_View_Helper_Abstract
|
|
{
|
|
protected $stateNames = array(
|
|
0 => 'OK',
|
|
1 => 'WARNING',
|
|
2 => 'CRITICAL',
|
|
3 => 'UNKNOWN',
|
|
99 => 'PENDING',
|
|
);
|
|
|
|
public function renderStateBadges($summary)
|
|
{
|
|
$html = '';
|
|
|
|
foreach ($summary as $state => $cnt) {
|
|
if ($cnt === 0) continue;
|
|
if ($state === 0) continue;
|
|
$stateName = $this->stateNames[$state];
|
|
$html .= '<span class="badge badge-' . strtolower($stateName)
|
|
. '" title="' . mt('monitoring', $stateName) . '">'
|
|
. $cnt . '</span>';
|
|
}
|
|
|
|
if ($html !== '') {
|
|
$html = '<div class="badges">' . $html . '</div>';
|
|
}
|
|
|
|
return $html;
|
|
}
|
|
}
|