2 namespace TYPO3\CMS\Backend\View;
54 if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
55 $GLOBALS[
'LANG']->includeLLFile(
'EXT:lang/locallang_misc.xlf');
58 $this->linkModules =
true;
61 $this->moduleLoader->observeWorkspaces =
true;
62 $this->moduleLoader->load(
$GLOBALS[
'TBE_MODULES']);
63 $this->loadedModules = $this->moduleLoader->modules;
76 throw new \InvalidArgumentException(
'parameter $backPath must be of type string', 1193315266);
88 $collapsedStates = array();
89 if (
$GLOBALS[
'BE_USER']->uc[
'moduleData'][
'moduleMenu']) {
90 $collapsedStates =
$GLOBALS[
'BE_USER']->uc[
'moduleData'][
'moduleMenu'];
92 return $collapsedStates;
104 $data = array(
'success' =>
true,
'root' => array());
107 $dummyLink = BackendUtility::getModuleUrl(
'dummy');
108 foreach ($rawModuleData as $moduleKey => $moduleData) {
109 $key = substr($moduleKey, 8);
110 $num = count($data[
'root']);
111 if ($moduleData[
'link'] != $dummyLink || $moduleData[
'link'] == $dummyLink && is_array($moduleData[
'subitems'])) {
112 $data[
'root'][$num][
'key'] = $key;
113 $data[
'root'][$num][
'menuState'] =
$GLOBALS[
'BE_USER']->uc[
'moduleData'][
'menuState'][$moduleKey];
114 $data[
'root'][$num][
'label'] = $moduleData[
'title'];
115 $data[
'root'][$num][
'subitems'] = is_array($moduleData[
'subitems']) ? count($moduleData[
'subitems']) : 0;
116 if ($moduleData[
'link'] && $this->linkModules) {
120 if (is_array($moduleData[
'subitems'])) {
121 foreach ($moduleData[
'subitems'] as $subKey => $subData) {
122 $data[
'root'][$num][
'sub'][] = array(
123 'name' => $subData[
'name'],
124 'description' => $subData[
'description'],
125 'label' => $subData[
'title'],
126 'icon' => $subData[
'icon'][
'filename'],
127 'navframe' => $subData[
'parentNavigationFrameScript'],
128 'link' => $subData[
'link'],
129 'originalLink' => $subData[
'originalLink'],
131 'navigationFrameScript' => $subData[
'navigationFrameScript'],
132 'navigationFrameScriptParam' => $subData[
'navigationFrameScriptParam'],
133 'navigationComponentId' => $subData[
'navigationComponentId']
140 $ajaxObj->setContent($data);
141 $ajaxObj->setContentFormat(
'jsonbody');
168 $GLOBALS[
'BE_USER']->uc[
'moduleData'][
'menuState'][$menuItem] = $state;
181 $hiddenModules =
$GLOBALS[
'BE_USER']->getTSConfig(
'options.hideModules');
182 if (!empty($hiddenModules[
'value'])) {
184 foreach ($hiddenMainModules as $hiddenMainModule) {
185 unset($this->loadedModules[$hiddenMainModule]);
190 if (!empty($hiddenModules[
'properties']) && is_array($hiddenModules[
'properties'])) {
191 foreach ($hiddenModules[
'properties'] as $mainModuleName => $subModules) {
193 foreach ($hiddenSubModules as $hiddenSubModule) {
194 unset($this->loadedModules[$mainModuleName][
'sub'][$hiddenSubModule]);
211 $dummyScript = BackendUtility::getModuleUrl(
'dummy');
212 foreach ($this->loadedModules as $moduleName => $moduleData) {
214 if (!is_array($moduleData[
'sub'])) {
215 $moduleLink = $moduleData[
'script'];
218 $moduleKey =
'modmenu_' . $moduleName;
220 $modules[$moduleKey] = array(
221 'name' => $moduleName,
222 'title' =>
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][$moduleName .
'_tab'],
224 'icon' => $moduleIcon,
225 'link' => $moduleLink,
226 'description' =>
$GLOBALS[
'LANG']->moduleLabels[
'labels'][$moduleKey .
'label']
228 if (!is_array($moduleData[
'sub']) && $moduleData[
'script'] != $dummyScript) {
230 $modules[$moduleKey][
'subitems'][$moduleKey] = array(
231 'name' => $moduleName,
232 'title' =>
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][$moduleName .
'_tab'],
235 'link' => $moduleLink,
236 'originalLink' => $moduleLink,
237 'description' =>
$GLOBALS[
'LANG']->moduleLabels[
'labels'][$moduleKey .
'label'],
238 'navigationFrameScript' => null,
239 'navigationFrameScriptParam' => null,
240 'navigationComponentId' => null
242 }
elseif (is_array($moduleData[
'sub'])) {
243 foreach ($moduleData[
'sub'] as $submoduleName => $submoduleData) {
244 if (isset($submoduleData[
'script'])) {
247 $submoduleLink = BackendUtility::getModuleUrl($submoduleData[
'name']);
249 $submoduleKey = $moduleName .
'_' . $submoduleName .
'_tab';
251 $submoduleDescription =
$GLOBALS[
'LANG']->moduleLabels[
'labels'][$submoduleKey .
'label'];
252 $originalLink = $submoduleLink;
253 $navigationFrameScript = $submoduleData[
'navFrameScript'];
254 $modules[$moduleKey][
'subitems'][$submoduleKey] = array(
255 'name' => $moduleName .
'_' . $submoduleName,
256 'title' =>
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][$submoduleKey],
258 'icon' => $submoduleIcon,
259 'link' => $submoduleLink,
260 'originalLink' => $originalLink,
261 'description' => $submoduleDescription,
262 'navigationFrameScript' => $navigationFrameScript,
263 'navigationFrameScriptParam' => $submoduleData[
'navFrameScriptParam'],
264 'navigationComponentId' => $submoduleData[
'navigationComponentId']
268 if ($moduleData[
'navFrameScript'] && $submoduleData[
'inheritNavigationComponentFromMainModule'] !==
false) {
269 $modules[$moduleKey][
'subitems'][$submoduleKey][
'parentNavigationFrameScript'] = $moduleData[
'navFrameScript'];
292 if (!empty(
$GLOBALS[
'LANG']->moduleLabels[
'tabs_images'][$moduleKey])) {
293 $imageReference =
$GLOBALS[
'LANG']->moduleLabels[
'tabs_images'][$moduleKey];
295 if (!empty($iconFileRelative)) {
296 $iconTitle =
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][$moduleKey];
298 $iconSizes = @getimagesize($iconFileAbsolute);
299 $icon[
'filename'] = $iconFileRelative;
300 $icon[
'size'] = $iconSizes[3];
301 $icon[
'title'] = htmlspecialchars($iconTitle);
302 $icon[
'html'] =
'<img src="' . $iconFileRelative .
'" ' . $iconSizes[3] .
' title="' . htmlspecialchars($iconTitle) .
'" alt="' . htmlspecialchars($iconTitle) .
'" />';
320 $iconFilename = $this->backPath . $iconFilename;
322 return $iconFilename;
335 $iconFilename =
'../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($iconFilename);
337 return $this->backPath . $iconFilename;
348 if (!strstr($link,
'?')) {
361 $buttonLabel =
$GLOBALS[
'BE_USER']->user[
'ses_backuserid'] ?
'LLL:EXT:lang/locallang_core.xlf:buttons.exit' :
'LLL:EXT:lang/locallang_core.xlf:buttons.logout';
363 <form action="' . htmlspecialchars(BackendUtility::getModuleUrl(
'logout')) .
'" target="_top">
364 <input class="btn btn-default" type="submit" id="logout-submit-button" value="' .
$GLOBALS[
'LANG']->sL($buttonLabel,
true) .
'" />
379 throw new \InvalidArgumentException(
'parameter $linkModules must be of type bool', 1193326558);