c69354f1691ec26e949d6c17044ef6324a574942
[Packages/TYPO3.CMS.git] / typo3 / sysext / func_wizards / Classes / Controller / WebFunctionWizardsBaseController.php
1 <?php
2 namespace TYPO3\CMS\FuncWizards\Controller;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 /**
31 * The Wizard function in the Web>Info module
32 * Creates a framework for adding wizard sub-sub-modules under the Wizard function in Web>Info
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36 class WebFunctionWizardsBaseController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
37
38 /**
39 * @todo Define visibility
40 */
41 public $function_key = 'wiz';
42
43 /**
44 * Initialize.
45 * Calls parent init function and then the handleExternalFunctionValue() function from the parent class
46 *
47 * @param object $pObj A reference to the parent (calling) object (which is probably an instance of an extension class to \TYPO3\CMS\Backend\Module\BaseScriptClass)
48 * @param array $conf The configuration set for this module - from global array TBE_MODULES_EXT
49 * @return void
50 * @todo Define visibility
51 */
52 public function init(&$pObj, $conf) {
53 // OK, handles ordinary init. This includes setting up the menu array with ->modMenu
54 parent::init($pObj, $conf);
55 // Making sure that any further external classes are added to the include_once array.
56 // Notice that inclusion happens twice in the main script because of this!!!
57 $this->handleExternalFunctionValue();
58 }
59
60 /**
61 * Modifies parent objects internal MOD_MENU array, adding items this module needs.
62 *
63 * @return array Items merged with the parent objects.
64 * @todo Define visibility
65 */
66 public function modMenu() {
67 $GLOBALS['LANG']->includeLLFile('EXT:func_wizards/locallang.xlf');
68 $modMenuAdd = array(
69 $this->function_key => array()
70 );
71 $modMenuAdd[$this->function_key] = $this->pObj->mergeExternalItems($this->pObj->MCONF['name'], $this->function_key, $modMenuAdd[$this->function_key]);
72 $modMenuAdd[$this->function_key] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems(
73 $this->pObj->modTSconfig['properties'],
74 $modMenuAdd[$this->function_key],
75 'menu.' . $this->function_key
76 );
77 return $modMenuAdd;
78 }
79
80 /**
81 * Creation of the main content. Calling extObjContent() to trigger content generation from the sub-sub modules
82 *
83 * @return string The content
84 * @todo Define visibility
85 */
86 public function main() {
87 global $SOBE, $LANG;
88 $menu = $LANG->getLL('wiz_lWizards', TRUE) . ': ' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
89 $this->pObj->id,
90 'SET[wiz]',
91 $this->pObj->MOD_SETTINGS['wiz'],
92 $this->pObj->MOD_MENU['wiz']
93 );
94 $theOutput .= $this->pObj->doc->section('', '<span class="nobr">' . $menu . '</span>');
95 $content = '';
96 $content .= $theOutput;
97 $content .= $this->pObj->doc->spacer(20);
98 $content .= $this->extObjContent();
99 return $content;
100 }
101
102 }