2014-03-08 19:49:57 +01:00
|
|
|
<?php
|
2015-03-16 17:38:07 +01:00
|
|
|
|
2015-09-07 09:53:53 +02:00
|
|
|
use Icinga\Web\Navigation\Navigation;
|
|
|
|
|
|
|
|
$navigation = new Navigation();
|
2015-09-07 10:54:43 +02:00
|
|
|
$navigation->load($object->getType() . '-action');
|
|
|
|
foreach ($navigation as $item) {
|
|
|
|
$item->setObject($object);
|
|
|
|
}
|
2015-09-07 09:53:53 +02:00
|
|
|
|
2015-03-16 17:38:07 +01:00
|
|
|
// add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
|
|
|
|
$newTabInfo = sprintf('<span class="info-box display-on-hover"> %s </span>', $this->translate('opens in new window'));
|
|
|
|
|
2015-09-07 09:53:53 +02:00
|
|
|
foreach ($object->getActionUrls() as $i => $link) {
|
|
|
|
$navigation->addItem(
|
|
|
|
'Action ' . ($i + 1) . $newTabInfo,
|
|
|
|
array(
|
|
|
|
'url' => $link,
|
2015-09-28 09:05:17 +02:00
|
|
|
'target' => '_blank',
|
|
|
|
'renderer' => array(
|
|
|
|
'NavigationItemRenderer',
|
|
|
|
'escape_label' => false
|
|
|
|
)
|
2015-09-07 09:53:53 +02:00
|
|
|
)
|
|
|
|
);
|
2014-03-08 19:49:57 +01:00
|
|
|
}
|
|
|
|
|
2015-05-18 11:45:39 +02:00
|
|
|
if (isset($this->actions)) {
|
|
|
|
foreach ($this->actions as $id => $action) {
|
2015-09-07 09:53:53 +02:00
|
|
|
$navigation->addItem($id, array('url' => $action));
|
2015-01-14 11:02:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-17 11:01:06 +02:00
|
|
|
if ($navigation->isEmpty() || !$navigation->hasRenderableItems()) {
|
2015-01-14 11:50:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-08 19:49:57 +01:00
|
|
|
?>
|
|
|
|
<tr>
|
2015-09-07 09:53:53 +02:00
|
|
|
<th><?= $this->translate('Actions'); ?></th>
|
2015-09-16 13:32:20 +02:00
|
|
|
<?= $navigation->getRenderer()->setElementTag('td')->setCssClass('actions'); ?>
|
2015-09-07 09:53:53 +02:00
|
|
|
</tr>
|