47050f004291d815c4de7218e1dc47495190b755
[Packages/TYPO3.CMS.git] / typo3 / sysext / compatibility6 / Classes / Controller / WebFunctionWizardsBaseController.php
1 <?php
2 namespace TYPO3\CMS\Compatibility6\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 /**
26 * @var string
27 */
28 public $function_key = 'wiz';
29
30 /**
31 * Initialize.
32 * Calls parent init function and then the handleExternalFunctionValue() function from the parent class
33 *
34 * @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)
35 * @param array $conf The configuration set for this module - from global array TBE_MODULES_EXT
36 * @return void
37 */
38 public function init(&$pObj, $conf) {
39 // OK, handles ordinary init. This includes setting up the menu array with ->modMenu
40 parent::init($pObj, $conf);
41 $this->handleExternalFunctionValue();
42 }
43
44 /**
45 * Modifies parent objects internal MOD_MENU array, adding items this module needs.
46 *
47 * @return array Items merged with the parent objects.
48 */
49 public function modMenu() {
50 $GLOBALS['LANG']->includeLLFile('EXT:func_wizards/locallang.xlf');
51 $modMenuAdd = array(
52 $this->function_key => array()
53 );
54 $modMenuAdd[$this->function_key] = $this->pObj->mergeExternalItems($this->pObj->MCONF['name'], $this->function_key, $modMenuAdd[$this->function_key]);
55 $modMenuAdd[$this->function_key] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems(
56 $this->pObj->modTSconfig['properties'],
57 $modMenuAdd[$this->function_key],
58 'menu.' . $this->function_key
59 );
60 return $modMenuAdd;
61 }
62
63 /**
64 * Creation of the main content. Calling extObjContent() to trigger content generation from the sub-sub modules
65 *
66 * @return string The content
67 */
68 public function main() {
69 $menu = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
70 $this->pObj->id,
71 'SET[wiz]',
72 $this->pObj->MOD_SETTINGS['wiz'],
73 $this->pObj->MOD_MENU['wiz']
74 );
75
76 $content = '';
77 if (!empty($menu)) {
78 $menu = $GLOBALS['LANG']->getLL('wiz_lWizards', TRUE) . ': ' . $menu;
79 $content = $this->pObj->doc->section('', '<span class="nobr">' . $menu . '</span>');
80 $content .= $this->pObj->doc->spacer(20);
81 }
82
83 $content .= $this->extObjContent();
84 return $content;
85 }
86
87 }