mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-16 00:54:12 +03:00
Remove "setup_settings_tabs" function
This commit is contained in:
parent
b75f693454
commit
3346a0c90f
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Mibew\Controller\Settings;
|
||||
|
||||
use Mibew\Controller\AbstractController as BaseController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Provides a set of utility functions.
|
||||
*/
|
||||
abstract class AbstractController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Builds list of the settings tabs.
|
||||
*
|
||||
* @param Request $request Current request.
|
||||
* @return array Tabs list. The keys of the array are tabs titles and the
|
||||
* values are tabs URLs.
|
||||
*/
|
||||
protected function buildTabs(Request $request)
|
||||
{
|
||||
$tabs = array();
|
||||
$route = $request->attributes->get('_route');
|
||||
|
||||
$common = $route == 'settings_common' || $route == 'settings_common_save';
|
||||
$features = $route == 'settings_features' || $route == 'settings_features_save';
|
||||
$performance = $route == 'settings_performance' || $route == 'settings_performance_save';
|
||||
|
||||
|
||||
$tabs[getlocal('page_settings.tab.main')] = (!$common)
|
||||
? $this->generateUrl('settings_common')
|
||||
: '';
|
||||
|
||||
$tabs[getlocal('page_settings.tab.features')] = (!$features)
|
||||
? $this->generateUrl('settings_features')
|
||||
: '';
|
||||
|
||||
$tabs[getlocal('page_settings.tab.performance')] = (!$performance)
|
||||
? $this->generateUrl('settings_performance')
|
||||
: '';
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@
|
||||
|
||||
namespace Mibew\Controller\Settings;
|
||||
|
||||
use Mibew\Controller\AbstractController;
|
||||
use Mibew\Http\Exception\BadRequestException;
|
||||
use Mibew\Settings;
|
||||
use Mibew\Style\ChatStyle;
|
||||
@ -104,7 +103,7 @@ class CommonController extends AbstractController
|
||||
$page['menuid'] = 'settings';
|
||||
|
||||
$page = array_merge($page, prepare_menu($operator));
|
||||
$page['tabs'] = setup_settings_tabs(0);
|
||||
$page['tabs'] = $this->buildTabs($request);
|
||||
|
||||
return $this->render('settings_common', $page);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
namespace Mibew\Controller\Settings;
|
||||
|
||||
use Mibew\Controller\AbstractController;
|
||||
use Mibew\Settings;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
@ -58,7 +57,7 @@ class FeaturesController extends AbstractController
|
||||
$page['title'] = getlocal('settings.title');
|
||||
$page['menuid'] = 'settings';
|
||||
$page = array_merge($page, prepare_menu($operator));
|
||||
$page['tabs'] = setup_settings_tabs(1);
|
||||
$page['tabs'] = $this->buildTabs($request);
|
||||
|
||||
return $this->render('settings_features', $page);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
namespace Mibew\Controller\Settings;
|
||||
|
||||
use Mibew\Controller\AbstractController;
|
||||
use Mibew\Settings;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
@ -91,7 +90,7 @@ class PerformanceController extends AbstractController
|
||||
$page['menuid'] = "settings";
|
||||
|
||||
$page = array_merge($page, prepare_menu($operator));
|
||||
$page['tabs'] = setup_settings_tabs(2);
|
||||
$page['tabs'] = $this->buildTabs($request);
|
||||
|
||||
return $this->render('settings_performance', $page);
|
||||
}
|
||||
|
@ -107,6 +107,5 @@ require_once(MIBEW_FS_ROOT . '/libs/notify.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/operator.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/pagination.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/statistics.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/settings.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/track.php');
|
||||
require_once(MIBEW_FS_ROOT . '/libs/userinfo.php');
|
||||
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Import namespaces and classes of the core
|
||||
use Mibew\Settings;
|
||||
|
||||
/**
|
||||
* Builds list of the system settings tabs. The keys of the resulting array are
|
||||
* tabs titles and the values are tabs URLs.
|
||||
*
|
||||
* @param int $active Number of the active tab. The count starts from 0.
|
||||
* @return array Tabs list
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function setup_settings_tabs($active)
|
||||
{
|
||||
$tabs = array(
|
||||
getlocal("page_settings.tab.main") => ($active != 0
|
||||
? (MIBEW_WEB_ROOT . "/operator/settings")
|
||||
: ""),
|
||||
getlocal("page_settings.tab.features") => ($active != 1
|
||||
? (MIBEW_WEB_ROOT . "/operator/settings/features")
|
||||
: ""),
|
||||
getlocal("page_settings.tab.performance") => ($active != 2
|
||||
? (MIBEW_WEB_ROOT . "/operator/settings/performance")
|
||||
: ""),
|
||||
);
|
||||
|
||||
return $tabs;
|
||||
}
|
Loading…
Reference in New Issue
Block a user