TYPO3 CMS  TYPO3_6-2
BaseScriptClass.php
Go to the documentation of this file.
1 <?php
3 
22 
81 
88  public $MCONF = array();
89 
96  public $id;
97 
104  public $CMD;
105 
113 
120  public $MOD_MENU = array(
121  'function' => array()
122  );
123 
130  public $MOD_SETTINGS = array();
131 
138  public $modTSconfig;
139 
147  public $modMenu_type = '';
148 
157 
166 
174 
182  public $include_once = array();
183 
189  public $content = '';
190 
194  public $doc;
195 
202  public $extObj;
203 
211  public function init() {
212  // Name might be set from outside
213  if (!$this->MCONF['name']) {
214  $this->MCONF = $GLOBALS['MCONF'];
215  }
216  $this->id = (int)GeneralUtility::_GP('id');
217  $this->CMD = GeneralUtility::_GP('CMD');
218  $this->perms_clause = $this->getBackendUser()->getPagePermsClause(1);
219  $this->menuConfig();
221  }
222 
232  public function menuConfig() {
233  // Page/be_user TSconfig settings and blinding of menu-items
234  $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']);
235  $this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'], 'function', $this->MOD_MENU['function']);
236  $this->MOD_MENU['function'] = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['function'], 'menu.function');
237  $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
238  }
239 
251  public function mergeExternalItems($modName, $menuKey, $menuArr) {
252  $mergeArray = $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
253  if (is_array($mergeArray)) {
254  foreach ($mergeArray as $k => $v) {
255  if (((string) $v['ws'] === '' || $GLOBALS['BE_USER']->workspace === 0 && GeneralUtility::inList($v['ws'], 'online')) || $GLOBALS['BE_USER']->workspace === -1 && GeneralUtility::inList($v['ws'], 'offline') || $GLOBALS['BE_USER']->workspace > 0 && GeneralUtility::inList($v['ws'], 'custom')) {
256  $menuArr[$k] = $this->getLanguageService()->sL($v['title']);
257  }
258  }
259  }
260  return $menuArr;
261  }
262 
274  public function handleExternalFunctionValue($MM_key = 'function', $MS_value = NULL) {
275  if ($MS_value === NULL) {
276  $MS_value = $this->MOD_SETTINGS[$MM_key];
277  }
278  $this->extClassConf = $this->getExternalItemConfig($this->MCONF['name'], $MM_key, $MS_value);
279  if (is_array($this->extClassConf) && $this->extClassConf['path']) {
280  $this->include_once[] = $this->extClassConf['path'];
281  }
282  }
283 
295  public function getExternalItemConfig($modName, $menuKey, $value = '') {
296  if (isset($GLOBALS['TBE_MODULES_EXT'][$modName])) {
297  return (string)$value !== '' ? $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey][$value] : $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
298  }
299  return NULL;
300  }
301 
313  public function checkExtObj() {
314  if (is_array($this->extClassConf) && $this->extClassConf['name']) {
315  $this->extObj = GeneralUtility::makeInstance($this->extClassConf['name']);
316  $this->extObj->init($this, $this->extClassConf);
317  // Re-write:
318  $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
319  }
320  }
321 
328  public function checkSubExtObj() {
329  if (is_object($this->extObj)) {
330  $this->extObj->checkExtObj();
331  }
332  }
333 
343  public function extObjHeader() {
344  if (is_callable(array($this->extObj, 'head'))) {
345  $this->extObj->head();
346  }
347  }
348 
355  public function extObjContent() {
356  if ($this->extObj === NULL) {
357  $flashMessage = GeneralUtility::makeInstance(
358  'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
359  $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_errors.xlf:no_modules_registered'),
360  $this->getLanguageService()->getLL('title'),
362  );
363  $this->content .= $flashMessage->render();
364  } else {
365  $this->extObj->pObj = $this;
366  if (is_callable(array($this->extObj, 'main'))) {
367  $this->content .= $this->extObj->main();
368  }
369  }
370  }
371 
376  protected function getLanguageService() {
377  return $GLOBALS['LANG'];
378  }
379 
384  protected function getBackendUser() {
385  return $GLOBALS['BE_USER'];
386  }
387 
388 }
getExternalItemConfig($modName, $menuKey, $value='')
mergeExternalItems($modName, $menuKey, $menuArr)
handleExternalFunctionValue($MM_key='function', $MS_value=NULL)
static getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
static unsetMenuItems($modTSconfig, $itemArray, $TSref)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]