"TYPO3 4.0.1: typo3_src-4.0.1/t3lib/class.t3lib_scbase.php Source File", "datetime" => "Sat Dec 2 19:22:18 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

class.t3lib_scbase.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00133 class t3lib_SCbase {
00134 
00139         var $MCONF = array();
00140 
00145         var $id;
00146 
00151         var $CMD;
00152 
00157         var $perms_clause;
00158 
00159 
00160 
00165         var $MOD_MENU = Array (
00166                         'function' => array()
00167                 );
00168 
00173         var $MOD_SETTINGS = array();
00174 
00179         var $modTSconfig;
00180 
00187         var $modMenu_type = '';
00188 
00195         var $modMenu_dontValidateList = '';
00196 
00203         var $modMenu_setDefaultList = '';
00204 
00210         var $extClassConf;
00211 
00217         var $include_once = array();
00218 
00222         var $content = '';
00223 
00227         var $doc;
00228 
00234         var $extObj;
00235 
00236 
00237 
00238 
00239 
00240 
00241 
00242 
00249         function init() {
00250                         // name might be set from outside
00251                 if (!$this->MCONF['name']) {
00252                         $this->MCONF = $GLOBALS['MCONF'];
00253                 }
00254                 $this->id = intval(t3lib_div::_GP('id'));
00255                 $this->CMD = t3lib_div::_GP('CMD');
00256                 $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
00257                 $this->menuConfig();
00258                 $this->handleExternalFunctionValue();
00259         }
00260 
00269         function menuConfig()   {
00270                         // page/be_user TSconfig settings and blinding of menu-items
00271                 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
00272                 $this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'],'function',$this->MOD_MENU['function']);
00273                 $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function');
00274 
00275                 #debug($this->MOD_MENU['function'],$this->MCONF['name']);
00276                 #debug($this->modTSconfig['properties']);
00277 
00278                         // CLEANSE 'function' SETTINGS
00279                 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
00280         }
00281 
00292         function mergeExternalItems($modName,$menuKey,$menuArr) {
00293                 $mergeArray = $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
00294                 if (is_array($mergeArray))      {
00295                         reset($mergeArray);
00296                         while(list($k,$v)=each($mergeArray))    {
00297                                 if ((string)$v['ws']==='' ||
00298                                         ($GLOBALS['BE_USER']->workspace===0 && t3lib_div::inList($v['ws'],'online')) ||
00299                                         ($GLOBALS['BE_USER']->workspace===-1 && t3lib_div::inList($v['ws'],'offline')) ||
00300                                         ($GLOBALS['BE_USER']->workspace>0 && t3lib_div::inList($v['ws'],'custom')))     {
00301                                                 $menuArr[$k]=$GLOBALS['LANG']->sL($v['title']);
00302                                 }
00303                         }
00304                 }
00305                 return $menuArr;
00306         }
00307 
00317         function handleExternalFunctionValue($MM_key='function', $MS_value=NULL)        {
00318                 $MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
00319                 $this->extClassConf = $this->getExternalItemConfig($this->MCONF['name'],$MM_key,$MS_value);
00320                 if (is_array($this->extClassConf) && $this->extClassConf['path'])       {
00321                         $this->include_once[]=$this->extClassConf['path'];
00322                 }
00323         }
00324 
00335         function getExternalItemConfig($modName,$menuKey,$value='')     {
00336                 return strcmp($value,'')?$GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey][$value]:$GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
00337         }
00338 
00349         function checkExtObj()  {
00350                 if (is_array($this->extClassConf) && $this->extClassConf['name'])       {
00351                         $this->extObj = t3lib_div::makeInstance($this->extClassConf['name']);
00352                         $this->extObj->init($this,$this->extClassConf);
00353                                 // Re-write:
00354                         $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00355                 }
00356         }
00357 
00363         function checkSubExtObj()       {
00364                 if (is_object($this->extObj))   $this->extObj->checkExtObj();
00365         }
00366 
00375         function extObjHeader() {
00376                 if (is_callable(array($this->extObj,'head')))   $this->extObj->head();
00377         }
00378 
00384         function extObjContent()        {
00385                 $this->extObj->pObj = &$this;
00386                 if (is_callable(array($this->extObj, 'main')))  $this->content.=$this->extObj->main();
00387         }
00388 }
00389 ?>