From 472e31e55ea35cf5373ca375ed732897756a3613 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 5 Oct 2015 12:38:12 +0200 Subject: [PATCH] Node: move logic to new getStateClassNames() method --- library/Businessprocess/Node.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index 2a039e3..f756d2b 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -335,16 +335,26 @@ abstract class Node return $this->className; } + protected function getStateClassNames() + { + $state = strtolower($this->getStateName()); + if ($this->isMissing()) { + return array('missing'); + } elseif ($state === 'ok') { + return array('ok'); + } else { + return array('problem', $state); + } + } + public function renderHtml($view, $prefix = '') { $id = $this->getId($prefix); - $state = strtolower($this->getStateName()); - if ($this->isMissing()) $state = 'missing'; $handled = $this->isAcknowledged() || $this->isInDowntime(); $html = sprintf( '', - $state === 'ok' ? 'ok' : 'problem ' . $state, + implode(' ', $this->getStateClassNames()), $handled ? ' handled' : '', ($this->hasChildren() ? ' operator ' : ' node '), $this->getObjectClassName(),