summaryrefslogtreecommitdiffstats
path: root/library/Map/ProvidedHook/CubeLinks.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
commita4a4a84d79e95d34f80346c423b4e84f7af3f03d (patch)
tree91608c01e82676102457ffff2219f321ec474657 /library/Map/ProvidedHook/CubeLinks.php
parentInitial commit. (diff)
downloadicingaweb2-module-map-upstream/1.1.0.tar.xz
icingaweb2-module-map-upstream/1.1.0.zip
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--library/Map/ProvidedHook/CubeLinks.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/library/Map/ProvidedHook/CubeLinks.php b/library/Map/ProvidedHook/CubeLinks.php
new file mode 100644
index 0000000..5f819b4
--- /dev/null
+++ b/library/Map/ProvidedHook/CubeLinks.php
@@ -0,0 +1,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'
+ );
+ }
+}