File: CubeLinks.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 (36 lines) | stat: -rw-r--r-- 881 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
29
30
31
32
33
34
35
36
<?php

namespace Icinga\Module\Map\ProvidedHook;

use Icinga\Data\Filter\Filter;
use Icinga\Module\Cube\Cube;
use Icinga\Module\Cube\Hook\ActionsHook;
use Icinga\Module\Cube\Ido\IdoHostStatusCube;
use Icinga\Web\View;

class CubeLinks extends ActionsHook
{
    /**
     * @inheritdoc
     */
    public function prepareActionLinks(Cube $cube, View $view)
    {
        if (! $cube instanceof IdoHostStatusCube) {
            return;
        }

        $vars = array("objectType"=>"host");
        foreach ($cube->getSlices() as $key => $val) {
            $vars['_host_' . $key] = $val;
        }

        $url = 'map';

        $this->addActionLink(
            $this->makeUrl($url, $vars),
            $view->translate('Show on map'),
            $view->translate('This shows all matching hosts and their current state on the map module'),
            'globe'
        );
    }
}