diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index c0424a8..ad38936 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -21,6 +21,8 @@ class BpNode extends Node ); + protected $className = 'process'; + public function __construct( BusinessProcess $bp, $object diff --git a/library/Businessprocess/HostNode.php b/library/Businessprocess/HostNode.php index e04212a..cc4387e 100644 --- a/library/Businessprocess/HostNode.php +++ b/library/Businessprocess/HostNode.php @@ -8,6 +8,8 @@ class HostNode extends Node { protected $hostname; + protected $className = 'host'; + public function __construct(BusinessProcess $bp, $object) { $this->name = $object->hostname . ';Hoststatus'; diff --git a/library/Businessprocess/ImportedNode.php b/library/Businessprocess/ImportedNode.php index fd636d5..aedcf86 100644 --- a/library/Businessprocess/ImportedNode.php +++ b/library/Businessprocess/ImportedNode.php @@ -14,6 +14,8 @@ class ImportedNode extends Node protected $importedNode; + protected $className = 'subtree'; + public function __construct(BusinessProcess $bp, $object) { $this->name = $object->name; diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index 44ca343..2a039e3 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -93,6 +93,8 @@ abstract class Node protected $missing = false; + protected $className = 'unknown'; + protected static $state_names = array( 'OK', 'WARNING', @@ -327,32 +329,25 @@ abstract class Node { return md5($prefix . (string) $this); } - + + protected function getObjectClassName() + { + return $this->className; + } + public function renderHtml($view, $prefix = '') { $id = $this->getId($prefix); $state = strtolower($this->getStateName()); if ($this->isMissing()) $state = 'missing'; $handled = $this->isAcknowledged() || $this->isInDowntime(); - if ($this instanceof BpNode) { - $typeClass = 'process'; - } elseif ($this instanceof HostNode) { - $typeClass = 'host'; - } elseif ($this instanceof ServiceNode) { - $typeClass = 'service'; - } elseif ($this instanceof ImportedNode) { - $typeClass = 'subtree'; - } else { - // WTF? - var_dump($this); exit; - } $html = sprintf( '