icingaweb2-module-businessp.../library/Businessprocess/ServiceNode.php
2014-11-30 15:56:58 +01:00

47 lines
1.2 KiB
PHP

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