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
|
<?php
namespace Icinga\Module\Map\ProvidedHook;
use Icinga\Module\Cube\Cube;
use Icinga\Module\Cube\Hook\ActionsHook;
use Icinga\Module\Cube\IcingaDb\IcingaDbHostStatusCube;
use Icinga\Web\View;
class IcingaDbCubeLinks extends ActionsHook
{
/**
* @inheritdoc
*/
public function prepareActionLinks(Cube $cube, View $view)
{
if (! $cube instanceof IcingaDbHostStatusCube) {
return;
}
$vars = ["objectType"=>"host"];
foreach ($cube->getSlices() as $dimension => $slice) {
$vars['host.vars.' . $dimension] = trim($slice, '"');
}
$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'
);
}
}
|