Public Member Functions | |
start (&$tmpl, &$sys_page, $id, $conf, $menuNumber) | |
The initialization of the object. | |
makeMenu () | |
Creates the menu in the internal variables, ready for output. | |
includeMakeMenu ($conf, $altSortField) | |
Includes the PHP script defined for the HMENU special type "userdefined". | |
filterMenuPages (&$data, $banUidArray, $spacer) | |
Checks if a page is OK to include in the final menu item array. | |
procesItemStates ($splitCount) | |
Generating the per-menu-item configuration arrays based on the settings for item states (NO, RO, ACT, CUR etc) set in ->mconf (config for the current menu object) Basically it will produce an individual array for each menu item based on the item states. | |
link ($key, $altTarget='', $typeOverride='') | |
Creates the URL, target and onclick values for the menu item link. | |
subMenu ($uid) | |
Creates a submenu level to the current level - if configured for. | |
isNext ($uid, $MPvar='') | |
Returns true if the page with UID $uid is the NEXT page in root line (which means a submenu should be drawn). | |
isActive ($uid, $MPvar='') | |
Returns true if the page with UID $uid is active (in the current rootline). | |
isCurrent ($uid, $MPvar='') | |
Returns true if the page with UID $uid is the CURRENT page (equals $GLOBALS['TSFE']->id). | |
isSubMenu ($uid) | |
Returns true if there is a submenu with items for the page id, $uid Used by the item states "IFSUB" and "ACTIFSUB" to check if there is a submenu. | |
isItemState ($kind, $key) | |
Used by procesItemStates() to evaluate if a menu item (identified by $key) is in a certain state. | |
accessKey ($title) | |
Creates an access-key for a GMENU menu item based on the menu item titles first letter. | |
userProcess ($mConfKey, $passVar) | |
Calls a user function for processing of internal data. | |
setATagParts () | |
Creates the tag parts for the current item (in $this->I, [A1] and [A2]) based on other information in this array (like $this->I['linkHREF']). | |
getPageTitle ($title, $nav_title) | |
Returns the title for the navigation. | |
getMPvar ($key) | |
Return MPvar string for entry $key in ->menuArr. | |
getDoktypeExcludeWhere () | |
Returns where clause part to exclude 'not in menu' pages. | |
Public Attributes | |
$menuNumber = 1 | |
$entryLevel = 0 | |
$subLevelClass = '' | |
$spacerIDList = '199' | |
$doktypeExcludeList = '56' | |
$alwaysActivePIDlist = array() | |
$imgNamePrefix = 'img' | |
$imgNameNotRandom = 0 | |
$debug = 0 | |
$parent_cObj = '' | |
$GMENU_fixKey = 'gmenu' | |
$MP_array = array() | |
$conf = Array() | |
$mconf = Array() | |
$tmpl | |
$sys_page | |
$id | |
$nextActive | |
$menuArr | |
$hash | |
$result = Array() | |
$rL_uidRegister = '' | |
$INPfixMD5 | |
$I | |
$WMresult | |
$WMfreezePrefix | |
$WMmenuItems | |
$WMextraScript | |
$alternativeMenuTempArray = '' |
|
Creates an access-key for a GMENU menu item based on the menu item titles first letter.
Definition at line 1303 of file class.tslib_menu.php. References $a, $key, $result, and accessKey(). Referenced by accessKey(), and setATagParts(). 01303 { 01304 // The global array ACCESSKEY is used to globally control if letters are already used!! 01305 $result = Array(); 01306 01307 $titleLen = strlen($title); 01308 for ($a=0;$a<$titleLen;$a++) { 01309 $key = strtoupper(trim(substr($title,$a,1))); 01310 if ($key && !isset($GLOBALS['TSFE']->accessKey[$key])) { 01311 $GLOBALS['TSFE']->accessKey[$key]=1; 01312 $result['code'] = ' accesskey="'.$key.'"'; 01313 $result['alt'] = ' (ALT+'.$key.')'; 01314 break; 01315 } 01316 } 01317 return $result; 01318 }
|
|
Checks if a page is OK to include in the final menu item array. Pages can be excluded if the doktype is wrong, if they are hidden in navigation, have a uid in the list of banned uids etc.
Definition at line 838 of file class.tslib_menu.php. Referenced by makeMenu(). 00838 { 00839 00840 if ($data['_SAFE']) return TRUE; 00841 00842 $uid = $data['uid']; 00843 if ($this->mconf['SPC'] || !$spacer) { // If the spacer-function is not enabled, spacers will not enter the $menuArr 00844 if (!t3lib_div::inList($this->doktypeExcludeList,$data['doktype'])) { // Page may not be 'not_in_menu' or 'Backend User Section' 00845 if (!$data['nav_hide']) { // Not hidden in navigation 00846 if (!t3lib_div::inArray($banUidArray,$uid)) { // not in banned uid's 00847 00848 // Checks if the default language version can be shown: 00849 // Block page is set, if l18n_cfg allows plus: 1) Either default language or 2) another language but NO overlay record set for page! 00850 $blockPage = $data['l18n_cfg']&1 && (!$GLOBALS['TSFE']->sys_language_uid || ($GLOBALS['TSFE']->sys_language_uid && !$data['_PAGES_OVERLAY'])); 00851 if (!$blockPage) { 00852 00853 // Checking if a page should be shown in the menu depending on whether a translation exists: 00854 $tok = TRUE; 00855 if ($GLOBALS['TSFE']->sys_language_uid && $data['l18n_cfg']&2) { // There is an alternative language active AND the current page requires a translation: 00856 if (!$data['_PAGES_OVERLAY']) { 00857 $tok = FALSE; 00858 } 00859 } 00860 00861 // Continue if token is true: 00862 if ($tok) { 00863 00864 // Checking if "&L" should be modified so links to non-accessible pages will not happen. 00865 if ($this->conf['protectLvar']) { 00866 $Lvar = intval(t3lib_div::_GP('L')); 00867 if (($this->conf['protectLvar']=='all' || $data['l18n_cfg']&2) && $Lvar!=$GLOBALS['TSFE']->sys_language_uid) { // page cannot be access in locaization and Lvar is different than sys_language uid - this means we must check! 00868 $olRec = $GLOBALS['TSFE']->sys_page->getPageOverlay($data['uid'], $Lvar); 00869 if (!count($olRec)) { 00870 // If no pages_language_overlay record then page can NOT be accessed in the language pointed to by "&L" and therefore we protect the link by setting "&L=0" 00871 $data['_ADD_GETVARS'].= '&L=0'; 00872 } 00873 } 00874 } 00875 00876 return TRUE; 00877 } 00878 } 00879 } 00880 } 00881 } 00882 } 00883 }
|
|
Returns where clause part to exclude 'not in menu' pages.
Definition at line 1384 of file class.tslib_menu.php. 01384 { 01385 return $this->doktypeExcludeList ? ' AND pages.doktype NOT IN ('.$this->doktypeExcludeList.')' : ''; 01386 }
|
|
Return MPvar string for entry $key in ->menuArr.
Definition at line 1369 of file class.tslib_menu.php. Referenced by link(). 01369 { 01370 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids']) { 01371 $localMP_array = $this->MP_array; 01372 if ($this->menuArr[$key]['_MP_PARAM']) $localMP_array[] = $this->menuArr[$key]['_MP_PARAM']; // NOTICE: "_MP_PARAM" is allowed to be a commalist of PID pairs! 01373 $MP_params = count($localMP_array) ? implode(',',$localMP_array) : ''; 01374 return $MP_params; 01375 } 01376 }
|
|
Returns the title for the navigation.
Definition at line 1357 of file class.tslib_menu.php. 01357 {
01358 return strcmp(trim($nav_title),'') ? $nav_title : $title;
01359 }
|
|
Includes the PHP script defined for the HMENU special type "userdefined". This script is supposed to populate the array $menuItemsArray with a set of page records comprising the menu. The "userdefined" type is depreciated since "userfunction" has arrived since and is a better choice for many reasons (like using classes/functions for rendering the menu)
Definition at line 822 of file class.tslib_menu.php. Referenced by makeMenu(). 00822 { 00823 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']); 00824 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) { 00825 include($incFile); 00826 } 00827 return is_array($menuItemsArray) ? $menuItemsArray : array(); 00828 }
|
|
Returns true if the page with UID $uid is active (in the current rootline).
Definition at line 1205 of file class.tslib_menu.php. Referenced by tslib_tmenu_layers::extProc_beforeLinking(), tslib_gmenu_layers::extProc_beforeLinking(), tslib_gmenu_foldout::extProc_beforeLinking(), isItemState(), and link(). 01205 { 01206 01207 // Check for always active PIDs: 01208 if (count($this->alwaysActivePIDlist) && in_array($uid,$this->alwaysActivePIDlist)) { 01209 return TRUE; 01210 } 01211 01212 $testUid = $uid.($MPvar?':'.$MPvar:''); 01213 if ($uid && in_array('ITEM:'.$testUid, $this->rL_uidRegister)) { 01214 return TRUE; 01215 } 01216 }
|
|
Returns true if the page with UID $uid is the CURRENT page (equals $GLOBALS['TSFE']->id).
Definition at line 1226 of file class.tslib_menu.php. Referenced by isItemState(). 01226 { 01227 $testUid = $uid.($MPvar?':'.$MPvar:''); 01228 if ($uid && !strcmp(end($this->rL_uidRegister),'ITEM:'.$testUid)) { 01229 return TRUE; 01230 } 01231 }
|
|
Used by procesItemStates() to evaluate if a menu item (identified by $key) is in a certain state.
Definition at line 1266 of file class.tslib_menu.php. References isActive(), isCurrent(), and isSubMenu(). Referenced by procesItemStates(). 01266 { 01267 $natVal=0; 01268 if ($this->menuArr[$key]['ITEM_STATE']) { // If any value is set for ITEM_STATE the normal evaluation is discarded 01269 if (!strcmp($this->menuArr[$key]['ITEM_STATE'],$kind)) {$natVal=1;} 01270 } else { 01271 switch($kind) { 01272 case 'SPC': 01273 $natVal = $this->menuArr[$key]['isSpacer']; 01274 break; 01275 case 'IFSUB': 01276 $natVal = $this->isSubMenu($this->menuArr[$key]['uid']); 01277 break; 01278 case 'ACT': 01279 $natVal = $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key)); 01280 break; 01281 case 'ACTIFSUB': 01282 $natVal = $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key)) && $this->isSubMenu($this->menuArr[$key]['uid']); 01283 break; 01284 case 'CUR': 01285 $natVal = $this->isCurrent($this->menuArr[$key]['uid'], $this->getMPvar($key)); 01286 break; 01287 case 'USR': 01288 $natVal = $this->menuArr[$key]['fe_group']; 01289 break; 01290 } 01291 } 01292 01293 return $natVal; 01294 }
|
|
Returns true if the page with UID $uid is the NEXT page in root line (which means a submenu should be drawn).
Definition at line 1184 of file class.tslib_menu.php. Referenced by subMenu(). 01184 { 01185 01186 // Check for always active PIDs: 01187 if (count($this->alwaysActivePIDlist) && in_array($uid,$this->alwaysActivePIDlist)) { 01188 return TRUE; 01189 } 01190 01191 $testUid = $uid.($MPvar?':'.$MPvar:''); 01192 if ($uid && $testUid==$this->nextActive) { 01193 return TRUE; 01194 } 01195 }
|
|
Returns true if there is a submenu with items for the page id, $uid Used by the item states "IFSUB" and "ACTIFSUB" to check if there is a submenu.
Definition at line 1241 of file class.tslib_menu.php. Referenced by isItemState(). 01241 { 01242 01243 // Looking for a mount-pid for this UID since if that exists we should look for a subpages THERE and not in the input $uid; 01244 $mount_info = $this->sys_page->getMountPointInfo($uid); 01245 if (is_array($mount_info)) { 01246 $uid = $mount_info['mount_pid']; 01247 } 01248 01249 $recs = $this->sys_page->getMenu($uid,'uid,pid,doktype,mount_pid,mount_pid_ol'); 01250 foreach($recs as $theRec) { 01251 if (!t3lib_div::inList($this->doktypeExcludeList,$theRec['doktype']) && !$theRec['nav_hide']) { // If a menu item seems to be another type than 'Not in menu', then return true (there were items!) 01252 return TRUE; 01253 } 01254 } 01255 }
|
|
Creates the URL, target and onclick values for the menu item link. Returns them in an array as key/value pairs for -tag attributes This function doesn't care about the url, because if we let the url be redirected, it will be logged in the stat!!!
Definition at line 1082 of file class.tslib_menu.php. References $conf, $LD, getMPvar(), and isActive(). Referenced by tslib_tmenu::writeMenu(). 01082 { 01083 01084 // Mount points: 01085 $MP_var = $this->getMPvar($key); 01086 $MP_params = $MP_var ? '&MP='.rawurlencode($MP_var) : ''; 01087 01088 // Setting override ID 01089 if ($this->mconf['overrideId'] || $this->menuArr[$key]['overrideId']) { 01090 $overrideArray = array(); 01091 // If a user script returned the value overrideId in the menu array we use that as page id 01092 $overrideArray['uid'] = $this->mconf['overrideId']?$this->mconf['overrideId']:$this->menuArr[$key]['overrideId']; 01093 $overrideArray['alias'] = ''; 01094 $MP_params = ''; // clear MP parameters since ID was changed. 01095 } else { 01096 $overrideArray=''; 01097 } 01098 01099 // Setting main target: 01100 $mainTarget = $altTarget ? $altTarget : $this->mconf['target']; 01101 01102 // Creating link: 01103 if ($this->mconf['collapse'] && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key))) { 01104 $thePage = $this->sys_page->getPage($this->menuArr[$key]['pid']); 01105 $LD = $this->tmpl->linkData($thePage,$mainTarget,'','',$overrideArray, $this->mconf['addParams'].$MP_params.$this->menuArr[$key]['_ADD_GETVARS'], $typeOverride); 01106 } else { 01107 $LD = $this->tmpl->linkData($this->menuArr[$key],$mainTarget,'','',$overrideArray, $this->mconf['addParams'].$MP_params.$this->menuArr[$key]['_ADD_GETVARS'], $typeOverride); 01108 } 01109 01110 // Overriding URL / Target if set to do so: 01111 if ($this->menuArr[$key]['_OVERRIDE_HREF']) { 01112 $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF']; 01113 if ($this->menuArr[$key]['_OVERRIDE_TARGET']) $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET']; 01114 } 01115 01116 // OnClick open in windows. 01117 $onClick=''; 01118 if ($this->mconf['JSWindow']) { 01119 $conf=$this->mconf['JSWindow.']; 01120 $url=$LD['totalURL']; 01121 $LD['totalURL'] = '#'; 01122 $onClick= 'openPic(\''.$GLOBALS['TSFE']->baseUrlWrap($url).'\',\''.($conf['newWindow']?md5($url):'theNewPage').'\',\''.$conf['params'].'\'); return false;'; 01123 $GLOBALS['TSFE']->setJS('openPic'); 01124 } 01125 01126 // out: 01127 $list = array(); 01128 $list['HREF'] = strlen($LD['totalURL']) ? $LD['totalURL'] : $GLOBALS['TSFE']->baseUrl; // Added this check: What it does is to enter the baseUrl (if set, which it should for "realurl" based sites) as URL if the calculated value is empty. The problem is that no link is generated with a blank URL and blank URLs might appear when the realurl encoding is used and a link to the frontpage is generated. 01129 $list['TARGET'] = $LD['target']; 01130 $list['onClick'] = $onClick; 01131 01132 return $list; 01133 }
|
|
Creates the menu in the internal variables, ready for output. Basically this will read the page records needed and fill in the internal $this->menuArr Based on a hash of this array and some other variables the $this->result variable will be loaded either from cache OR by calling the generate() method of the class to create the menu for real.
Definition at line 313 of file class.tslib_menu.php. References $id, $nextActive, $val, filterMenuPages(), getKey(), header(), includeMakeMenu(), spacer(), and userProcess(). 00313 { 00314 if ($this->id) { 00315 $temp = array(); 00316 $altSortFieldValue = trim($this->mconf['alternativeSortingField']); 00317 $altSortField = $altSortFieldValue ? $altSortFieldValue : 'sorting'; 00318 if ($this->menuNumber==1 && $this->conf['special']) { // ... only for the FIRST level of a HMENU 00319 $value = $this->conf['special.']['value']; 00320 00321 switch($this->conf['special']) { 00322 case 'userdefined': 00323 $temp = $this->includeMakeMenu($this->conf['special.'],$altSortField); 00324 break; 00325 case 'userfunction': 00326 $temp = $this->parent_cObj->callUserFunction( 00327 $this->conf['special.']['userFunc'], 00328 array_merge($this->conf['special.'],array('_altSortField'=>$altSortField)), 00329 '' 00330 ); 00331 if (!is_array($temp)) $temp=array(); 00332 break; 00333 case 'language': 00334 $temp = array(); 00335 00336 // Getting current page record NOT overlaid by any translation: 00337 $currentPageWithNoOverlay = $this->sys_page->getRawRecord('pages',$GLOBALS['TSFE']->page['uid']); 00338 00339 // Traverse languages set up: 00340 $languageItems = t3lib_div::intExplode(',',$value); 00341 foreach($languageItems as $sUid) { 00342 // Find overlay record: 00343 if ($sUid) { 00344 $lRecs = $this->sys_page->getPageOverlay($GLOBALS['TSFE']->page['uid'],$sUid); 00345 } else $lRecs=array(); 00346 // Checking if the "disabled" state should be set. 00347 if ( 00348 ($GLOBALS['TSFE']->page['l18n_cfg']&2 && $sUid && !count($lRecs)) // Blocking for all translations? 00349 || ($GLOBALS['TSFE']->page['l18n_cfg']&1 && (!$sUid || !count($lRecs))) // Blocking default translation? 00350 || (!$this->conf['special.']['normalWhenNoLanguage'] && $sUid && !count($lRecs)) 00351 ) { 00352 $iState = $GLOBALS['TSFE']->sys_language_uid==$sUid ? 'USERDEF2' : 'USERDEF1'; 00353 } else { 00354 $iState = $GLOBALS['TSFE']->sys_language_uid==$sUid ? 'ACT' : 'NO'; 00355 } 00356 // Adding menu item: 00357 $temp[] = array_merge( 00358 array_merge($currentPageWithNoOverlay, $lRecs), 00359 array( 00360 'ITEM_STATE' => $iState, 00361 '_ADD_GETVARS' => '&L='.$sUid, 00362 '_SAFE' => TRUE 00363 ) 00364 ); 00365 } 00366 break; 00367 case 'directory': 00368 if ($value=='') { 00369 $value=$GLOBALS['TSFE']->page['uid']; 00370 } 00371 $items=t3lib_div::intExplode(',',$value); 00372 00373 foreach($items as $id) { 00374 $MP = $this->tmpl->getFromMPmap($id); 00375 00376 // Checking if a page is a mount page and if so, change the ID and set the MP var properly. 00377 $mount_info = $this->sys_page->getMountPointInfo($id); 00378 if (is_array($mount_info)) { 00379 if ($mount_info['overlay']) { // Overlays should already have their full MPvars calculated: 00380 $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']); 00381 $MP = $MP ? $MP : $mount_info['MPvar']; 00382 } else { 00383 $MP = ($MP ? $MP.',' : '').$mount_info['MPvar']; 00384 } 00385 $id = $mount_info['mount_pid']; 00386 } 00387 00388 // Get sub-pages: 00389 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>$id,'orderBy'=>$altSortField)); 00390 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00391 00392 // Keep mount point? 00393 $mount_info = $this->sys_page->getMountPointInfo($row['uid'], $row); 00394 if (is_array($mount_info) && $mount_info['overlay']) { // There is a valid mount point. 00395 $mp_row = $this->sys_page->getPage($mount_info['mount_pid']); // Using "getPage" is OK since we need the check for enableFields AND for type 2 of mount pids we DO require a doktype < 200! 00396 if (count($mp_row)) { 00397 $row = $mp_row; 00398 $row['_MP_PARAM'] = $mount_info['MPvar']; 00399 } else unset($row); // If the mount point could not be fetched with respect to enableFields, unset the row so it does not become a part of the menu! 00400 } 00401 00402 // Add external MP params, then the row: 00403 if (is_array($row)) { 00404 if ($MP) $row['_MP_PARAM'] = $MP.($row['_MP_PARAM'] ? ','.$row['_MP_PARAM'] : ''); 00405 $temp[$row['uid']] = $this->sys_page->getPageOverlay($row); 00406 } 00407 } 00408 } 00409 break; 00410 case 'list': 00411 if ($value=='') { 00412 $value=$this->id; 00413 } 00414 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup'); 00415 $loadDB->start($value, 'pages'); 00416 $loadDB->additionalWhere['pages']=tslib_cObj::enableFields('pages'); 00417 $loadDB->getFromDB(); 00418 00419 foreach($loadDB->itemArray as $val) { 00420 $MP = $this->tmpl->getFromMPmap($val['id']); 00421 00422 // Keep mount point? 00423 $mount_info = $this->sys_page->getMountPointInfo($val['id']); 00424 if (is_array($mount_info) && $mount_info['overlay']) { // There is a valid mount point. 00425 $mp_row = $this->sys_page->getPage($mount_info['mount_pid']); // Using "getPage" is OK since we need the check for enableFields AND for type 2 of mount pids we DO require a doktype < 200! 00426 if (count($mp_row)) { 00427 $row = $mp_row; 00428 $row['_MP_PARAM'] = $mount_info['MPvar']; 00429 00430 if ($mount_info['overlay']) { // Overlays should already have their full MPvars calculated: 00431 $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']); 00432 if ($MP) unset($row['_MP_PARAM']); 00433 } 00434 00435 } else unset($row); // If the mount point could not be fetched with respect to enableFields, unset the row so it does not become a part of the menu! 00436 } else { 00437 $row = $loadDB->results['pages'][$val['id']]; 00438 } 00439 00440 // Add external MP params, then the row: 00441 if (is_array($row)) { 00442 if ($MP) $row['_MP_PARAM'] = $MP.($row['_MP_PARAM'] ? ','.$row['_MP_PARAM'] : ''); 00443 $temp[] = $this->sys_page->getPageOverlay($row); 00444 } 00445 } 00446 break; 00447 case 'updated': 00448 if ($value=='') { 00449 $value=$GLOBALS['TSFE']->page['uid']; 00450 } 00451 $items=t3lib_div::intExplode(',',$value); 00452 if (t3lib_div::testInt($this->conf['special.']['depth'])) { 00453 $depth = t3lib_div::intInRange($this->conf['special.']['depth'],1,20); // Tree depth 00454 } else { 00455 $depth=20; 00456 } 00457 $limit = t3lib_div::intInRange($this->conf['special.']['limit'],0,100); // max number of items 00458 $maxAge = intval(tslib_cObj::calc($this->conf['special.']['maxAge'])); 00459 if (!$limit) $limit=10; 00460 $mode = $this->conf['special.']['mode']; // *'auto', 'manual', 'tstamp' 00461 // Get id's 00462 $id_list_arr = Array(); 00463 00464 foreach($items as $id) { 00465 $bA = t3lib_div::intInRange($this->conf['special.']['beginAtLevel'],0,100); 00466 $id_list_arr[] = tslib_cObj::getTreeList(-1*$id,$depth-1+$bA,$bA-1); 00467 } 00468 $id_list = implode(',',$id_list_arr); 00469 // Get sortField (mode) 00470 switch($mode) { 00471 case 'starttime': 00472 $sortField = 'starttime'; 00473 break; 00474 case 'lastUpdated': 00475 case 'manual': 00476 $sortField = 'lastUpdated'; 00477 break; 00478 case 'tstamp': 00479 $sortField = 'tstamp'; 00480 break; 00481 case 'crdate': 00482 $sortField = 'crdate'; 00483 break; 00484 default: 00485 $sortField = 'SYS_LASTCHANGED'; 00486 break; 00487 } 00488 // Get 00489 $extraWhere = ' AND pages.nav_hide=0'.$this->getDoktypeExcludeWhere(); 00490 00491 if ($this->conf['special.']['excludeNoSearchPages']) { 00492 $extraWhere.= ' AND pages.no_search=0'; 00493 } 00494 if ($maxAge>0) { 00495 $extraWhere.=' AND '.$sortField.'>'.($GLOBALS['SIM_EXEC_TIME']-$maxAge); 00496 } 00497 00498 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>'0', 'uidInList'=>$id_list, 'where'=>$sortField.'>=0'.$extraWhere, 'orderBy'=>($altSortFieldValue ? $altSortFieldValue : $sortField.' desc'),'max'=>$limit)); 00499 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00500 $temp[$row['uid']]=$this->sys_page->getPageOverlay($row); 00501 } 00502 break; 00503 case 'keywords': 00504 list($value)=t3lib_div::intExplode(',',$value); 00505 if (!$value) { 00506 $value=$GLOBALS['TSFE']->page['uid']; 00507 } 00508 if ($this->conf['special.']['setKeywords'] || $this->conf['special.']['setKeywords.']) { 00509 $kw = $this->parent_cObj->stdWrap($this->conf['special.']['setKeywords'], $this->conf['special.']['setKeywords.']); 00510 } else { 00511 $value_rec=$this->sys_page->getPage($value); // The page record of the 'value'. 00512 00513 $kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords'; 00514 $kw = trim(tslib_cObj::keywords($value_rec[$kfieldSrc])); // keywords. 00515 } 00516 00517 $mode = $this->conf['special.']['mode']; // *'auto', 'manual', 'tstamp' 00518 switch($mode) { 00519 case 'starttime': 00520 $sortField = 'starttime'; 00521 break; 00522 case 'lastUpdated': 00523 case 'manual': 00524 $sortField = 'lastUpdated'; 00525 break; 00526 case 'tstamp': 00527 $sortField = 'tstamp'; 00528 break; 00529 case 'crdate': 00530 $sortField = 'crdate'; 00531 break; 00532 default: 00533 $sortField = 'SYS_LASTCHANGED'; 00534 break; 00535 } 00536 00537 // depth, limit, extra where 00538 if (t3lib_div::testInt($this->conf['special.']['depth'])) { 00539 $depth = t3lib_div::intInRange($this->conf['special.']['depth'],0,20); // Tree depth 00540 } else { 00541 $depth=20; 00542 } 00543 $limit = t3lib_div::intInRange($this->conf['special.']['limit'],0,100); // max number of items 00544 $extraWhere = ' AND pages.uid!='.$value.' AND pages.nav_hide=0'.$this->getDoktypeExcludeWhere(); 00545 if ($this->conf['special.']['excludeNoSearchPages']) { 00546 $extraWhere.= ' AND pages.no_search=0'; 00547 } 00548 // start point 00549 $eLevel = tslib_cObj::getKey (intval($this->conf['special.']['entryLevel']),$this->tmpl->rootLine); 00550 $startUid = intval($this->tmpl->rootLine[$eLevel]['uid']); 00551 00552 // which field is for keywords 00553 $kfield = 'keywords'; 00554 if ( $this->conf['special.']['keywordsField'] ) { 00555 list($kfield) = explode(' ',trim ($this->conf['special.']['keywordsField'])); 00556 } 00557 00558 // If there are keywords and the startuid is present. 00559 if ($kw && $startUid) { 00560 $bA = t3lib_div::intInRange($this->conf['special.']['beginAtLevel'],0,100); 00561 $id_list=tslib_cObj::getTreeList(-1*$startUid,$depth-1+$bA,$bA-1); 00562 00563 $kwArr = explode(',',$kw); 00564 foreach($kwArr as $word) { 00565 $word = trim($word); 00566 if ($word) { 00567 $keyWordsWhereArr[] = $kfield.' LIKE "%'.$GLOBALS['TYPO3_DB']->quoteStr($word, 'pages').'%"'; 00568 } 00569 } 00570 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>'0', 'uidInList'=>$id_list, 'where'=>'('.implode(' OR ',$keyWordsWhereArr).')'.$extraWhere, 'orderBy'=>($altSortFieldValue ? $altSortFieldValue : $sortField.' desc'),'max'=>$limit)); 00571 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00572 $temp[$row['uid']]=$this->sys_page->getPageOverlay($row); 00573 } 00574 } 00575 break; 00576 case 'rootline': 00577 $begin_end = explode('|',$this->conf['special.']['range']); 00578 if (!t3lib_div::testInt($begin_end[0])) {intval($begin_end[0]);} 00579 if (!t3lib_div::testInt($begin_end[1])) {$begin_end[1]=-1;} 00580 00581 $beginKey = tslib_cObj::getKey ($begin_end[0],$this->tmpl->rootLine); 00582 $endKey = tslib_cObj::getKey ($begin_end[1],$this->tmpl->rootLine); 00583 if ($endKey<$beginKey) {$endKey=$beginKey;} 00584 00585 $rl_MParray = array(); 00586 foreach($this->tmpl->rootLine as $k_rl => $v_rl) { 00587 // For overlaid mount points, set the variable right now: 00588 if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) { 00589 $rl_MParray[] = $v_rl['_MP_PARAM']; 00590 } 00591 // Traverse rootline: 00592 if ($k_rl>=$beginKey && $k_rl<=$endKey) { 00593 $temp_key=$k_rl; 00594 $temp[$temp_key]=$this->sys_page->getPage($v_rl['uid']); 00595 if (count($temp[$temp_key])) { 00596 if (!$temp[$temp_key]['target']) { // If there are no specific target for the page, put the level specific target on. 00597 $temp[$temp_key]['target'] = $this->conf['special.']['targets.'][$k_rl]; 00598 $temp[$temp_key]['_MP_PARAM'] = implode(',',$rl_MParray); 00599 } 00600 } else unset($temp[$temp_key]); 00601 } 00602 // For normal mount points, set the variable for next level. 00603 if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) { 00604 $rl_MParray[] = $v_rl['_MP_PARAM']; 00605 } 00606 } 00607 break; 00608 case 'browse': 00609 list($value)=t3lib_div::intExplode(',',$value); 00610 if (!$value) { 00611 $value=$GLOBALS['TSFE']->page['uid']; 00612 } 00613 if ($value!=$this->tmpl->rootLine[0]['uid']) { // Will not work out of rootline 00614 $recArr=array(); 00615 $value_rec=$this->sys_page->getPage($value); // The page record of the 'value'. 00616 if ($value_rec['pid']) { // 'up' page cannot be outside rootline 00617 $recArr['up']=$this->sys_page->getPage($value_rec['pid']); // The page record of 'up'. 00618 } 00619 if ($recArr['up']['pid'] && $value_rec['pid']!=$this->tmpl->rootLine[0]['uid']) { // If the 'up' item was NOT level 0 in rootline... 00620 $recArr['index']=$this->sys_page->getPage($recArr['up']['pid']); // The page record of "index". 00621 } 00622 00623 // prev / next is found 00624 $prevnext_menu = $this->sys_page->getMenu($value_rec['pid'],'*',$altSortField); 00625 $lastKey=0; 00626 $nextActive=0; 00627 reset($prevnext_menu); 00628 while(list($k_b,$v_b)=each($prevnext_menu)) { 00629 if ($nextActive) { 00630 $recArr['next']=$v_b; 00631 $nextActive=0; 00632 } 00633 if ($v_b['uid']==$value) { 00634 if ($lastKey) { 00635 $recArr['prev']=$prevnext_menu[$lastKey]; 00636 } 00637 $nextActive=1; 00638 } 00639 $lastKey=$k_b; 00640 } 00641 reset($prevnext_menu); 00642 $recArr['first']=pos($prevnext_menu); 00643 end($prevnext_menu); 00644 $recArr['last']=pos($prevnext_menu); 00645 00646 // prevsection / nextsection is found 00647 if (is_array($recArr['index'])) { // You can only do this, if there is a valid page two levels up! 00648 $prevnextsection_menu = $this->sys_page->getMenu($recArr['index']['uid'],'*',$altSortField); 00649 $lastKey=0; 00650 $nextActive=0; 00651 reset($prevnextsection_menu); 00652 while(list($k_b,$v_b)=each($prevnextsection_menu)) { 00653 if ($nextActive) { 00654 $sectionRec_temp = $this->sys_page->getMenu($v_b['uid'],'*',$altSortField); 00655 if (count($sectionRec_temp)) { 00656 reset($sectionRec_temp); 00657 $recArr['nextsection']=pos($sectionRec_temp); 00658 end ($sectionRec_temp); 00659 $recArr['nextsection_last']=pos($sectionRec_temp); 00660 $nextActive=0; 00661 } 00662 } 00663 if ($v_b['uid']==$value_rec['pid']) { 00664 if ($lastKey) { 00665 $sectionRec_temp = $this->sys_page->getMenu($prevnextsection_menu[$lastKey]['uid'],'*',$altSortField); 00666 if (count($sectionRec_temp)) { 00667 reset($sectionRec_temp); 00668 $recArr['prevsection']=pos($sectionRec_temp); 00669 end ($sectionRec_temp); 00670 $recArr['prevsection_last']=pos($sectionRec_temp); 00671 } 00672 } 00673 $nextActive=1; 00674 } 00675 $lastKey=$k_b; 00676 } 00677 } 00678 if ($this->conf['special.']['items.']['prevnextToSection']) { 00679 if (!is_array($recArr['prev']) && is_array($recArr['prevsection_last'])) { 00680 $recArr['prev']=$recArr['prevsection_last']; 00681 } 00682 if (!is_array($recArr['next']) && is_array($recArr['nextsection'])) { 00683 $recArr['next']=$recArr['nextsection']; 00684 } 00685 } 00686 00687 $items = explode('|',$this->conf['special.']['items']); 00688 $c=0; 00689 while(list($k_b,$v_b)=each($items)) { 00690 $v_b=strtolower(trim($v_b)); 00691 if (intval($this->conf['special.'][$v_b.'.']['uid'])) { 00692 $recArr[$v_b] = $this->sys_page->getPage(intval($this->conf['special.'][$v_b.'.']['uid'])); // fetches the page in case of a hardcoded pid in template 00693 } 00694 if (is_array($recArr[$v_b])) { 00695 $temp[$c]=$recArr[$v_b]; 00696 if ($this->conf['special.'][$v_b.'.']['target']) { 00697 $temp[$c]['target']=$this->conf['special.'][$v_b.'.']['target']; 00698 } 00699 if (is_array($this->conf['special.'][$v_b.'.']['fields.'])) { 00700 reset($this->conf['special.'][$v_b.'.']['fields.']); 00701 while(list($fk,$val)=each($this->conf['special.'][$v_b.'.']['fields.'])) { 00702 $temp[$c][$fk]=$val; 00703 } 00704 } 00705 $c++; 00706 } 00707 } 00708 } 00709 break; 00710 } 00711 } elseif (is_array($this->alternativeMenuTempArray)) { // Setting $temp array if not level 1. 00712 $temp = $this->alternativeMenuTempArray; 00713 } elseif ($this->mconf['sectionIndex']) { 00714 if ($GLOBALS['TSFE']->sys_language_uid && count($this->sys_page->getPageOverlay($this->id))) { 00715 $sys_language_uid = intval($GLOBALS['TSFE']->sys_language_uid); 00716 } else $sys_language_uid=0; 00717 00718 $selectSetup = Array( 00719 'pidInList'=>$this->id, 00720 'orderBy'=>$altSortField, 00721 'where' => 'colPos=0 AND sys_language_uid='.$sys_language_uid, 00722 'andWhere' => 'sectionIndex!=0' 00723 ); 00724 switch($this->mconf['sectionIndex.']['type']) { 00725 case 'all': 00726 unset($selectSetup['andWhere']); 00727 break; 00728 case 'header': 00729 $selectSetup['andWhere']='header_layout!=100 AND header!=""'; 00730 break; 00731 } 00732 $basePageRow=$this->sys_page->getPage($this->id); 00733 if (is_array($basePageRow)) { 00734 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('tt_content', $selectSetup); 00735 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00736 $temp[$row['uid']]=$basePageRow; 00737 $temp[$row['uid']]['title']=$row['header']; 00738 $temp[$row['uid']]['subtitle']=$row['subheader']; 00739 $temp[$row['uid']]['starttime']=$row['starttime']; 00740 $temp[$row['uid']]['endtime']=$row['endtime']; 00741 $temp[$row['uid']]['fe_group']=$row['fe_group']; 00742 $temp[$row['uid']]['media']=$row['media']; 00743 00744 $temp[$row['uid']]['header_layout']=$row['header_layout']; 00745 $temp[$row['uid']]['bodytext']=$row['bodytext']; 00746 $temp[$row['uid']]['image']=$row['image']; 00747 00748 $temp[$row['uid']]['sectionIndex_uid']=$row['uid']; 00749 } 00750 } 00751 } else { // Default: 00752 $temp = $this->sys_page->getMenu($this->id,'*',$altSortField); // gets the menu 00753 } 00754 00755 $c=0; 00756 $c_b=0; 00757 $minItems = intval($this->mconf['minItems'] ? $this->mconf['minItems'] : $this->conf['minItems']); 00758 $maxItems = intval($this->mconf['maxItems'] ? $this->mconf['maxItems'] : $this->conf['maxItems']); 00759 $begin = tslib_cObj::calc($this->mconf['begin'] ? $this->mconf['begin'] : $this->conf['begin']); 00760 00761 $banUidArray=array(); 00762 if (trim($this->conf['excludeUidList'])) { 00763 $banUidArray = t3lib_div::intExplode(',', $this->conf['excludeUidList']); 00764 } 00765 00766 // Fill in the menuArr with elements that should go into the menu: 00767 $this->menuArr = Array(); 00768 foreach($temp as $data) { 00769 $spacer = (t3lib_div::inList($this->spacerIDList,$data['doktype']) || !strcmp($data['ITEM_STATE'],'SPC')) ? 1 : 0; // if item is a spacer, $spacer is set 00770 if ($this->filterMenuPages($data, $banUidArray, $spacer)) { 00771 $c_b++; 00772 if ($begin<=$c_b) { // If the beginning item has been reached. 00773 $this->menuArr[$c] = $data; 00774 $this->menuArr[$c]['isSpacer'] = $spacer; 00775 $c++; 00776 if ($maxItems && $c>=$maxItems) { 00777 break; 00778 } 00779 } 00780 } 00781 } 00782 00783 // Fill in fake items, if min-items is set. 00784 if ($minItems) { 00785 while($c<$minItems) { 00786 $this->menuArr[$c] = Array( 00787 'title' => '...', 00788 'uid' => $GLOBALS['TSFE']->id 00789 ); 00790 $c++; 00791 } 00792 } 00793 // Setting number of menu items 00794 $GLOBALS['TSFE']->register['count_menuItems'] = count($this->menuArr); 00795 // Passing the menuArr through a user defined function: 00796 if ($this->mconf['itemArrayProcFunc']) { 00797 if (!is_array($this->parentMenuArr)) {$this->parentMenuArr=array();} 00798 $this->menuArr = $this->userProcess('itemArrayProcFunc',$this->menuArr); 00799 } 00800 $this->hash = md5(serialize($this->menuArr).serialize($this->mconf).serialize($this->tmpl->rootLine).serialize($this->MP_array)); 00801 00802 $serData = $this->sys_page->getHash($this->hash, 60*60*24); 00803 if (!$serData) { 00804 $this->generate(); 00805 $this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA'); 00806 } else { 00807 $this->result=unserialize($serData); 00808 } 00809 } 00810 }
|
|
Generating the per-menu-item configuration arrays based on the settings for item states (NO, RO, ACT, CUR etc) set in ->mconf (config for the current menu object) Basically it will produce an individual array for each menu item based on the item states. BUT in addition the "optionSplit" syntax for the values is ALSO evaluated here so that all property-values are "option-splitted" and the output will thus be resolved. Is called from the "generate" functions in the extension classes. The function is processor intensive due to the option split feature in particular. But since the generate function is not always called (since the ->result array may be cached, see makeMenu) it doesn't hurt so badly.
Definition at line 894 of file class.tslib_menu.php. References isItemState(). Referenced by tslib_imgmenu::generate(), and tslib_tmenu::generate(). 00894 { 00895 00896 // Prepare normal settings 00897 if (!is_array($this->mconf['NO.']) && $this->mconf['NO']) $this->mconf['NO.']=array(); // Setting a blank array if NO=1 and there are no properties. 00898 $NOconf = $this->tmpl->splitConfArray($this->mconf['NO.'],$splitCount); 00899 00900 // Prepare rollOver settings, overriding normal settings 00901 $ROconf=array(); 00902 if ($this->mconf['RO']) { 00903 $ROconf = $this->tmpl->splitConfArray($this->mconf['RO.'],$splitCount); 00904 } 00905 00906 // Prepare IFSUB settings, overriding normal settings 00907 // IFSUB is true if there exist submenu items to the current item 00908 if ($this->mconf['IFSUB']) { 00909 $IFSUBinit = 0; // Flag: If $IFSUB is generated 00910 reset($NOconf); 00911 while (list($key,$val)=each($NOconf)) { 00912 if ($this->isItemState('IFSUB',$key)) { 00913 if (!$IFSUBinit) { // if this is the first IFSUB element, we must generate IFSUB. 00914 $IFSUBconf = $this->tmpl->splitConfArray($this->mconf['IFSUB.'],$splitCount); 00915 if ($this->mconf['IFSUBRO']) { 00916 $IFSUBROconf = $this->tmpl->splitConfArray($this->mconf['IFSUBRO.'],$splitCount); 00917 } 00918 $IFSUBinit = 1; 00919 } 00920 $NOconf[$key] = $IFSUBconf[$key]; // Substitute normal with ifsub 00921 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 00922 $ROconf[$key] = $IFSUBROconf[$key] ? $IFSUBROconf[$key] : $IFSUBconf[$key]; // If RollOver on active then apply this 00923 } 00924 } 00925 } 00926 } 00927 // Prepare active settings, overriding normal settings 00928 if ($this->mconf['ACT']) { 00929 $ACTinit = 0; // Flag: If $ACT is generated 00930 reset($NOconf); 00931 while (list($key,$val)=each($NOconf)) { // Find active 00932 if ($this->isItemState('ACT',$key)) { 00933 if (!$ACTinit) { // if this is the first active, we must generate ACT. 00934 $ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'],$splitCount); 00935 // Prepare active rollOver settings, overriding normal active settings 00936 if ($this->mconf['ACTRO']) { 00937 $ACTROconf = $this->tmpl->splitConfArray($this->mconf['ACTRO.'],$splitCount); 00938 } 00939 $ACTinit = 1; 00940 } 00941 $NOconf[$key] = $ACTconf[$key]; // Substitute normal with active 00942 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 00943 $ROconf[$key] = $ACTROconf[$key] ? $ACTROconf[$key] : $ACTconf[$key]; // If RollOver on active then apply this 00944 } 00945 } 00946 } 00947 } 00948 // Prepare active/IFSUB settings, overriding normal settings 00949 // ACTIFSUB is true if there exist submenu items to the current item and the current item is active 00950 if ($this->mconf['ACTIFSUB']) { 00951 $ACTIFSUBinit = 0; // Flag: If $ACTIFSUB is generated 00952 reset($NOconf); 00953 while (list($key,$val)=each($NOconf)) { // Find active 00954 if ($this->isItemState('ACTIFSUB',$key)) { 00955 if (!$ACTIFSUBinit) { // if this is the first active, we must generate ACTIFSUB. 00956 $ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'],$splitCount); 00957 // Prepare active rollOver settings, overriding normal active settings 00958 if ($this->mconf['ACTIFSUBRO']) { 00959 $ACTIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUBRO.'],$splitCount); 00960 } 00961 $ACTIFSUBinit = 1; 00962 } 00963 $NOconf[$key] = $ACTIFSUBconf[$key]; // Substitute normal with active 00964 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 00965 $ROconf[$key] = $ACTIFSUBROconf[$key] ? $ACTIFSUBROconf[$key] : $ACTIFSUBconf[$key]; // If RollOver on active then apply this 00966 } 00967 } 00968 } 00969 } 00970 // Prepare CUR (current) settings, overriding normal settings 00971 // CUR is true if the current page equals the item here! 00972 if ($this->mconf['CUR']) { 00973 $CURinit = 0; // Flag: If $CUR is generated 00974 reset($NOconf); 00975 while (list($key,$val)=each($NOconf)) { 00976 if ($this->isItemState('CUR',$key)) { 00977 if (!$CURinit) { // if this is the first 'current', we must generate CUR. Basically this control is just inherited from the other implementations as current would only exist one time and thats it (unless you use special-features of HMENU) 00978 $CURconf = $this->tmpl->splitConfArray($this->mconf['CUR.'],$splitCount); 00979 if ($this->mconf['CURRO']) { 00980 $CURROconf = $this->tmpl->splitConfArray($this->mconf['CURRO.'],$splitCount); 00981 } 00982 $CURinit = 1; 00983 } 00984 $NOconf[$key] = $CURconf[$key]; // Substitute normal with current 00985 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 00986 $ROconf[$key] = $CURROconf[$key] ? $CURROconf[$key] : $CURconf[$key]; // If RollOver on active then apply this 00987 } 00988 } 00989 } 00990 } 00991 // Prepare active settings, overriding normal settings 00992 if ($this->mconf['USR']) { 00993 $USRinit = 0; // Flag: If $USR is generated 00994 reset($NOconf); 00995 while (list($key,$val)=each($NOconf)) { // Find active 00996 if ($this->isItemState('USR',$key)) { 00997 if (!$USRinit) { // if this is the first active, we must generate USR. 00998 $USRconf = $this->tmpl->splitConfArray($this->mconf['USR.'],$splitCount); 00999 // Prepare active rollOver settings, overriding normal active settings 01000 if ($this->mconf['USRRO']) { 01001 $USRROconf = $this->tmpl->splitConfArray($this->mconf['USRRO.'],$splitCount); 01002 } 01003 $USRinit = 1; 01004 } 01005 $NOconf[$key] = $USRconf[$key]; // Substitute normal with active 01006 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 01007 $ROconf[$key] = $USRROconf[$key] ? $USRROconf[$key] : $USRconf[$key]; // If RollOver on active then apply this 01008 } 01009 } 01010 } 01011 } 01012 // Prepare spacer settings, overriding normal settings 01013 if ($this->mconf['SPC']) { 01014 $SPCinit = 0; // Flag: If $SPC is generated 01015 reset($NOconf); 01016 while (list($key,$val)=each($NOconf)) { // Find spacers 01017 if ($this->isItemState('SPC',$key)) { 01018 if (!$SPCinit) { // if this is the first spacer, we must generate SPC. 01019 $SPCconf = $this->tmpl->splitConfArray($this->mconf['SPC.'],$splitCount); 01020 $SPCinit = 1; 01021 } 01022 $NOconf[$key] = $SPCconf[$key]; // Substitute normal with spacer 01023 } 01024 } 01025 } 01026 // Prepare Userdefined settings 01027 if ($this->mconf['USERDEF1']) { 01028 $USERDEF1init = 0; // Flag: If $USERDEF1 is generated 01029 reset($NOconf); 01030 while (list($key,$val)=each($NOconf)) { // Find active 01031 if ($this->isItemState('USERDEF1',$key)) { 01032 if (!$USERDEF1init) { // if this is the first active, we must generate USERDEF1. 01033 $USERDEF1conf = $this->tmpl->splitConfArray($this->mconf['USERDEF1.'],$splitCount); 01034 // Prepare active rollOver settings, overriding normal active settings 01035 if ($this->mconf['USERDEF1RO']) { 01036 $USERDEF1ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF1RO.'],$splitCount); 01037 } 01038 $USERDEF1init = 1; 01039 } 01040 $NOconf[$key] = $USERDEF1conf[$key]; // Substitute normal with active 01041 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 01042 $ROconf[$key] = $USERDEF1ROconf[$key] ? $USERDEF1ROconf[$key] : $USERDEF1conf[$key]; // If RollOver on active then apply this 01043 } 01044 } 01045 } 01046 } 01047 // Prepare Userdefined settings 01048 if ($this->mconf['USERDEF2']) { 01049 $USERDEF2init = 0; // Flag: If $USERDEF2 is generated 01050 reset($NOconf); 01051 while (list($key,$val)=each($NOconf)) { // Find active 01052 if ($this->isItemState('USERDEF2',$key)) { 01053 if (!$USERDEF2init) { // if this is the first active, we must generate USERDEF2. 01054 $USERDEF2conf = $this->tmpl->splitConfArray($this->mconf['USERDEF2.'],$splitCount); 01055 // Prepare active rollOver settings, overriding normal active settings 01056 if ($this->mconf['USERDEF2RO']) { 01057 $USERDEF2ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF2RO.'],$splitCount); 01058 } 01059 $USERDEF2init = 1; 01060 } 01061 $NOconf[$key] = $USERDEF2conf[$key]; // Substitute normal with active 01062 if ($ROconf) { // If rollOver on normal, we must apply a state for rollOver on the active 01063 $ROconf[$key] = $USERDEF2ROconf[$key] ? $USERDEF2ROconf[$key] : $USERDEF2conf[$key]; // If RollOver on active then apply this 01064 } 01065 } 01066 } 01067 } 01068 01069 return array($NOconf,$ROconf); 01070 }
|
|
Creates the tag parts for the current item (in $this->I, [A1] and [A2]) based on other information in this array (like $this->I['linkHREF']).
Definition at line 1344 of file class.tslib_menu.php. References accessKey(). Referenced by tslib_tmenu::writeMenu(). 01344 { 01345 $this->I['A1'] = '<a '.t3lib_div::implodeAttributes($this->I['linkHREF'],1).$this->I['val']['ATagParams'].$this->I['addATagParams'].$this->I['accessKey']['code'].'>'; 01346 $this->I['A2'] = '</a>'; 01347 }
|
|
The initialization of the object. This just sets some internal variables.
Definition at line 187 of file class.tslib_menu.php. References $entryLevel, debug(), getKey(), and menu(). 00187 { 00188 00189 // Init: 00190 $this->conf = $conf; 00191 $this->menuNumber = $menuNumber; 00192 $this->mconf = $conf[$this->menuNumber.'.']; 00193 $this->debug=$GLOBALS['TSFE']->debug; 00194 00195 // Sets the internal vars. $tmpl MUST be the template-object. $sys_page MUST be the sys_page object 00196 if ($this->conf[$this->menuNumber] && is_object($tmpl) && is_object($sys_page)) { 00197 $this->tmpl = &$tmpl; 00198 $this->sys_page = &$sys_page; 00199 00200 // alwaysActivePIDlist initialized: 00201 if (trim($this->conf['alwaysActivePIDlist'])) { 00202 $this->alwaysActivePIDlist = t3lib_div::intExplode(',', $this->conf['alwaysActivePIDlist']); 00203 } 00204 00205 // 'not in menu' doktypes 00206 if($this->conf['excludeDoktypes']) { 00207 $this->doktypeExcludeList = $GLOBALS['TYPO3_DB']->cleanIntList($this->conf['excludeDoktypes']); 00208 } 00209 if($this->conf['includeNotInMenu']) { 00210 $exclDoktypeArr = t3lib_div::trimExplode(',',$this->doktypeExcludeList,1); 00211 $exclDoktypeArr = t3lib_div::removeArrayEntryByValue($exclDoktypeArr,'5'); 00212 $this->doktypeExcludeList = implode(',',$exclDoktypeArr); 00213 } 00214 00215 // EntryLevel 00216 $this->entryLevel = tslib_cObj::getKey ($conf['entryLevel'],$this->tmpl->rootLine); 00217 00218 // Set parent page: If $id not stated with start() then the base-id will be found from rootLine[$this->entryLevel] 00219 if ($id) { // Called as the next level in a menu. It is assumed that $this->MP_array is set from parent menu. 00220 $this->id = intval($id); 00221 } else { // This is a BRAND NEW menu, first level. So we take ID from rootline and also find MP_array (mount points) 00222 $this->id = intval($this->tmpl->rootLine[$this->entryLevel]['uid']); 00223 00224 // Traverse rootline to build MP_array of pages BEFORE the entryLevel 00225 // (MP var for ->id is picked up in the next part of the code...) 00226 foreach($this->tmpl->rootLine as $entryLevel => $levelRec) { 00227 // For overlaid mount points, set the variable right now: 00228 if ($levelRec['_MP_PARAM'] && $levelRec['_MOUNT_OL']) { 00229 $this->MP_array[] = $levelRec['_MP_PARAM']; 00230 } 00231 // Break when entry level is reached: 00232 if ($entryLevel>=$this->entryLevel) break; 00233 00234 // For normal mount points, set the variable for next level. 00235 if ($levelRec['_MP_PARAM'] && !$levelRec['_MOUNT_OL']) { 00236 $this->MP_array[] = $levelRec['_MP_PARAM']; 00237 } 00238 } 00239 } 00240 00241 // Return false if no page ID was set (thus no menu of subpages can be made). 00242 if ($this->id<=0) { 00243 return FALSE; 00244 } 00245 00246 // Check if page is a mount point, and if so set id and MP_array 00247 // (basically this is ONLY for non-overlay mode, but in overlay mode an ID with a mount point should never reach this point anyways, so no harm done...) 00248 $mount_info = $this->sys_page->getMountPointInfo($this->id); 00249 if (is_array($mount_info)) { 00250 $this->MP_array[] = $mount_info['MPvar']; 00251 $this->id = $mount_info['mount_pid']; 00252 } 00253 00254 // Gather list of page uids in root line (for "isActive" evaluation). Also adds the MP params in the path so Mount Points are respected. 00255 // (List is specific for this rootline, so it may be supplied from parent menus for speed...) 00256 if (!is_array($this->rL_uidRegister)) { 00257 $rl_MParray = array(); 00258 foreach($this->tmpl->rootLine as $v_rl) { 00259 // For overlaid mount points, set the variable right now: 00260 if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) { 00261 $rl_MParray[] = $v_rl['_MP_PARAM']; 00262 } 00263 00264 // Add to register: 00265 $this->rL_uidRegister[] = 'ITEM:'.$v_rl['uid'].(count($rl_MParray) ? ':'.implode(',',$rl_MParray) : ''); 00266 00267 // For normal mount points, set the variable for next level. 00268 if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) { 00269 $rl_MParray[] = $v_rl['_MP_PARAM']; 00270 } 00271 } 00272 } 00273 00274 // Setting "nextActive": This is the page uid + MPvar of the NEXT page in rootline. Used to expand the menu if we are in the right branch of the tree 00275 // Notice: The automatic expansion of a menu is designed to work only when no "special" modes are used. 00276 if (is_array($this->tmpl->rootLine[$this->entryLevel+$this->menuNumber])) { 00277 $nextMParray = $this->MP_array; 00278 if ($this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['_MOUNT_OL']) { // In overlay mode, add next level MPvars as well: 00279 $nextMParray[] = $this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['_MP_PARAM']; 00280 } 00281 $this->nextActive = $this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['uid']. 00282 (count($nextMParray)?':'.implode(',',$nextMParray):''); 00283 } else { 00284 $this->nextActive = ''; 00285 } 00286 00287 // imgNamePrefix 00288 if ($this->mconf['imgNamePrefix']) { 00289 $this->imgNamePrefix=$this->mconf['imgNamePrefix']; 00290 } 00291 $this->imgNameNotRandom = $this->mconf['imgNameNotRandom']; 00292 00293 // subLevelClass 00294 $cls = strtolower($this->conf[$this->menuNumber+1]); 00295 if ($cls && t3lib_div::inList($this->tmpl->menuclasses,$cls)) { 00296 $this->subLevelClass = $cls; 00297 } 00298 $retVal = TRUE; 00299 } else { 00300 $GLOBALS['TT']->setTSlogMessage('ERROR in menu',3); 00301 $retVal = FALSE; 00302 } 00303 return $retVal; 00304 }
|
|
Creates a submenu level to the current level - if configured for.
Definition at line 1142 of file class.tslib_menu.php. References isNext(). Referenced by tslib_tmenu_layers::extProc_beforeLinking(), tslib_gmenu_layers::extProc_beforeLinking(), and tslib_gmenu_foldout::extProc_beforeLinking(). 01142 { 01143 01144 // Setting alternative menu item array if _SUB_MENU has been defined in the current ->menuArr 01145 $altArray = ''; 01146 if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && count($this->menuArr[$this->I['key']]['_SUB_MENU'])) { 01147 $altArray = $this->menuArr[$this->I['key']]['_SUB_MENU']; 01148 } 01149 01150 // Make submenu if the page is the next active 01151 if ($this->subLevelClass && ($this->mconf['expAll'] || $this->isNext($uid, $this->getMPvar($this->I['key'])) || is_array($altArray)) && !$this->mconf['sectionIndex']) { 01152 $submenu = t3lib_div::makeInstance('tslib_'.$this->subLevelClass); 01153 $submenu->entryLevel = $this->entryLevel+1; 01154 $submenu->rL_uidRegister = $this->rL_uidRegister; 01155 $submenu->MP_array = $this->MP_array; 01156 if ($this->menuArr[$this->I['key']]['_MP_PARAM']) { 01157 $submenu->MP_array[] = $this->menuArr[$this->I['key']]['_MP_PARAM']; 01158 } 01159 01160 // especially scripts that build the submenu needs the parent data 01161 $submenu->parentMenuArr = $this->menuArr; 01162 01163 // Setting alternativeMenuTempArray (will be effective only if an array) 01164 if (is_array($altArray)) { 01165 $submenu->alternativeMenuTempArray = $altArray; 01166 } 01167 01168 if ($submenu->start($this->tmpl, $this->sys_page, $uid, $this->conf, $this->menuNumber+1)) { 01169 $submenu->makeMenu(); 01170 return $submenu->writeMenu(); 01171 } 01172 } 01173 }
|
|
Calls a user function for processing of internal data. Used for the properties "IProcFunc" and "itemArrayProcFunc"
Definition at line 1329 of file class.tslib_menu.php. Referenced by makeMenu(), and tslib_tmenu::writeMenu(). 01329 { 01330 if ($this->mconf[$mConfKey]) { 01331 $funcConf = $this->mconf[$mConfKey.'.']; 01332 $funcConf['parentObj']=&$this; 01333 $passVar = $GLOBALS['TSFE']->cObj->callUserFunction($this->mconf[$mConfKey], $funcConf, $passVar); 01334 } 01335 return $passVar; 01336 }
|
|
Definition at line 174 of file class.tslib_menu.php. |
|
Definition at line 149 of file class.tslib_menu.php. |
|
Definition at line 158 of file class.tslib_menu.php. Referenced by link(). |
|
Definition at line 152 of file class.tslib_menu.php. |
|
Definition at line 148 of file class.tslib_menu.php. |
|
Definition at line 145 of file class.tslib_menu.php. Referenced by start(). |
|
Reimplemented in tslib_gmenu_foldout, tslib_gmenu_layers, and tslib_tmenu_layers. Definition at line 154 of file class.tslib_menu.php. |
|
Definition at line 165 of file class.tslib_menu.php. |
|
Definition at line 169 of file class.tslib_menu.php. |
|
Definition at line 162 of file class.tslib_menu.php. Referenced by makeMenu(). |
|
Definition at line 151 of file class.tslib_menu.php. |
|
Definition at line 150 of file class.tslib_menu.php. |
|
Definition at line 168 of file class.tslib_menu.php. |
|
Definition at line 159 of file class.tslib_menu.php. |
|
Definition at line 164 of file class.tslib_menu.php. |
|
Definition at line 144 of file class.tslib_menu.php. |
|
Definition at line 155 of file class.tslib_menu.php. |
|
Definition at line 163 of file class.tslib_menu.php. Referenced by makeMenu(). |
|
Definition at line 153 of file class.tslib_menu.php. |
|
Definition at line 166 of file class.tslib_menu.php. Referenced by accessKey(). |
|
Definition at line 167 of file class.tslib_menu.php. |
|
Definition at line 147 of file class.tslib_menu.php. |
|
Definition at line 146 of file class.tslib_menu.php. |
|
Definition at line 161 of file class.tslib_menu.php. |
|
Definition at line 160 of file class.tslib_menu.php. |
|
Reimplemented in tslib_gmenu_layers, and tslib_tmenu_layers. Definition at line 173 of file class.tslib_menu.php. |
|
Definition at line 171 of file class.tslib_menu.php. |
|
Definition at line 172 of file class.tslib_menu.php. |
|
Definition at line 170 of file class.tslib_menu.php. |