00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00219
00220 require_once(PATH_t3lib."class.t3lib_parsehtml.php");
00221
00222
00223 if(t3lib_extMgm::isLoaded('obts')) {
00224 require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php');
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00257 class tslib_cObj {
00258 var $align = Array ('center', 'right', 'left');
00259
00270 var $image_compression = Array(
00271 10 => Array('params'=>'', 'ext'=>'gif'),
00272 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
00273 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
00274 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
00275 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
00276 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
00277
00278 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
00279 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
00280 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
00281 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
00282 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
00283 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
00284 39 => Array('params'=>'', 'ext'=>'png'),
00285
00286 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
00287 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
00288 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
00289 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
00290 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
00291 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
00292 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
00293 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
00294 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
00295 );
00296
00302 var $image_effects = Array(
00303 1 => '-rotate 90',
00304 2 => '-rotate 270',
00305 3 => '-rotate 180',
00306 10 => '-colorspace GRAY',
00307 11 => '-sharpen 70',
00308 20 => '-normalize',
00309 23 => '-contrast',
00310 25 => '-gamma 1.3',
00311 26 => '-gamma 0.8'
00312 );
00313
00321 var $data = Array();
00322 var $oldData = Array();
00323 var $alternativeData ='';
00324 var $parameters = Array();
00325 var $currentValKey = 'currentValue_kidjls9dksoje';
00326 var $currentRecord = '';
00327 var $currentRecordTotal = 0;
00328 var $currentRecordNumber = 0;
00329 var $parentRecordNumber = 0;
00330 var $parentRecord = array();
00331 var $regObj;
00332
00333
00334 var $INT_include=0;
00335 var $checkPid_cache = Array();
00336 var $checkPid_badDoktypeList = '255';
00337 var $lastTypoLinkUrl='';
00338 var $lastTypoLinkTarget='';
00339 var $substMarkerCache=array();
00340 var $recordRegister=array();
00341
00351 function start($data,$table='') {
00352 $this->data = $data;
00353 $this->currentRecord = $table ? $table.':'.$this->data['uid'] : '';
00354 $this->parameters = Array();
00355 }
00356
00366 function setParent($data,$currentRecord) {
00367 $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord);
00368 }
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00391 function getCurrentVal() {
00392 return $this->data[$this->currentValKey];
00393 }
00394
00402 function setCurrentVal($value) {
00403 $this->data[$this->currentValKey] = $value;
00404 }
00405
00415 function cObjGet($setup,$addKey='') {
00416 if (is_array($setup)) {
00417 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
00418 $content ='';
00419 foreach($sKeyArray as $theKey) {
00420 $theValue=$setup[$theKey];
00421 if (intval($theKey) && !strstr($theKey,'.')) {
00422 $conf=$setup[$theKey.'.'];
00423 $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey);
00424 }
00425 }
00426 return $content;
00427 }
00428 }
00429
00439 function cObjGetSingle($name,$conf,$TSkey='__') {
00440 $content='';
00441
00442 $GLOBALS['TSFE']->cObjectDepthCounter--;
00443 if ($GLOBALS['TSFE']->cObjectDepthCounter>0) {
00444 $name = trim($name);
00445 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name);
00446
00447
00448 if (substr($name,0,1)=='<') {
00449 $key = trim(substr($name,1));
00450 $cF = t3lib_div::makeInstance('t3lib_TSparser');
00451
00452 $old_conf=$conf;
00453 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
00454 if (is_array($old_conf) && count($old_conf)) {
00455 $conf = $this->joinTSarrays($conf,$old_conf);
00456
00457 }
00458
00459 $GLOBALS['TT']->incStackPointer();
00460 $content.=$this->cObjGetSingle($name,$conf,$key);
00461 $GLOBALS['TT']->decStackPointer();
00462 } else {
00463
00464
00465 if(t3lib_extMgm::isLoaded('obts') && isset($GLOBALS['OBTS']['tso_list'][$name])) {
00466 $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this);
00467 } else {
00468
00469 switch($name) {
00470 case 'COBJ_ARRAY':
00471 case 'COA':
00472 $content.=$this->COBJ_ARRAY($conf);
00473 break;
00474 case 'COA_INT':
00475 $content.=$this->COBJ_ARRAY($conf,'INT');
00476 break;
00477 case 'HTML':
00478 $content.=$this->HTML($conf);
00479 break;
00480 case 'TEXT':
00481 $content.=$this->TEXT($conf);
00482 break;
00483 case 'CLEARGIF':
00484 $content.=$this->CLEARGIF($conf);
00485 break;
00486 case 'FILE':
00487 $content.=$this->FILE($conf);
00488 break;
00489 case 'IMAGE':
00490 $content.=$this->IMAGE($conf);
00491 break;
00492 case 'IMG_RESOURCE':
00493 $content.=$this->IMG_RESOURCE($conf);
00494 break;
00495 case 'IMGTEXT':
00496 $content.=$this->IMGTEXT($conf);
00497 break;
00498 case 'CONTENT':
00499 $content.=$this->CONTENT($conf);
00500 break;
00501 case 'RECORDS':
00502 $content.=$this->RECORDS($conf);
00503 break;
00504 case 'HMENU':
00505 $content.=$this->HMENU($conf);
00506 break;
00507 case 'CTABLE':
00508 $content.=$this->CTABLE($conf);
00509 break;
00510 case 'OTABLE':
00511 $content.=$this->OTABLE($conf);
00512 break;
00513 case 'COLUMNS':
00514 $content.=$this->COLUMNS($conf);
00515 break;
00516 case 'HRULER':
00517 $content.=$this->HRULER($conf);
00518 break;
00519 case 'CASE':
00520 $content.=$this->CASEFUNC($conf);
00521 break;
00522 case 'LOAD_REGISTER':
00523 case 'RESTORE_REGISTER':
00524 $this->LOAD_REGISTER($conf,$name);
00525 break;
00526 case 'FORM':
00527 $content.=$this->FORM($conf);
00528 break;
00529 case 'SEARCHRESULT':
00530 $content.=$this->SEARCHRESULT($conf);
00531 break;
00532 case 'PHP_SCRIPT':
00533 $content.=$this->PHP_SCRIPT($conf);
00534 break;
00535 case 'PHP_SCRIPT_EXT':
00536 $content.=$this->PHP_SCRIPT($conf,'EXT');
00537 break;
00538 case 'PHP_SCRIPT_INT':
00539 $content.=$this->PHP_SCRIPT($conf,'INT');
00540 break;
00541 case 'USER':
00542 $content.=$this->USER($conf);
00543 break;
00544 case 'USER_INT':
00545 $content.=$this->USER($conf,'INT');
00546 break;
00547 case 'TEMPLATE':
00548 $content.=$this->TEMPLATE($conf);
00549 break;
00550 case 'EDITPANEL':
00551 if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);}
00552 break;
00553 case 'MULTIMEDIA':
00554 $content.=$this->MULTIMEDIA($conf);
00555 break;
00556 }
00557 }
00558 }
00559 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content);
00560 }
00561
00562 $GLOBALS['TSFE']->cObjectDepthCounter++;
00563 return $content;
00564 }
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00585 function HTML($conf) {
00586 return $this->stdWrap($conf['value'],$conf['value.']);
00587 }
00588
00596 function TEXT($conf) {
00597 return $this->stdWrap($conf['value'],$conf);
00598 }
00599
00607 function CLEARGIF($conf) {
00608 $w = $this->stdWrap($conf['width'],$conf['width.']);
00609 $h = $this->stdWrap($conf['height'],$conf['height.']);
00610 $w = $w ? $w : 1;
00611 $h = $h ? $h : 1;
00612 $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />';
00613 $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap);
00614
00615 return $this->stdWrap($theValue,$conf['stdWrap.']);
00616 }
00617
00626 function COBJ_ARRAY($conf,$ext='') {
00627 $content='';
00628 switch($ext) {
00629 case 'INT':
00630 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00631 $content.='<!--'.$substKey.'-->';
00632 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00633 'file'=>$incFile,
00634 'conf'=>$conf,
00635 'cObj'=>serialize($this),
00636 'type'=>'COA'
00637 );
00638 break;
00639 default:
00640 if ($this->checkIf($conf['if.'])) {
00641 $content=$this->cObjGet($conf);
00642 if ($conf['wrap']) {
00643 $content=$this->wrap($content, $conf['wrap']);
00644 }
00645 if ($conf['stdWrap.']) {
00646 $content=$this->stdWrap($content, $conf['stdWrap.']);
00647 }
00648 }
00649 break;
00650 }
00651 return $content;
00652 }
00653
00662 function USER($conf,$ext='') {
00663 $content='';
00664 switch($ext) {
00665 case 'INT':
00666 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00667 $content.='<!--'.$substKey.'-->';
00668 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00669 'file' => $incFile,
00670 'conf' => $conf,
00671 'cObj' => serialize($this),
00672 'type' => 'FUNC'
00673 );
00674 break;
00675 default:
00676 $content.=$this->callUserFunction($conf['userFunc'],$conf,'');
00677 break;
00678 }
00679 return $content;
00680 }
00681
00689 function FILE($conf) {
00690 $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf)));
00691 if ($conf['linkWrap']) {
00692 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
00693 }
00694 return $this->wrap($theValue,$conf['wrap']);
00695 }
00696
00705 function IMAGE($conf) {
00706 $content='';
00707 if ($this->checkIf($conf['if.'])) {
00708 $theValue = $this->cImage($conf['file'],$conf);
00709 if ($conf['stdWrap.']) {
00710 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
00711 }
00712 return $theValue;
00713 }
00714 }
00715
00724 function IMG_RESOURCE($conf) {
00725 $imgArray = $this->getImgResource($conf['file'],$conf['file.']);
00726 return $this->stdWrap($imgArray[3],$conf['stdWrap.']);
00727 }
00728
00736 function IMGTEXT($conf) {
00737 $content='';
00738 if (is_array($conf['text.'])) {
00739 $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']);
00740 }
00741 $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.']));
00742 if ($imgList) {
00743 $imgs = t3lib_div::trimExplode(',',$imgList);
00744 $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
00745
00746 $imgCount= count($imgs)-$imgStart;
00747
00748 $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
00749 if ($imgMax) {
00750 $imgCount = t3lib_div::intInRange($imgCount,0,$conf['imgMax']);
00751 }
00752
00753 $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
00754
00755
00756 $caption='';
00757 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
00758 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);
00759 }
00760
00761 $tablecode='';
00762 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
00763
00764 $tmppos = $position&7;
00765 $contentPosition = $position&24;
00766 $align = $this->align[$tmppos];
00767 $cap = ($caption)?1:0;
00768 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
00769 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
00770 $txtMarg=0;
00771 }
00772
00773 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
00774 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
00775 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
00776 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
00777
00778 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
00779 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
00780 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
00781
00782 $borderColor=$borderColor?$borderColor:'black';
00783 $borderThickness=$borderThickness?$borderThickness:1;
00784
00785 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
00786 if (!$caption_align) {
00787 $caption_align = $align;
00788 }
00789
00790 $colCount = ($cols > 1) ? $cols : 1;
00791 if ($colCount > $imgCount) {$colCount = $imgCount;}
00792 $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
00793
00794 if ($rows>1) {
00795 $rowCount = $rows;
00796 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
00797 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00798 }
00799
00800
00801 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
00802 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
00803
00804 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00805 if (!$maxWInText) {
00806 $maxWInText = round($maxW/100*50);
00807 }
00808
00809 if ($maxWInText && $contentPosition>=16) {
00810 $maxW = $maxWInText;
00811 }
00812
00813 if ($maxW && $colCount > 0) {
00814
00815
00816
00817
00818
00819 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
00820 }
00821
00822 $colMaxW = Array();
00823 if ($colRelations) {
00824 $rel_parts = explode(':',$colRelations);
00825 $rel_total = 0;
00826 for ($a=0;$a<$colCount;$a++) {
00827 $rel_parts[$a] = intval($rel_parts[$a]);
00828 $rel_total+= $rel_parts[$a];
00829 }
00830 if ($rel_total) {
00831 for ($a=0;$a<$colCount;$a++) {
00832 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
00833 }
00834 if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) {
00835 $colMaxW = Array();
00836 }
00837 }
00838 }
00839 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
00840 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
00841 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00842
00843
00844 $splitArr=array();
00845 $splitArr['imgObjNum']=$conf['imgObjNum'];
00846 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
00847
00848
00849 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
00850 if ($equalHeight) {
00851 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00852 $gifCreator->init();
00853 $relations = Array();
00854 $relations_cols = Array();
00855 $totalMaxW = $maxW*$colCount;
00856 for($a=0;$a<$imgCount;$a++) {
00857 $imgKey = $a+$imgStart;
00858 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00859 $relations[$a] = $imgInfo[1] / $equalHeight;
00860 if ($relations[$a]) {
00861 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a];
00862 }
00863 }
00864 }
00865
00866 $imageRowsFinalWidths = Array();
00867 $imageRowsMaxHeights = Array();
00868 $imgsTag=array();
00869 $origImages=array();
00870 for($a=0;$a<$imgCount;$a++) {
00871 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
00872
00873 $imgKey = $a+$imgStart;
00874 $totalImagePath = $imgPath.$imgs[$imgKey];
00875 $this->data[$this->currentValKey] = $totalImagePath;
00876 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00877 $imgConf = $conf[$imgObjNum.'.'];
00878
00879 if ($equalHeight) {
00880 $scale = 1;
00881 if ($totalMaxW) {
00882 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
00883 if ($rowTotalMaxW > $totalMaxW) {
00884 $scale = $rowTotalMaxW / $totalMaxW;
00885 }
00886 }
00887
00888 $imgConf['file.']['height'] = round($equalHeight/$scale);
00889
00890 unset($imgConf['file.']['width']);
00891 unset($imgConf['file.']['maxW']);
00892 unset($imgConf['file.']['maxH']);
00893 unset($imgConf['file.']['minW']);
00894 unset($imgConf['file.']['minH']);
00895 unset($imgConf['file.']['width.']);
00896 unset($imgConf['file.']['maxW.']);
00897 unset($imgConf['file.']['maxH.']);
00898 unset($imgConf['file.']['minW.']);
00899 unset($imgConf['file.']['minH.']);
00900 $maxW = 0;
00901 }
00902
00903 if ($maxW) {
00904 if (count($colMaxW)) {
00905 $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
00906 } else {
00907 $imgConf['file.']['maxW'] = $maxW;
00908 }
00909 }
00910
00911
00912 if (is_array($imgConf)) {
00913 if ($this->image_effects[$image_effects]) {
00914 $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
00915 }
00916 if ($image_frames) {
00917 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
00918 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00919 }
00920 }
00921 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
00922 if ($image_compression==1) {
00923 $tempImport = $imgConf['file.']['import'];
00924 $tempImport_dot = $imgConf['file.']['import.'];
00925 unset($imgConf['file.']);
00926 $imgConf['file.']['import'] = $tempImport;
00927 $imgConf['file.']['import.'] = $tempImport_dot;
00928 } elseif (isset($this->image_compression[$image_compression])) {
00929 $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
00930 $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
00931 unset($imgConf['file.']['ext.']);
00932 }
00933 }
00934
00935
00936 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
00937 $imgConf['altText'] = $conf['altText'];
00938 $imgConf['altText.'] = $conf['altText.'];
00939 }
00940 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
00941 $imgConf['titleText'] = $conf['titleText'];
00942 $imgConf['titleText.'] = $conf['titleText.'];
00943 }
00944 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
00945 $imgConf['longdescURL'] = $conf['longdescURL'];
00946 $imgConf['longdescURL.'] = $conf['longdescURL.'];
00947 }
00948 } else {
00949 $imgConf = array(
00950 'altText' => $conf['altText'],
00951 'titleText' => $conf['titleText'],
00952 'longdescURL' => $conf['longdescURL'],
00953 'file' => $totalImagePath
00954 );
00955 }
00956
00957 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
00958
00959
00960 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
00961
00962 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00963 if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
00964 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
00965 }
00966 }
00967
00968
00969 $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
00970
00971
00972 $index=$imgStart;
00973
00974 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
00975 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
00976 if ($noRows) {$noCols=0;}
00977 if ($equalHeight) {
00978 $noCols=1;
00979 $noRows=0;
00980 }
00981
00982 $rowCount_temp=1;
00983 $colCount_temp=$colCount;
00984 if ($noRows) {
00985 $rowCount_temp = $rowCount;
00986 $rowCount=1;
00987 }
00988 if ($noCols) {
00989 $colCount=1;
00990 }
00991
00992 $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
00993 $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
00994
00995
00996
00997 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
00998
00999
01000 $tablecode='';
01001 $flag=0;
01002 if ($conf['noStretchAndMarginCells']!=1) {
01003 $tablecode.='<tr>';
01004 if ($txtMarg && $align=='right') {
01005 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01006 $editIconsHTML='';
01007 $flag=1;
01008 }
01009 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
01010 if ($txtMarg && $align=='left') {
01011 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01012 $editIconsHTML='';
01013 $flag=1;
01014 }
01015 if ($flag) $tableWidth+=$txtMarg+1;
01016
01017 $tablecode.='</tr>';
01018 }
01019
01020
01021 for ($c=0;$c<$rowCount;$c++) {
01022 if ($c && $rowspacing) {
01023 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
01024 }
01025 $tablecode.='<tr>';
01026 for ($b=0; $b<$colCount_temp; $b++) {
01027 if ($b && $colspacing) {
01028 if (!$noCols) {
01029 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
01030 } else {
01031 $colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($border?$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+($border?$borderThickness*2:0)).'"'.$this->getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />';
01032 $colSpacer='<td valign="top">'.$colSpacer.'</td>';
01033 $tablecode.=$colSpacer;
01034 }
01035 }
01036 if (!$noCols || ($noCols && !$b)) {
01037 $tablecode.='<td valign="top">';
01038 if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}
01039 }
01040 for ($a=0;$a<$rowCount_temp;$a++) {
01041 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;
01042 $imgIndex = $index+$a*$colCount_temp;
01043 if ($imgsTag[$imgIndex]) {
01044 if ($rowspacing && $noRows && $a) {
01045 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
01046 }
01047 if ($conf['captionSplit'] || $conf['imageTextSplit']) {
01048 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
01049 }
01050 $imageHTML = $imgsTag[$imgIndex].'<br />';
01051 $Talign = (!trim($thisCaption) && !$noRows && !$conf['netprintApplicationLink']) ? ' align="left"' : '';
01052 if ($border) {$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}
01053 $imageHTML.=$editIconsHTML; $editIconsHTML='';
01054 if ($conf['netprintApplicationLink']) {$imageHTML = $this->netprintApplication_offsiteLinkWrap($imageHTML,$origImages[$imgIndex],$conf['netprintApplicationLink.']);}
01055 $imageHTML.=$thisCaption;
01056 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';}
01057 $tablecode.=$imageHTML;
01058 }
01059 }
01060 $index++;
01061 if (!$noCols || ($noCols && $b+1==$colCount_temp)) {
01062 if ($noCols) {$tablecode.='</tr></table>';}
01063 $tablecode.='</td>';
01064 }
01065 }
01066 $tablecode.='</tr>';
01067 }
01068 if ($c) {
01069 switch ($contentPosition) {
01070 case '0':
01071 case '8':
01072 switch ($align) {
01073 case 'center':
01074 $table_align = 'margin-left: auto; margin-right: auto';
01075 break;
01076 case 'right':
01077 $table_align = 'margin-left: auto; margin-right: 0px';
01078 break;
01079 default:
01080 $table_align = 'margin-left: 0px; margin-right: auto';
01081 }
01082 $table_align = 'style="'.$table_align.'"';
01083 break;
01084 case '16':
01085 $table_align = 'align="'.$align.'"';
01086 break;
01087 default:
01088 $table_align = '';
01089 }
01090
01091
01092 $tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
01093 if ($editIconsHTML) {
01094 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
01095 $editIconsHTML='';
01096 }
01097 if ($cap) {
01098 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
01099 }
01100 $tablecode.='</table>';
01101 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
01102 }
01103
01104 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
01105 switch ($contentPosition) {
01106 case '0':
01107 $output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
01108 break;
01109 case '8':
01110 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
01111 break;
01112 case '16':
01113 $output= $tablecode.$content;
01114 break;
01115 case '24':
01116 $theResult = '';
01117 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
01118 if ($align=='right') {
01119 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
01120 } else {
01121 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
01122 }
01123 $theResult.= '</tr></table>';
01124 $output= $theResult;
01125 break;
01126 }
01127 } else {
01128 $output= $content;
01129 }
01130
01131 if ($conf['stdWrap.']) {
01132 $output = $this->stdWrap($output, $conf['stdWrap.']);
01133 }
01134
01135 return $output;
01136 }
01137
01145 function CONTENT($conf) {
01146 $theValue='';
01147
01148 $originalRec = $GLOBALS['TSFE']->currentRecord;
01149 if ($originalRec) {
01150 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01151 }
01152
01153 if ($conf['table']=='pages' || substr($conf['table'],0,3)=='tt_' || substr($conf['table'],0,3)=='fe_' || substr($conf['table'],0,3)=='tx_' || substr($conf['table'],0,4)=='ttx_' || substr($conf['table'],0,5)=='user_') {
01154
01155 $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];
01156 $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
01157 $renderObjConf = $conf['renderObj.'];
01158
01159 $slide = intval($conf['slide'])?intval($conf['slide']):0;
01160 $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;
01161 $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;
01162 $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;
01163 $again = false;
01164
01165 do {
01166 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
01167 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
01168 $GLOBALS['TT']->setTSlogMessage($error,3);
01169 } else {
01170 $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01171 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
01172 $cObj =t3lib_div::makeInstance('tslib_cObj');
01173 $cObj->setParent($this->data,$this->currentRecord);
01174 $this->currentRecordNumber=0;
01175 $cobjValue = '';
01176 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01177
01178
01179 $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);
01180
01181
01182 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01183 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01184 }
01185
01186 if (is_array($row)) {
01187 if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {
01188 $this->currentRecordNumber++;
01189 $cObj->parentRecordNumber = $this->currentRecordNumber;
01190 $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
01191 $this->lastChanged($row['tstamp']);
01192 $cObj->start($row,$conf['table']);
01193 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01194 $cobjValue .= $tmpValue;
01195 }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
01196 }
01197 }
01198 }
01199 if ($slideCollectReverse) {
01200 $theValue = $cobjValue.$theValue;
01201 } else {
01202 $theValue .= $cobjValue;
01203 }
01204 if ($slideCollect>0) {
01205 $slideCollect--;
01206 }
01207 if ($slide) {
01208 if ($slide>0) {
01209 $slide--;
01210 }
01211 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
01212 $again = strlen($conf['select.']['pidInList'])?true:false;
01213 }
01214 } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));
01215 }
01216
01217 $theValue = $this->wrap($theValue,$conf['wrap']);
01218 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01219
01220 $GLOBALS['TSFE']->currentRecord = $originalRec;
01221 return $theValue;
01222 }
01223
01231 function RECORDS($conf) {
01232 $theValue='';
01233
01234 $originalRec = $GLOBALS['TSFE']->currentRecord;
01235 if ($originalRec) {
01236 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01237 }
01238
01239 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
01240 if ($conf['tables'] && $conf['source']) {
01241 $allowedTables = $conf['tables'];
01242 if (is_array($conf['conf.'])) {
01243 reset($conf['conf.']);
01244 while(list($k)=each($conf['conf.'])) {
01245 if (substr($k,-1)!='.') $allowedTables.=','.$k;
01246 }
01247 }
01248
01249 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
01250 $loadDB->start($conf['source'], $allowedTables);
01251 reset($loadDB->tableArray);
01252 while(list($table,)=each($loadDB->tableArray)) {
01253 if (is_array($GLOBALS['TCA'][$table])) {
01254 $loadDB->additionalWhere[$table]=$this->enableFields($table);
01255 }
01256 }
01257 $loadDB->getFromDB();
01258
01259 reset($loadDB->itemArray);
01260 $data = $loadDB->results;
01261
01262 $cObj =t3lib_div::makeInstance('tslib_cObj');
01263 $cObj->setParent($this->data,$this->currentRecord);
01264 $this->currentRecordNumber=0;
01265 $this->currentRecordTotal = count($loadDB->itemArray);
01266 reset($loadDB->itemArray);
01267 while(list(,$val)=each($loadDB->itemArray)) {
01268 $row = $data[$val['table']][$val['id']];
01269
01270
01271 $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
01272
01273
01274 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01275 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01276 }
01277
01278 if (is_array($row)) {
01279 if (!$conf['dontCheckPid']) {
01280 $row = $this->checkPid($row['pid']) ? $row : '';
01281 }
01282 if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) {
01283 $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
01284 $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
01285 $renderObjConf = $conf['conf.'][$val['table'].'.'];
01286 $this->currentRecordNumber++;
01287 $cObj->parentRecordNumber=$this->currentRecordNumber;
01288 $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
01289 $this->lastChanged($row['tstamp']);
01290 $cObj->start($row,$val['table']);
01291 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01292 $theValue .= $tmpValue;
01293 }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
01294 }
01295 }
01296 }
01297 if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']);
01298 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01299
01300 $GLOBALS['TSFE']->currentRecord = $originalRec;
01301 return $theValue;
01302 }
01303
01311 function HMENU($conf) {
01312 $content='';
01313 if ($this->checkIf($conf['if.'])) {
01314 $cls = strtolower($conf[1]);
01315 if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses,$cls)) {
01316 if ($conf['special.']['value.']) {
01317 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
01318 }
01319 $GLOBALS['TSFE']->register['count_HMENU']++;
01320 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']=0;
01321 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
01322 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']=array();
01323
01324 $menu = t3lib_div::makeInstance('tslib_'.$cls);
01325 $menu->parent_cObj = $this;
01326 $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1);
01327 $menu->makeMenu();
01328 $content.=$menu->writeMenu();
01329 }
01330 if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']);
01331 if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']);
01332 }
01333 return $content;
01334 }
01335
01343 function CTABLE ($conf) {
01344 $controlTable = t3lib_div::makeInstance('tslib_controlTable');
01345 if ($conf['tableParams']) {
01346 $controlTable->tableParams = $conf['tableParams'];
01347 }
01348
01349 $controlTable->contentW = $conf['cWidth'];
01350
01351 if (is_array($conf['c.'])) {
01352 $controlTable->content = $this->cObjGet($conf['c.'],'c.');
01353 $controlTable->contentTDparams = isset($conf['c.']['TDParams']) ? $conf['c.']['TDParams'] : 'valign="top"';
01354 }
01355 if (is_array($conf['lm.'])) {
01356 $controlTable->lm = $this->cObjGet($conf['lm.'],'lm.');
01357 $controlTable->lmTDparams = isset($conf['lm.']['TDParams']) ? $conf['lm.']['TDParams'] : 'valign="top"';
01358 }
01359 if (is_array($conf['tm.'])) {
01360 $controlTable->tm = $this->cObjGet($conf['tm.'],'tm.');
01361 $controlTable->tmTDparams = isset($conf['tm.']['TDParams']) ? $conf['tm.']['TDParams'] : 'valign="top"';
01362 }
01363 if (is_array($conf['rm.'])) {
01364 $controlTable->rm = $this->cObjGet($conf['rm.'],'rm.');
01365 $controlTable->rmTDparams = isset($conf['rm.']['TDParams']) ? $conf['rm.']['TDParams'] : 'valign="top"';
01366 }
01367 if (is_array($conf['bm.'])) {
01368 $controlTable->bm = $this->cObjGet($conf['bm.'],'bm.');
01369 $controlTable->bmTDparams = isset($conf['bm.']['TDParams']) ? $conf['bm.']['TDParams'] : 'valign="top"';
01370 }
01371 return $controlTable->start($conf['offset'],$conf['cMargins']);
01372 }
01373
01381 function OTABLE ($conf) {
01382 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
01383 if ($conf['tableParams']) {
01384 $controlTable->tableParams = $conf['tableParams'];