2014-03-08 13:49:57 -05:00
|
|
|
<?php
|
2015-03-16 12:38:07 -04:00
|
|
|
|
2015-09-07 03:53:53 -04:00
|
|
|
use Icinga\Web\Navigation\Navigation;
|
|
|
|
|
|
|
|
|
|
$navigation = new Navigation();
|
2015-09-07 04:54:43 -04:00
|
|
|
$navigation->load($object->getType() . '-action');
|
|
|
|
|
foreach ($navigation as $item) {
|
|
|
|
|
$item->setObject($object);
|
|
|
|
|
}
|
2015-09-07 03:53:53 -04:00
|
|
|
|
|
|
|
|
foreach ($object->getActionUrls() as $i => $link) {
|
|
|
|
|
$navigation->addItem(
|
2015-10-01 11:49:43 -04:00
|
|
|
|
|
|
|
|
// add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
|
|
|
|
|
$this->icon(
|
|
|
|
|
'forward',
|
|
|
|
|
$this->translate('Link opens in new window'),
|
|
|
|
|
array('aria-label' => $this->translate('Link opens in new window'))
|
|
|
|
|
) . ' Action ' . ($i + 1),
|
2015-09-07 03:53:53 -04:00
|
|
|
array(
|
|
|
|
|
'url' => $link,
|
2015-09-28 03:05:17 -04:00
|
|
|
'target' => '_blank',
|
|
|
|
|
'renderer' => array(
|
|
|
|
|
'NavigationItemRenderer',
|
|
|
|
|
'escape_label' => false
|
|
|
|
|
)
|
2015-09-07 03:53:53 -04:00
|
|
|
)
|
|
|
|
|
);
|
2014-03-08 13:49:57 -05:00
|
|
|
}
|
|
|
|
|
|
2015-05-18 05:45:39 -04:00
|
|
|
if (isset($this->actions)) {
|
2016-01-11 11:03:46 -05:00
|
|
|
$navigation->merge($this->actions);
|
2015-01-14 05:02:43 -05:00
|
|
|
}
|
|
|
|
|
|
2016-01-12 02:58:32 -05:00
|
|
|
if ($navigation->isEmpty() || ! $navigation->hasRenderableItems()) {
|
2015-01-14 05:50:03 -05:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-08 13:49:57 -05:00
|
|
|
?>
|
|
|
|
|
<tr>
|
2015-09-07 03:53:53 -04:00
|
|
|
<th><?= $this->translate('Actions'); ?></th>
|
2016-01-12 06:28:12 -05:00
|
|
|
<?= $navigation->getRenderer()->setElementTag('td')->setCssClass('actions go-ahead'); ?>
|
2016-01-12 02:58:32 -05:00
|
|
|
</tr>
|