[TASK] Remove the "@todo define visibility"
[Packages/TYPO3.CMS.git] / typo3 / sysext / func_wizards / Classes / Controller / WebFunctionWizardsBaseController.php
1 <?php
2 namespace TYPO3\CMS\FuncWizards\Controller;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * The Wizard function in the Web>Info module
19 * Creates a framework for adding wizard sub-sub-modules under the Wizard function in Web>Info
20 *
21 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
22 */
23 class WebFunctionWizardsBaseController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
24
25 public $function_key = 'wiz';
26
27 /**
28 * Initialize.
29 * Calls parent init function and then the handleExternalFunctionValue() function from the parent class
30 *
31 * @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)
32 * @param array $conf The configuration set for this module - from global array TBE_MODULES_EXT
33 * @return void
34 */
35 public function init(&$pObj, $conf) {
36 // OK, handles ordinary init. This includes setting up the menu array with ->modMenu
37 parent::init($pObj, $conf);
38 // Making sure that any further external classes are added to the include_once array.
39 // Notice that inclusion happens twice in the main script because of this!!!
40 $this->handleExternalFunctionValue();
41 }
42
43 /**
44 * Modifies parent objects internal MOD_MENU array, adding items this module needs.
45 *
46 * @return array Items merged with the parent objects.
47 */
48 public function modMenu() {
49 $GLOBALS['LANG']->includeLLFile('EXT:func_wizards/locallang.xlf');
50 $modMenuAdd = array(
51 $this->function_key => array()
52 );
53 $modMenuAdd[$this->function_key] = $this->pObj->mergeExternalItems($this->pObj->MCONF['name'], $this->function_key, $modMenuAdd[$this->function_key]);
54 $modMenuAdd[$this->function_key] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems(
55 $this->pObj->modTSconfig['properties'],
56 $modMenuAdd[$this->function_key],
57 'menu.' . $this->function_key
58 );
59 return $modMenuAdd;
60 }
61
62 /**
63 * Creation of the main content. Calling extObjContent() to trigger content generation from the sub-sub modules
64 *
65 * @return string The content
66 */
67 public function main() {
68 $menu = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
69 $this->pObj->id,
70 'SET[wiz]',
71 $this->pObj->MOD_SETTINGS['wiz'],
72 $this->pObj->MOD_MENU['wiz']
73 );
74
75 $content = '';
76 if (!empty($menu)) {
77 $menu = $GLOBALS['LANG']->getLL('wiz_lWizards', TRUE) . ': ' . $menu;
78 $content = $this->pObj->doc->section('', '<span class="nobr">' . $menu . '</span>');
79 $content .= $this->pObj->doc->spacer(20);
80 }
81
82 $content .= $this->extObjContent();
83 return $content;
84 }
85
86 }