/** * Get service actions from hook * * @return Navigation */ protected function getServiceActions() { $navigation = new Navigation(); foreach (Hook::all('Monitoring\\ServiceActions') as $hook) { $navigation->merge($hook->getNavigation($this->object)); } return $navigation; }
/** * (non-PHPDoc) * @see \Icinga\Web\Controller\ActionController For the method documentation. */ public function prepareInit() { parent::prepareInit(); if (Hook::has('ticket')) { $this->view->tickets = Hook::first('ticket'); } if (Hook::has('grapher')) { $this->view->grapher = Hook::first('grapher'); } }
/** * Get host actions from hook * * @return array */ 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; }
protected function enumSourceTypes() { $hooks = Hook::all('Director\\ImportSource'); $enum = array(); foreach ($hooks as $hook) { $enum[get_class($hook)] = $hook->getName(); } asort($enum); return $enum; }
protected function collectExtraFiles() { foreach (Hook::all('Director\\ShipConfigFiles') as $hook) { foreach ($hook->fetchFiles() as $filename => $file) { if (array_key_exists($filename, $this->files)) { throw new ProgrammingError('Cannot ship one file twice: %s', $filename); } if ($file instanceof IcingaConfigFile) { $this->files[$filename] = $file; } else { $this->configFile($filename, '')->setContent((string) $file); } } } return $this; }
public function testReturnsAnEmptyArrayWithNoRegisteredHook() { $this->assertEquals(array(), Hook::all('not_existing')); }
/** * Register hook * * @param string $name * @param string $class * @param string $key * * @return self */ protected function registerHook($name, $class, $key = null) { if ($key === null) { $key = $this->name; } Hook::register($name, $key, $class); return $this; }
/** * Initialize system configuration tabs */ public function initializeSystemConfigurationTabs() { $configurationTab = new ConfigurationTab('configuration', 'configuration/index', 'Configuration'); // Display something about us Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, $configurationTab->getModuleName(), $configurationTab); $modulesOverviewTab = new ConfigurationTab('modules', 'modules/overview', 'Modules'); Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, $modulesOverviewTab->getModuleName(), $modulesOverviewTab); }
/** * Fetch all entries and forecasts by using the dataview associated with this timeline * * @return array The dataview's result */ private function fetchResults() { $hookResults = array(); foreach (Hook::all('timeline') as $timelineProvider) { $hookResults = array_merge($hookResults, $timelineProvider->fetchEntries($this->displayRange), $timelineProvider->fetchForecasts($this->forecastRange)); foreach ($timelineProvider->getIdentifiers() as $identifier => $attributes) { if (!array_key_exists($identifier, $this->identifiers)) { $this->identifiers[$identifier] = $attributes; } } } $query = $this->dataview; $filter = Filter::matchAll(Filter::where('type', array_keys($this->identifiers)), Filter::expression('timestamp', '<=', $this->displayRange->getStart()->getTimestamp()), Filter::expression('timestamp', '>', $this->displayRange->getEnd()->getTimestamp())); $query->applyFilter($filter); return array_merge($query->getQuery()->fetchAll(), $hookResults); }
protected function enumDataTypes() { $hooks = Hook::all('Director\\DataType'); $enum = array(null => '- please choose -'); foreach ($hooks as $hook) { $enum[get_class($hook)] = $hook->getName(); } return $enum; }