2013-08-08 16:22:22 +02:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013 Icinga Development Team | GPLv2+ */
|
2013-08-08 16:22:22 +02:00
|
|
|
|
|
|
|
namespace Icinga\Web\Widget\Tabextension;
|
|
|
|
|
2014-04-28 14:03:52 +02:00
|
|
|
use Icinga\Web\Url;
|
|
|
|
use Icinga\Web\Widget\Tabs;
|
2013-08-08 16:22:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tabextension that allows to add the current URL to a dashboard
|
|
|
|
*
|
|
|
|
* Displayed as a dropdown field in the tabs
|
|
|
|
*/
|
|
|
|
class DashboardAction implements Tabextension
|
|
|
|
{
|
|
|
|
/**
|
2013-08-14 16:00:19 +02:00
|
|
|
* Applies the dashboard actions to the provided tabset
|
|
|
|
*
|
2013-08-16 15:05:03 +02:00
|
|
|
* @param Tabs $tabs The tabs object to extend with
|
2013-08-08 16:22:22 +02:00
|
|
|
*/
|
|
|
|
public function apply(Tabs $tabs)
|
|
|
|
{
|
|
|
|
$tabs->addAsDropdown(
|
|
|
|
'dashboard',
|
|
|
|
array(
|
2014-11-16 14:41:22 +01:00
|
|
|
'icon' => 'dashboard',
|
2015-04-30 17:49:42 +02:00
|
|
|
'label' => t('Add To Dashboard'),
|
2014-11-20 12:08:50 +01:00
|
|
|
'url' => Url::fromPath('dashboard/new-dashlet'),
|
2013-08-08 16:22:22 +02:00
|
|
|
'urlParams' => array(
|
2014-08-13 16:41:40 +02:00
|
|
|
'url' => rawurlencode(Url::fromRequest()->getRelativeUrl())
|
2013-08-08 16:22:22 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|