diff options
Diffstat (limited to 'library/Map/ProvidedHook/Monitoring/ServiceActions.php')
-rw-r--r-- | library/Map/ProvidedHook/Monitoring/ServiceActions.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/library/Map/ProvidedHook/Monitoring/ServiceActions.php b/library/Map/ProvidedHook/Monitoring/ServiceActions.php new file mode 100644 index 0000000..e29140d --- /dev/null +++ b/library/Map/ProvidedHook/Monitoring/ServiceActions.php @@ -0,0 +1,28 @@ +<?php + +namespace Icinga\Module\Map\ProvidedHook\Monitoring; + +use Icinga\Module\Monitoring\Hook\ServiceActionsHook; +use Icinga\Module\Monitoring\Object\Service; +use Icinga\Web\Navigation\Navigation; +use Icinga\Web\Navigation\NavigationItem; +use Icinga\Web\Url; + +class ServiceActions extends ServiceActionsHook +{ + public function getActionsForService(Service $service) + { + $nav = new Navigation(); + + $service->fetchCustomvars(); + if (array_key_exists("geolocation", $service->customvars)) { + $nav->addItem(new NavigationItem(t('Show on map'), array( + 'url' => Url::fromPath('map/', array('showHost' => $service->host_name . "!" . $service->getName())), + 'target' => '_next', + 'icon' => 'globe', + ))); + } + + return $nav; + } +} |