File: ServiceActions.php

package info (click to toggle)
icingaweb2-module-map 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 9,028 kB
  • sloc: javascript: 11,939; php: 1,207; sh: 54; makefile: 15
file content (28 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
    }
}