2 /***************************************************************
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
26 * A general purpose configuration manager used in backend mode.
29 * @subpackage Configuration
32 class Tx_Extbase_Configuration_BackendConfigurationManager
extends Tx_Extbase_Configuration_AbstractConfigurationManager
{
37 protected $typoScriptSetupCache = NULL;
40 * Returns TypoScript Setup array from current Environment.
42 * @return array the raw TypoScript setup
44 public function getTypoScriptSetup() {
45 if ($this->typoScriptSetupCache
=== NULL) {
46 $template = t3lib_div
::makeInstance('t3lib_TStemplate');
47 // do not log time-performance information
48 $template->tt_track
= 0;
51 $sysPage = t3lib_div
::makeInstance('t3lib_pageSelect');
52 // get the rootline for the current page
53 $rootline = $sysPage->getRootLine($this->getCurrentPageId());
54 // This generates the constants/config + hierarchy info for the template.
55 $template->runThroughTemplates($rootline, 0);
56 $template->generateConfig();
57 $this->typoScriptSetupCache
= $template->setup
;
59 return $this->typoScriptSetupCache
;
63 * Returns the page uid of the current page.
64 * If no page is selected, we'll return the uid of the first root page.
66 * @return integer current page id. If no page is selected current root page id is returned
68 protected function getCurrentPageId() {
69 $pageId = (integer)t3lib_div
::_GP('id');
75 $rootTemplates = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid', 'sys_template', 'deleted=0 AND hidden=0 AND root=1', '', '', '1');
76 if (count($rootTemplates) > 0) {
77 return $rootTemplates[0]['pid'];
80 // get current site root
81 $rootPages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'pages', 'deleted=0 AND hidden=0 AND is_siteroot=1', '', '', '1');
82 if (count($rootPages) > 0) {
83 return $rootPages[0]['uid'];
87 return self
::DEFAULT_BACKEND_STORAGE_PID
;
91 * We do not want to override anything in the backend.
94 protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration) {
95 return $frameworkConfiguration;