2015-09-07 13:55:19 +02:00
|
|
|
<?php
|
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
|
|
|
|
|
|
|
namespace Icinga\Controllers;
|
|
|
|
|
2015-09-07 15:01:55 +02:00
|
|
|
use Icinga\Application\Config;
|
2015-09-07 13:55:19 +02:00
|
|
|
use Icinga\Web\Controller;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Navigation configuration
|
|
|
|
*/
|
|
|
|
class NavigationController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Show the current user a list of his/her navigation items
|
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2015-09-07 15:01:55 +02:00
|
|
|
$user = $this->Auth()->getUser();
|
|
|
|
$userConfig = $user->loadNavigationConfig();
|
|
|
|
$sharedConfig = Config::app('navigation');
|
|
|
|
|
|
|
|
$this->view->items = array_merge(
|
|
|
|
$sharedConfig->select()->where('owner', $user->getUsername())->fetchAll(),
|
|
|
|
iterator_to_array($userConfig)
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->getTabs()->add(
|
|
|
|
'navigation',
|
|
|
|
array(
|
|
|
|
'title' => $this->translate('List and configure your own navigation items'),
|
|
|
|
'label' => $this->translate('Navigation'),
|
|
|
|
'url' => 'navigation'
|
|
|
|
)
|
|
|
|
)->activate('navigation');
|
2015-09-07 13:55:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List all shared navigation items
|
|
|
|
*/
|
|
|
|
public function sharedAction()
|
|
|
|
{
|
|
|
|
$this->assertPermission('config/application/navigation');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a navigation item
|
|
|
|
*/
|
|
|
|
public function addAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Edit a navigation item
|
|
|
|
*/
|
|
|
|
public function editAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a navigation item
|
|
|
|
*/
|
|
|
|
public function removeAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|