HostController: use host actions hook

refs #8208
This commit is contained in:
Thomas Gelf 2015-01-14 11:01:39 +01:00
parent 5e4b611860
commit 5e94d65a6c

View File

@ -9,6 +9,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostCheckCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandForm;
use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController; use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
use Icinga\Web\Hook;
class Monitoring_HostController extends MonitoredObjectController class Monitoring_HostController extends MonitoredObjectController
{ {
@ -33,12 +34,26 @@ class Monitoring_HostController extends MonitoredObjectController
$this->createTabs(); $this->createTabs();
} }
protected function getHostActions()
{
$urls = array();
foreach (Hook::all('Monitoring\\HostActions') as $hook) {
foreach ($hook->getActionsForHost($this->object) as $id => $url) {
$urls[$id] = $url;
}
}
return $urls;
}
/** /**
* Show a host * Show a host
*/ */
public function showAction() public function showAction()
{ {
$this->getTabs()->activate('host'); $this->getTabs()->activate('host');
$this->view->hostActions = $this->getHostActions();
parent::showAction(); parent::showAction();
} }