2013-08-06 11:53:42 +02:00
|
|
|
<?php
|
2013-08-08 17:42:34 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2013-08-06 11:53:42 +02:00
|
|
|
|
2014-10-31 10:54:53 +01:00
|
|
|
use Icinga\Application\Config;
|
2014-10-31 10:27:17 +01:00
|
|
|
use Icinga\Application\Logger;
|
2014-04-29 11:30:34 +02:00
|
|
|
use Icinga\Exception\ConfigurationError;
|
2014-08-27 16:03:15 +02:00
|
|
|
use Icinga\Exception\IcingaException;
|
2014-10-31 10:54:53 +01:00
|
|
|
use Icinga\Exception\NotReadableError;
|
|
|
|
use Icinga\File\Ini\IniWriter;
|
2014-11-14 10:57:14 +01:00
|
|
|
use Icinga\Forms\Dashboard\AddUrlForm;
|
2014-10-31 10:54:53 +01:00
|
|
|
use Icinga\Web\Controller\ActionController;
|
|
|
|
use Icinga\Web\Url;
|
|
|
|
use Icinga\Web\Widget\Dashboard;
|
2013-08-07 17:44:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle creation, removal and displaying of dashboards, panes and components
|
|
|
|
*
|
|
|
|
* @see Icinga\Web\Widget\Dashboard for more information about dashboards
|
|
|
|
*/
|
2013-08-06 11:53:42 +02:00
|
|
|
class DashboardController extends ActionController
|
|
|
|
{
|
2013-08-07 17:44:18 +02:00
|
|
|
/**
|
|
|
|
* Display the form for adding new components or add the new component if submitted
|
|
|
|
*/
|
2013-08-06 11:53:42 +02:00
|
|
|
public function addurlAction()
|
|
|
|
{
|
2014-04-29 11:30:34 +02:00
|
|
|
$this->getTabs()->add(
|
|
|
|
'addurl',
|
|
|
|
array(
|
|
|
|
'title' => 'Add Dashboard URL',
|
|
|
|
'url' => Url::fromRequest()
|
|
|
|
)
|
|
|
|
)->activate('addurl');
|
2013-08-06 11:53:42 +02:00
|
|
|
$form = new AddUrlForm();
|
2014-11-11 11:51:18 +01:00
|
|
|
$form->handleRequest();
|
2014-08-12 09:49:27 +02:00
|
|
|
$this->view->form = $form;
|
2013-08-06 11:53:42 +02:00
|
|
|
}
|
|
|
|
|
2013-08-07 17:44:18 +02:00
|
|
|
/**
|
|
|
|
* Display the dashboard with the pane set in the 'pane' request parameter
|
|
|
|
*
|
|
|
|
* If no pane is submitted or the submitted one doesn't exist, the default pane is
|
|
|
|
* displayed (normally the first one)
|
|
|
|
*/
|
2013-08-06 11:53:42 +02:00
|
|
|
public function indexAction()
|
|
|
|
{
|
2014-11-11 14:44:38 +01:00
|
|
|
$dashboard = new Dashboard();
|
|
|
|
$dashboard->setUser($this->getRequest()->getUser());
|
|
|
|
$dashboard->load();
|
2014-06-05 15:20:54 +02:00
|
|
|
|
2014-08-26 10:08:33 +02:00
|
|
|
if (! $dashboard->hasPanes()) {
|
2014-06-05 15:20:54 +02:00
|
|
|
$this->view->title = 'Dashboard';
|
|
|
|
} else {
|
2014-08-26 10:08:33 +02:00
|
|
|
if ($this->_getParam('pane')) {
|
|
|
|
$pane = $this->_getParam('pane');
|
|
|
|
$dashboard->activate($pane);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($dashboard === null) {
|
|
|
|
$this->view->title = 'Dashboard';
|
|
|
|
} else {
|
|
|
|
$this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard';
|
|
|
|
$this->view->tabs = $dashboard->getTabs();
|
2014-06-05 15:20:54 +02:00
|
|
|
|
|
|
|
/* Temporarily removed
|
|
|
|
$this->view->tabs->add(
|
|
|
|
'Add',
|
|
|
|
array(
|
|
|
|
'title' => '+',
|
|
|
|
'url' => Url::fromPath('dashboard/addurl')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
2014-08-26 10:08:33 +02:00
|
|
|
$this->view->dashboard = $dashboard;
|
|
|
|
}
|
2014-06-05 15:20:54 +02:00
|
|
|
}
|
2013-08-06 11:53:42 +02:00
|
|
|
}
|
|
|
|
}
|