icingaweb2-module-businessp.../library/Businessprocess/HostNode.php
2015-03-16 09:08:00 +01:00

40 lines
1 KiB
PHP

<?php
namespace Icinga\Module\Businessprocess;
class HostNode extends Node
{
protected $hostname;
public function __construct(BusinessProcess $bp, $object)
{
$this->name = $object->hostname . ';Hoststate';
$this->hostname = $object->hostname;
$this->bp = $bp;
if (isset($object->state)) {
$this->setState($object->state);
} else {
$this->setState(0)->setMissing();
}
}
public function renderLink($view)
{
if ($this->bp->isSimulationMode()) {
return $view->qlink($this->getHostname(), 'businessprocess/host/simulate', array(
'config' => $this->bp->getName(),
'node' => $this->name
));
} else {
return $view->qlink($this->getHostname(), 'monitoring/host/show', array(
'config' => $this->bp->getName(),
'host' => $this->getHostname()
));
}
}
public function getHostname()
{
return $this->hostname;
}
}