RenderStateBadges: strip state name logic

This commit is contained in:
Thomas Gelf 2015-10-06 22:33:59 +02:00
parent 0c633491d4
commit 4c9ed65a09

View file

@ -2,24 +2,16 @@
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) . '">'
if ($state === 'OK') continue;
if ($state === 'UP') continue;
$html .= '<span class="badge badge-' . strtolower($state)
. '" title="' . mt('monitoring', $state) . '">'
. $cnt . '</span>';
}