assertPermission('director/hosts'); } public function editAction() { $url = clone($this->getRequest()->getUrl()); $url->setPath('director/hosts/addservice'); parent::editAction(); $this->addActionLink($this->view->qlink( $this->translate('Add Service'), $url, null, array('class' => 'icon-plus') )); } protected function addActionLink($link) { if (! is_array($this->view->actionLinks)) { $this->view->actionLinks = array(); } $this->view->actionLinks[] = $link; return $this; } public function addserviceAction() { $this->singleTab($this->translate('Add Service')); $filter = Filter::fromQueryString($this->params->toString()); $objects = array(); $db = $this->db(); /** @var $filter FilterChain */ foreach ($filter->filters() as $sub) { /** @var $sub FilterChain */ foreach ($sub->filters() as $ex) { /** @var $ex FilterChain|FilterExpression */ if ($ex->isExpression() && $ex->getColumn() === 'name') { $name = $ex->getExpression(); $objects[$name] = IcingaHost::load($name, $db); } } } $this->view->title = sprintf( $this->translate('Add service to %d hosts'), count($objects) ); $this->view->form = $this->loadForm('IcingaAddServiceToMultipleHosts') ->setHosts($objects) ->setDb($this->db()) ->handleRequest(); $this->setViewScript('objects/form'); } }