2013-08-12 15:58:26 +02:00
|
|
|
<?php
|
|
|
|
// @codingStandardsIgnoreStart
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
/**
|
|
|
|
* Icinga 2 Web - Head for multiple monitoring frontends
|
|
|
|
* Copyright (C) 2013 Icinga Development Team
|
2013-08-16 14:56:23 +02:00
|
|
|
*
|
2013-08-12 15:58:26 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2013-08-16 14:56:23 +02:00
|
|
|
*
|
2013-08-12 15:58:26 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2013-08-16 14:56:23 +02:00
|
|
|
*
|
2013-08-12 15:58:26 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2013-08-16 14:56:23 +02:00
|
|
|
*
|
2013-08-12 15:58:26 +02:00
|
|
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
|
|
|
* @author Icinga Development Team <info@icinga.org>
|
|
|
|
*/
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
2013-08-16 14:56:23 +02:00
|
|
|
use \Icinga\Application\Benchmark;
|
|
|
|
use \Icinga\Authentication\Manager;
|
|
|
|
use \Icinga\Web\Controller\BaseConfigController;
|
|
|
|
use \Icinga\Web\Widget\Tab;
|
|
|
|
use \Icinga\Web\Url;
|
|
|
|
use \Icinga\Web\Hook\Configuration\ConfigurationTabBuilder;
|
|
|
|
use \Icinga\Application\Icinga;
|
2013-08-12 15:58:26 +02:00
|
|
|
|
|
|
|
/**
|
2013-08-14 12:42:32 +02:00
|
|
|
* Application wide controller for application preferences
|
2013-08-12 15:58:26 +02:00
|
|
|
*/
|
|
|
|
class ConfigController extends BaseConfigController
|
|
|
|
{
|
2013-08-14 12:42:32 +02:00
|
|
|
/**
|
|
|
|
* Create tabs for this configuration controller
|
|
|
|
*
|
2013-08-16 14:56:23 +02:00
|
|
|
* @return array
|
|
|
|
*
|
|
|
|
* @see BaseConfigController::createProvidedTabs()
|
2013-08-14 12:42:32 +02:00
|
|
|
*/
|
2013-08-12 15:58:26 +02:00
|
|
|
public static function createProvidedTabs()
|
|
|
|
{
|
|
|
|
return array(
|
2013-08-16 14:56:23 +02:00
|
|
|
'index' => new Tab(
|
2013-08-12 15:58:26 +02:00
|
|
|
array(
|
2013-08-16 14:56:23 +02:00
|
|
|
'name' => 'index',
|
|
|
|
'title' => 'Configuration',
|
|
|
|
'iconCls' => 'wrench',
|
|
|
|
'url' => Url::fromPath('/config')
|
2013-08-12 15:58:26 +02:00
|
|
|
)
|
|
|
|
),
|
2013-08-16 14:56:23 +02:00
|
|
|
'modules' => new Tab(
|
2013-08-12 15:58:26 +02:00
|
|
|
array(
|
2013-08-16 14:56:23 +02:00
|
|
|
'name' => 'modules',
|
|
|
|
'title' => 'Modules',
|
|
|
|
'iconCls' => 'puzzle-piece',
|
|
|
|
'url' => Url::fromPath('/config/moduleoverview')
|
2013-08-12 15:58:26 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-08-14 12:42:32 +02:00
|
|
|
* Index action, entry point for configuration
|
|
|
|
* @TODO: Implement configuration interface (#3777)
|
2013-08-12 15:58:26 +02:00
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-14 12:42:32 +02:00
|
|
|
/**
|
|
|
|
* Display the list of all modules
|
|
|
|
*/
|
2013-08-12 15:58:26 +02:00
|
|
|
public function moduleoverviewAction()
|
|
|
|
{
|
|
|
|
$this->view->modules = Icinga::app()->getModuleManager()->select()
|
|
|
|
->from('modules')
|
|
|
|
->order('name');
|
|
|
|
$this->render('module/overview');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-08-14 12:42:32 +02:00
|
|
|
* Enable a specific module provided by the 'name' param
|
2013-08-12 15:58:26 +02:00
|
|
|
*/
|
|
|
|
public function moduleenableAction()
|
|
|
|
{
|
|
|
|
$manager = Icinga::app()->getModuleManager();
|
|
|
|
$manager->enableModule($this->_getParam('name'));
|
|
|
|
$manager->loadModule($this->_getParam('name'));
|
|
|
|
$this->redirectNow('config/moduleoverview?_render=body');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-08-14 12:42:32 +02:00
|
|
|
* Disable a module specific module provided by the 'name' param
|
2013-08-12 15:58:26 +02:00
|
|
|
*/
|
|
|
|
public function moduledisableAction()
|
|
|
|
{
|
|
|
|
$manager = Icinga::app()->getModuleManager();
|
|
|
|
$manager->disableModule($this->_getParam('name'));
|
|
|
|
$this->redirectNow('config/moduleoverview?_render=body');
|
|
|
|
}
|
|
|
|
}
|
2013-08-16 14:56:23 +02:00
|
|
|
// @codingStandardsIgnoreEnd
|