Public Member Functions | |
generate () | |
Calls procesItemStates() so that the common configuration for the menu items are resolved into individual configuration per item. | |
makeImageMap ($conf) | |
Will traverse input array with configuratoin per-item and create corresponding GIF files for the menu. | |
writeMenu () | |
Returns the HTML for the image map menu. |
|
Calls procesItemStates() so that the common configuration for the menu items are resolved into individual configuration per item. Calls makeImageMap() to generate the image map image-file
Definition at line 2279 of file class.tslib_menu.php. References debug(), makeImageMap(), and tslib_menu::procesItemStates(). 02279 { 02280 $splitCount = count($this->menuArr); 02281 if ($splitCount) { 02282 list($NOconf) = $this->procesItemStates($splitCount); 02283 } 02284 if ($this->mconf['debugItemConf']) {echo '<h3>$NOconf:</h3>'; debug($NOconf); } 02285 $this->makeImageMap($NOconf); 02286 }
|
|
Will traverse input array with configuratoin per-item and create corresponding GIF files for the menu. The data of the files are stored in $this->result
Definition at line 2297 of file class.tslib_menu.php. References $LD, $val, debug(), main(), and menu(). Referenced by generate(). 02297 { 02298 if (!is_array($conf)) { 02299 $conf = Array(); 02300 } 02301 if (is_array($this->mconf['main.'])) { 02302 $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder'); 02303 $gifCreator->init(); 02304 02305 $itemsConf = $conf; 02306 $conf = $this->mconf['main.']; 02307 if (is_array($conf)) { 02308 $gifObjCount = 0; 02309 02310 $sKeyArray=t3lib_TStemplate::sortedKeyList($conf); 02311 $gifObjCount=intval(end($sKeyArray)); 02312 02313 $lastOriginal = $gifObjCount; 02314 02315 // Now we add graphical objects to the gifbuilder-setup 02316 reset($itemsConf); 02317 $waArr = Array(); 02318 while (list($key,$val)=each($itemsConf)) { 02319 if (is_array($val)) { 02320 $gifObjCount++; 02321 $waArr[$key]['free']=$gifObjCount; 02322 02323 $sKeyArray=t3lib_TStemplate::sortedKeyList($val); 02324 02325 foreach($sKeyArray as $theKey) { 02326 $theValue=$val[$theKey]; 02327 02328 02329 if (intval($theKey) && $theValArr=$val[$theKey.'.']) { 02330 $cObjData = $this->menuArr[$key] ? $this->menuArr[$key] : Array(); 02331 02332 $gifObjCount++; 02333 if ($theValue=='TEXT') { 02334 $waArr[$key]['textNum']=$gifObjCount; 02335 02336 $gifCreator->data = $cObjData; 02337 $theValArr = $gifCreator->checkTextObj($theValArr); 02338 unset($theValArr['text.']); // if this is not done it seems that imageMaps will be rendered wrong!! 02339 // check links 02340 02341 $LD = $this->tmpl->linkData($this->menuArr[$key],$this->mconf['target'],'','',array(),'',$this->mconf['forceTypeValue']); 02342 02343 // Overriding URL / Target if set to do so: 02344 if ($this->menuArr[$key]['_OVERRIDE_HREF']) { 02345 $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF']; 02346 if ($this->menuArr[$key]['_OVERRIDE_TARGET']) $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET']; 02347 } 02348 02349 // Setting target/url for Image Map: 02350 if ($theValArr['imgMap.']['url']=='') { 02351 $theValArr['imgMap.']['url'] = $LD['totalURL']; 02352 } 02353 if ($theValArr['imgMap.']['target']=='') { 02354 $theValArr['imgMap.']['target'] = $LD['target']; 02355 } 02356 if ($theValArr['imgMap.']['noBlur']=='') { 02357 $theValArr['imgMap.']['noBlur'] = $this->mconf['noBlur']; 02358 } 02359 if (is_array($theValArr['imgMap.']['altText.'])) { 02360 $cObj =t3lib_div::makeInstance('tslib_cObj'); 02361 $cObj->start($cObjData,'pages'); 02362 $theValArr['imgMap.']['altText'] = $cObj->stdWrap($theValArr['imgMap.']['altText'], $theValArr['imgMap.']['altText.']); 02363 unset($theValArr['imgMap.']['altText.']); 02364 } 02365 if (is_array($theValArr['imgMap.']['titleText.'])) { 02366 $cObj =t3lib_div::makeInstance('tslib_cObj'); 02367 $cObj->start($cObjData,'pages'); 02368 $theValArr['imgMap.']['titleText'] = $cObj->stdWrap($theValArr['imgMap.']['titleText'], $theValArr['imgMap.']['titleText.']); 02369 unset($theValArr['imgMap.']['titleText.']); 02370 } 02371 } 02372 // This code goes one level in if the object is an image. If 'file' and/or 'mask' appears to be GIFBUILDER-objects, they are both searched for TEXT objects, and if a textobj is found, it's checked with the currently loaded record!! 02373 if ($theValue=='IMAGE') { 02374 if ($theValArr['file']=='GIFBUILDER') { 02375 $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['file.']); 02376 reset($temp_sKeyArray); 02377 while(list(,$temp_theKey)=each($temp_sKeyArray)) { 02378 if ($theValArr['mask.'][$temp_theKey]=='TEXT') { 02379 $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array(); 02380 $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']); 02381 unset($theValArr['mask.'][$temp_theKey.'.']['text.']); // if this is not done it seems that imageMaps will be rendered wrong!! 02382 } 02383 } 02384 } 02385 if ($theValArr['mask']=='GIFBUILDER') { 02386 $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['mask.']); 02387 reset($temp_sKeyArray); 02388 while(list(,$temp_theKey)=each($temp_sKeyArray)) { 02389 if ($theValArr['mask.'][$temp_theKey]=='TEXT') { 02390 $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array(); 02391 $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']); 02392 unset($theValArr['mask.'][$temp_theKey.'.']['text.']); // if this is not done it seems that imageMaps will be rendered wrong!! 02393 } 02394 } 02395 } 02396 } 02397 02398 // Checks if disabled is set... 02399 $setObjFlag=1; 02400 if ($theValArr['if.']) { 02401 $cObj =t3lib_div::makeInstance('tslib_cObj'); 02402 $cObj->start($cObjData,'pages'); 02403 if (!$cObj->checkIf($theValArr['if.'])) { 02404 $setObjFlag=0; 02405 } 02406 unset($theValArr['if.']); 02407 } 02408 // Set the object! 02409 if ($setObjFlag) { 02410 $conf[$gifObjCount] = $theValue; 02411 $conf[$gifObjCount.'.'] = $theValArr; 02412 } 02413 } 02414 } 02415 } 02416 } 02417 02418 $gifCreator->start($conf,$GLOBALS['TSFE']->page); 02419 // calculations 02420 02421 $sum=Array(0,0,0,0); 02422 reset($waArr); 02423 while (list($key,$val)=each($waArr)) { 02424 if ($dConf[$key] =$itemsConf[$key]['distrib']) { 02425 $textBB = $gifCreator->objBB[$val['textNum']]; 02426 $dConf[$key] = str_replace('textX',$textBB[0],$dConf[$key]); 02427 $dConf[$key] = str_replace('textY',$textBB[1],$dConf[$key]); 02428 $dConf[$key] = t3lib_div::intExplode(',',$gifCreator->calcOffset($dConf[$key])); 02429 } 02430 } 02431 $workArea = t3lib_div::intExplode(',',$gifCreator->calcOffset($this->mconf['dWorkArea'])); 02432 reset($waArr); 02433 while (list($key,$val)=each($waArr)) { 02434 $index = $val['free']; 02435 $gifCreator->setup[$index] = 'WORKAREA'; 02436 $workArea[2] = $dConf[$key][2] ? $dConf[$key][2] : $dConf[$key][0]; 02437 $workArea[3] = $dConf[$key][3] ? $dConf[$key][3] : $dConf[$key][1]; 02438 02439 $gifCreator->setup[$index.'.']['set'] = implode(',',$workArea); 02440 $workArea[0]+=$dConf[$key][0]; 02441 $workArea[1]+=$dConf[$key][1]; 02442 } 02443 02444 if ($this->mconf['debugRenumberedObject']) {echo '<h3>Renumbered GIFBUILDER object:</h3>'; debug($gifCreator->setup);} 02445 02446 $gifCreator->createTempSubDir('menu/'); 02447 $gifFileName = $gifCreator->fileName('menu/'); 02448 02449 // Gets the ImageMap from the cache... 02450 $imgHash = md5($gifFileName); 02451 $imgMap = $this->sys_page->getHash($imgHash, 0); 02452 02453 if ($imgMap && @file_exists($gifFileName)) { // File exists 02454 $info = @getimagesize($gifFileName); 02455 $w=$info[0]; 02456 $h=$info[1]; 02457 } else { // file is generated 02458 $gifCreator->make(); 02459 $w=$gifCreator->w; 02460 $h=$gifCreator->h; 02461 $gifCreator->output($gifFileName); 02462 $gifCreator->destroy(); 02463 $imgMap=$gifCreator->map; 02464 $this->sys_page->storeHash($imgHash, $imgMap, 'MENU IMAGEMAP'); 02465 } 02466 $imgMap.=$this->mconf['imgMapExtras']; 02467 02468 $gifFileName = t3lib_div::png_to_gif_by_imagemagick($gifFileName); 02469 $this->result = Array('output_file'=>$gifFileName, 'output_w'=>$w, 'output_h'=>$h, 'imgMap'=>$imgMap); 02470 } 02471 } 02472 }
|
|
Returns the HTML for the image map menu. If ->result is true it will create the HTML for the image map menu.
Definition at line 2480 of file class.tslib_menu.php. |