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
00056 require_once(PATH_tslib.'class.tslib_pibase.php');
00057
00058
00059
00068 class tx_cssstyledcontent_pi1 extends tslib_pibase {
00069
00070
00071 var $prefixId = 'tx_cssstyledcontent_pi1';
00072 var $scriptRelPath = 'pi1/class.tx_cssstyledcontent_pi1.php';
00073 var $extKey = 'css_styled_content';
00074 var $conf = array();
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00096 function render_bullets($content,$conf) {
00097
00098
00099 if ($hookObj = &$this->hookRequest('render_bullets')) {
00100 return $hookObj->render_bullets($content,$conf);
00101 } else {
00102
00103
00104 $content = trim($this->cObj->data['bodytext']);
00105 if (!strcmp($content,'')) return '';
00106
00107
00108 $lines = t3lib_div::trimExplode(chr(10),$content);
00109 while(list($k)=each($lines)) {
00110 $lines[$k]='
00111 <li>'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'</li>';
00112 }
00113
00114
00115 $type = intval($this->cObj->data['layout']);
00116
00117
00118 $out = '
00119 <ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
00120 implode('',$lines).'
00121 </ul>';
00122
00123
00124 if ($conf['stdWrap.']) {
00125 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00126 }
00127
00128
00129 return $out;
00130 }
00131 }
00132
00141 function render_table($content,$conf) {
00142
00143
00144 if ($hookObj = &$this->hookRequest('render_table')) {
00145 return $hookObj->render_table($content,$conf);
00146 } else {
00147
00148 $this->pi_initPIflexForm();
00149
00150
00151 $content = trim($this->cObj->data['bodytext']);
00152 if (!strcmp($content,'')) return '';
00153
00154
00155 $caption = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_caption')));
00156 $summary = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_summary')));
00157 $useTfoot = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tfoot'));
00158 $headerPos = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_headerpos');
00159 $noStyles = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_nostyles');
00160 $tableClass = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tableclass');
00161
00162 $delimiter = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_delimiter','s_parsing'));
00163 if ($delimiter) {
00164 $delimiter = chr(intval($delimiter));
00165 } else {
00166 $delimiter = '|';
00167 }
00168 $quotedInput = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_quote','s_parsing'));
00169 if ($quotedInput) {
00170 $quotedInput = chr(intval($quotedInput));
00171 } else {
00172 $quotedInput = '';
00173 }
00174
00175
00176 $headerScope = ($headerPos=='top'?'col':'row');
00177 $headerIdPrefix = $headerScope.$this->cObj->data['uid'].'-';
00178
00179
00180 $rows = t3lib_div::trimExplode(chr(10),$content);
00181
00182
00183 $cols = t3lib_div::intInRange($this->cObj->data['cols']?$this->cObj->data['cols']:count(explode($delimiter,current($rows))),0,100);
00184
00185
00186 $rCount = count($rows);
00187 foreach($rows as $k => $v) {
00188 $cells = explode($delimiter,$v);
00189 $newCells=array();
00190 for($a=0;$a<$cols;$a++) {
00191
00192 if ($quotedInput && substr($cells[$a],0,1) == $quotedInput && substr($cells[$a],-1,1) == $quotedInput) {
00193 $cells[$a] = substr($cells[$a],1,-1);
00194 }
00195
00196 if (!strcmp(trim($cells[$a]),'')) $cells[$a]=' ';
00197 $cellAttribs = ($noStyles?'':($a>0 && ($cols-1)==$a) ? ' class="td-last"' : ' class="td-'.$a.'"');
00198 if (($headerPos == 'top' && !$k) || ($headerPos == 'left' && !$a)) {
00199 $scope = ' scope="'.$headerScope.'"';
00200 $scope .= ' id="'.$headerIdPrefix.(($headerScope=='col')?$a:$k).'"';
00201
00202 $newCells[$a] = '
00203 <th'.$cellAttribs.$scope.'>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</th>';
00204 } else {
00205 if (empty($headerPos)) {
00206 $accessibleHeader = '';
00207 } else {
00208 $accessibleHeader = ' headers="'.$headerIdPrefix.(($headerScope=='col')?$a:$k).'"';
00209 }
00210 $newCells[$a] = '
00211 <td'.$cellAttribs.$accessibleHeader.'>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</td>';
00212 }
00213 }
00214 if (!$noStyles) {
00215 $oddEven = $k%2 ? 'tr-odd' : 'tr-even';
00216 $rowAttribs = ($k>0 && ($rCount-1)==$k) ? ' class="'.$oddEven.' tr-last"' : ' class="'.$oddEven.' tr-'.$k.'"';
00217 }
00218 $rows[$k]='
00219 <tr'.$rowAttribs.'>'.implode('',$newCells).'
00220 </tr>';
00221 }
00222
00223 $addTbody = 0;
00224 $tableContents = '';
00225 if ($caption) {
00226 $tableContents .= '
00227 <caption>'.$caption.'</caption>';
00228 }
00229 if ($headerPos == 'top' && $rows[0]) {
00230 $tableContents .= '<thead>'. $rows[0] .'
00231 </thead>';
00232 unset($rows[0]);
00233 $addTbody = 1;
00234 }
00235 if ($useTfoot) {
00236 $tableContents .= '
00237 <tfoot>'.$rows[$rCount-1].'</tfoot>';
00238 unset($rows[$rCount-1]);
00239 $addTbody = 1;
00240 }
00241 $tmpTable = implode('',$rows);
00242 if ($addTbody) {
00243 $tmpTable = '<tbody>'.$tmpTable.'</tbody>';
00244 }
00245 $tableContents .= $tmpTable;
00246
00247
00248 $type = intval($this->cObj->data['layout']);
00249
00250
00251 $tableTagParams = $this->getTableAttributes($conf,$type);
00252 if (!$noStyles) {
00253 $tableTagParams['class'] = 'contenttable contenttable-'.$type.($tableClass?' '.$tableClass:'');
00254 } elseif ($tableClass) {
00255 $tableTagParams['class'] = $tableClass;
00256 }
00257
00258
00259
00260 $out = '
00261 <table '.t3lib_div::implodeAttributes($tableTagParams).($summary?' summary="'.$summary.'"':'').'>'.
00262 $tableContents.'
00263 </table>';
00264
00265
00266 if ($conf['stdWrap.']) {
00267 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00268 }
00269
00270
00271 return $out;
00272 }
00273 }
00274
00283 function render_uploads($content,$conf) {
00284
00285
00286 if ($hookObj = &$this->hookRequest('render_uploads')) {
00287 return $hookObj->render_uploads($content,$conf);
00288 } else {
00289
00290 $out = '';
00291
00292
00293 $type = intval($this->cObj->data['layout']);
00294
00295
00296 $lConf = array();
00297 $lConf['override.']['filelist.']['field'] = 'select_key';
00298 $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);
00299
00300
00301 $fileArray = t3lib_div::trimExplode(',',$fileList,1);
00302
00303
00304 if (count($fileArray)) {
00305
00306
00307 $selectKeyValues = explode('|',$this->cObj->data['select_key']);
00308 $path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/';
00309
00310
00311 $descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']);
00312
00313
00314 $conf['linkProc.']['path.']['current'] = 1;
00315 $conf['linkProc.']['icon'] = 1;
00316 $conf['linkProc.']['icon.']['wrap'] = ' |
00317 $conf['linkProc.']['icon_link'] = 1;
00318 $conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';
00319
00320
00321 $filesData = array();
00322 foreach($fileArray as $key => $fileName) {
00323 $absPath = t3lib_div::getFileAbsFileName($path.$fileName);
00324 if (@is_file($absPath)) {
00325 $fI = pathinfo($fileName);
00326 $filesData[$key] = array();
00327
00328 $filesData[$key]['filename'] = $fileName;
00329 $filesData[$key]['path'] = $path;
00330 $filesData[$key]['filesize'] = filesize($absPath);
00331 $filesData[$key]['fileextension'] = strtolower($fI['extension']);
00332 $filesData[$key]['description'] = trim($descriptions[$key]);
00333
00334 $this->cObj->setCurrentVal($path);
00335 $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
00336 $filesData[$key]['linkedFilenameParts'] = explode('
00337 }
00338 }
00339
00340
00341 $tRows = array();
00342 foreach($filesData as $key => $fileD) {
00343
00344
00345 $oddEven = $key%2 ? 'tr-odd' : 'tr-even';
00346
00347
00348 $tRows[]='
00349 <tr class="'.$oddEven.'">'.($type>0 ? '
00350 <td class="csc-uploads-icon">
00351 '.$fileD['linkedFilenameParts'][0].'
00352 </td>' : '').'
00353 <td class="csc-uploads-fileName">
00354 <p>'.$fileD['linkedFilenameParts'][1].'</p>'.
00355 ($fileD['description'] ? '
00356 <p class="csc-uploads-description">'.htmlspecialchars($fileD['description']).'</p>' : '').'
00357 </td>'.($this->cObj->data['filelink_size'] ? '
00358 <td class="csc-uploads-fileSize">
00359 <p>'.t3lib_div::formatSize($fileD['filesize']).'</p>
00360 </td>' : '').'
00361 </tr>';
00362 }
00363
00364
00365 $tableTagParams = $this->getTableAttributes($conf,$type);
00366 $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
00367
00368
00369
00370 $out = '
00371 <table '.t3lib_div::implodeAttributes($tableTagParams).'>
00372 '.implode('',$tRows).'
00373 </table>';
00374 }
00375
00376
00377 if ($conf['stdWrap.']) {
00378 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00379 }
00380
00381
00382 return $out;
00383 }
00384 }
00385
00395 function render_textpic($content, $conf) {
00396
00397 if (method_exists($this, 'hookRequest') && $hookObj = &$this->hookRequest('render_textpic')) {
00398 return $hookObj->render_textpic($content,$conf);
00399 }
00400
00401 $renderMethod = $this->cObj->stdWrap($conf['renderMethod'], $conf['renderMethod.']);
00402
00403
00404 if (!$renderMethod || $renderMethod == 'table') {
00405 return $this->cObj->IMGTEXT($conf);
00406 }
00407
00408
00409 if (is_array($conf['rendering.'][$renderMethod . '.'])) {
00410 $conf = $this->cObj->joinTSarrays($conf, $conf['rendering.'][$renderMethod . '.']);
00411 }
00412
00413
00414 if (is_array($conf['text.'])) {
00415 $content = $this->cObj->stdWrap($this->cObj->cObjGet($conf['text.'], 'text.'), $conf['text.']);
00416 }
00417
00418 $imgList = trim($this->cObj->stdWrap($conf['imgList'], $conf['imgList.']));
00419
00420 if (!$imgList) {
00421
00422 if (is_array($conf['stdWrap.'])) {
00423 return $this->cObj->stdWrap($content, $conf['stdWrap.']);
00424 }
00425 return $content;
00426 }
00427
00428 $imgs = t3lib_div::trimExplode(',', $imgList);
00429 $imgStart = intval($this->cObj->stdWrap($conf['imgStart'], $conf['imgStart.']));
00430 $imgCount = count($imgs) - $imgStart;
00431 $imgMax = intval($this->cObj->stdWrap($conf['imgMax'], $conf['imgMax.']));
00432 if ($imgMax) {
00433 $imgCount = t3lib_div::intInRange($imgCount, 0, $conf['imgMax']);
00434 }
00435
00436 $imgPath = $this->cObj->stdWrap($conf['imgPath'], $conf['imgPath.']);
00437
00438
00439 $caption = '';
00440 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
00441 $caption = $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
00442 }
00443
00444
00445 $position = $this->cObj->stdWrap($conf['textPos'], $conf['textPos.']);
00446
00447 $imagePosition = $position&7;
00448 $contentPosition = $position&24;
00449 $align = $this->cObj->align[$imagePosition];
00450 $textMargin = intval($this->cObj->stdWrap($conf['textMargin'],$conf['textMargin.']));
00451 if (!$conf['textMargin_outOfText'] && $contentPosition < 16) {
00452 $textMargin = 0;
00453 }
00454
00455 $colspacing = intval($this->cObj->stdWrap($conf['colSpace'], $conf['colSpace.']));
00456 $rowspacing = intval($this->cObj->stdWrap($conf['rowSpace'], $conf['rowSpace.']));
00457
00458 $border = intval($this->cObj->stdWrap($conf['border'], $conf['border.'])) ? 1:0;
00459 $borderColor = $this->cObj->stdWrap($conf['borderCol'], $conf['borderCol.']);
00460 $borderThickness = intval($this->cObj->stdWrap($conf['borderThick'], $conf['borderThick.']));
00461
00462 $borderColor = $borderColor?$borderColor:'black';
00463 $borderThickness = $borderThickness?$borderThickness:1;
00464 $borderSpace = (($conf['borderSpace']&&$border) ? intval($conf['borderSpace']) : 0);
00465
00466
00467 $cols = intval($this->cObj->stdWrap($conf['cols'],$conf['cols.']));
00468 $colCount = ($cols > 1) ? $cols : 1;
00469 if ($colCount > $imgCount) {$colCount = $imgCount;}
00470 $rowCount = ceil($imgCount / $colCount);
00471
00472
00473 $rows = intval($this->cObj->stdWrap($conf['rows'],$conf['rows.']));
00474 if ($rows>1) {
00475 $rowCount = $rows;
00476 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
00477 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00478 }
00479
00480
00481 $maxW = intval($this->cObj->stdWrap($conf['maxW'], $conf['maxW.']));
00482
00483 if ($contentPosition>=16) {
00484 $maxWInText = intval($this->cObj->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00485 if (!$maxWInText) {
00486
00487 $maxW = round($maxW/100*50);
00488 } else {
00489 $maxW = $maxWInText;
00490 }
00491 }
00492
00493
00494 $defaultColumnWidth = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*($borderThickness+$borderSpace)*2)/$colCount);
00495
00496
00497 $columnWidths = array();
00498 $colRelations = trim($this->cObj->stdWrap($conf['colRelations'],$conf['colRelations.']));
00499 if (!$colRelations) {
00500
00501 for ($a=0;$a<$colCount;$a++) {
00502 $columnWidths[$a] = $defaultColumnWidth;
00503 }
00504 } else {
00505
00506 $rel_parts = explode(':',$colRelations);
00507 $rel_total = 0;
00508 for ($a=0;$a<$colCount;$a++) {
00509 $rel_parts[$a] = intval($rel_parts[$a]);
00510 $rel_total+= $rel_parts[$a];
00511 }
00512 if ($rel_total) {
00513 for ($a=0;$a<$colCount;$a++) {
00514 $columnWidths[$a] = round(($defaultColumnWidth*$colCount)/$rel_total*$rel_parts[$a]);
00515 }
00516 if (min($columnWidths)<=0 || max($rel_parts)/min($rel_parts)>10) {
00517
00518 for ($a=0;$a<$colCount;$a++) {
00519 $columnWidths[$a] = $defaultColumnWidth;
00520 }
00521 }
00522 }
00523 }
00524 $image_compression = intval($this->cObj->stdWrap($conf['image_compression'],$conf['image_compression.']));
00525 $image_effects = intval($this->cObj->stdWrap($conf['image_effects'],$conf['image_effects.']));
00526 $image_frames = intval($this->cObj->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00527
00528
00529 $equalHeight = intval($this->cObj->stdWrap($conf['equalH'],$conf['equalH.']));
00530 if ($equalHeight) {
00531
00532 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00533 $gifCreator->init();
00534 $relations_cols = Array();
00535 for ($a=0; $a<$imgCount; $a++) {
00536 $imgKey = $a+$imgStart;
00537 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00538 $rel = $imgInfo[1] / $equalHeight;
00539 if ($rel) {
00540 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$rel;
00541 }
00542 }
00543 }
00544
00545
00546 $splitArr = array();
00547 $splitArr['imgObjNum'] = $conf['imgObjNum'];
00548 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr, $imgCount);
00549
00550 $imageRowsFinalWidths = Array();
00551 $imgsTag = array();
00552 $origImages = array();
00553 for ($a=0; $a<$imgCount; $a++) {
00554 $imgKey = $a+$imgStart;
00555 $totalImagePath = $imgPath.$imgs[$imgKey];
00556
00557 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
00558 $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $totalImagePath;
00559
00560 $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath;
00561 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00562 $imgConf = $conf[$imgObjNum.'.'];
00563
00564 if ($equalHeight) {
00565 $scale = 1;
00566 $totalMaxW = $defaultColumnWidth*$colCount;
00567 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
00568 if ($rowTotalMaxW > $totalMaxW) {
00569 $scale = $rowTotalMaxW / $totalMaxW;
00570 }
00571
00572
00573 $imgConf['file.']['height'] = round($equalHeight/$scale);
00574
00575
00576 unset($imgConf['file.']['width']);
00577 unset($imgConf['file.']['maxW']);
00578 unset($imgConf['file.']['maxH']);
00579 unset($imgConf['file.']['minW']);
00580 unset($imgConf['file.']['minH']);
00581 unset($imgConf['file.']['width.']);
00582 unset($imgConf['file.']['maxW.']);
00583 unset($imgConf['file.']['maxH.']);
00584 unset($imgConf['file.']['minW.']);
00585 unset($imgConf['file.']['minH.']);
00586 } else {
00587 $imgConf['file.']['maxW'] = $columnWidths[($a%$colCount)];
00588 }
00589
00590 $titleInLink = $this->cObj->stdWrap($imgConf['titleInLink'], $imgConf['titleInLink.']);
00591 $titleInLinkAndImg = $this->cObj->stdWrap($imgConf['titleInLinkAndImg'], $imgConf['titleInLinkAndImg.']);
00592 $oldATagParms = $GLOBALS['TSFE']->ATagParams;
00593 if ($titleInLink) {
00594
00595 $titleText = trim($this->cObj->stdWrap($imgConf['titleText'], $imgConf['titleText.']));
00596 if ($titleText) {
00597
00598 $GLOBALS['TSFE']->ATagParams .= ' title="'. $titleText .'"';
00599 }
00600 }
00601
00602 if ($imgConf || $imgConf['file']) {
00603 if ($this->cObj->image_effects[$image_effects]) {
00604 $imgConf['file.']['params'] .= ' '.$this->cObj->image_effects[$image_effects];
00605 }
00606 if ($image_frames) {
00607 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
00608 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00609 }
00610 }
00611 if ($image_compression && $imgConf['file'] != 'GIFBUILDER') {
00612 if ($image_compression == 1) {
00613 $tempImport = $imgConf['file.']['import'];
00614 $tempImport_dot = $imgConf['file.']['import.'];
00615 unset($imgConf['file.']);
00616 $imgConf['file.']['import'] = $tempImport;
00617 $imgConf['file.']['import.'] = $tempImport_dot;
00618 } elseif (isset($this->cObj->image_compression[$image_compression])) {
00619 $imgConf['file.']['params'] .= ' '.$this->cObj->image_compression[$image_compression]['params'];
00620 $imgConf['file.']['ext'] = $this->cObj->image_compression[$image_compression]['ext'];
00621 unset($imgConf['file.']['ext.']);
00622 }
00623 }
00624 if ($titleInLink && ! $titleInLinkAndImg) {
00625
00626 $link = $this->cObj->imageLinkWrap('', $totalImagePath, $imgConf['imageLinkWrap.']);
00627 if ($link) {
00628
00629 unset($imgConf['titleText']);
00630 unset($imgConf['titleText.']);
00631 $imgConf['emptyTitleHandling'] = 'removeAttr';
00632 }
00633 }
00634 $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf);
00635 } else {
00636 $imgsTag[$imgKey] = $this->cObj->IMAGE(Array('file' => $totalImagePath));
00637 }
00638
00639 $GLOBALS['TSFE']->ATagParams = $oldATagParms;
00640
00641 $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo;
00642
00643 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00644 }
00645
00646 $imageBlockWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*($borderSpace+$borderThickness)*2;
00647 $GLOBALS['TSFE']->register['rowwidth'] = $imageBlockWidth;
00648
00649
00650
00651 $noRows = $this->cObj->stdWrap($conf['noRows'],$conf['noRows.']);
00652 $noCols = $this->cObj->stdWrap($conf['noCols'],$conf['noCols.']);
00653 if ($noRows) {$noCols=0;}
00654
00655 $rowCount_temp = 1;
00656 $colCount_temp = $colCount;
00657 if ($noRows) {
00658 $rowCount_temp = $rowCount;
00659 $rowCount = 1;
00660 }
00661 if ($noCols) {
00662 $colCount = 1;
00663 $columnWidths = array();
00664 }
00665
00666
00667 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->cObj->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
00668
00669
00670 $imageWrapCols = 1;
00671 if ($noRows) { $imageWrapCols = $colCount; }
00672
00673
00674 $separateRows = $this->cObj->stdWrap($conf['separateRows'], $conf['separateRows.']);
00675 if ($noRows) { $separateRows = 0; }
00676 if ($rowCount == 1) { $separateRows = 0; }
00677
00678
00679 $addClassesImage = $conf['addClassesImage'];
00680 if ($conf['addClassesImage.']) {
00681 $addClassesImage = $this->cObj->stdWrap($addClassesImageConf, $conf['addClassesImage.']);
00682 }
00683 $addClassesImageConf = $GLOBALS['TSFE']->tmpl->splitConfArray(array('addClassesImage' => $addClassesImage), $colCount);
00684
00685
00686 $images = '';
00687 for ($c = 0; $c < $imageWrapCols; $c++) {
00688 $tmpColspacing = $colspacing;
00689 if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && $imagePosition==1)) {
00690 $tmpColspacing = 0;
00691 }
00692 $GLOBALS['TSFE']->register['columnwidth'] = $columnWidths[$c] + $tmpColspacing + $border*($borderSpace+$borderThickness)*2;
00693 $thisImages = '';
00694 $allRows = '';
00695 for ($i = $c; $i<count($imgsTag); $i=$i+$imageWrapCols) {
00696 $colPos = $i%$colCount;
00697 if ($separateRows && $colPos == 0) {
00698 $thisRow = '';
00699 }
00700
00701
00702 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $i;
00703 $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $origImages[$i]['origFile'];
00704 $GLOBALS['TSFE']->register['imagewidth'] = $origImages[$i][0];
00705 $GLOBALS['TSFE']->register['imagespace'] = $origImages[$i][0] + $border*($borderSpace+$borderThickness)*2;
00706 $GLOBALS['TSFE']->register['imageheight'] = $origImages[$i][1];
00707
00708 $thisImage = '';
00709 $thisImage .= $this->cObj->stdWrap($imgsTag[$i], $conf['imgTagStdWrap.']);
00710
00711 if ($conf['captionSplit'] || $conf['imageTextSplit']) {
00712 $thisImage .= $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
00713 }
00714 if ($editIconsHTML) {
00715 $thisImage .= $this->cObj->stdWrap($editIconsHTML, $conf['editIconsStdWrap.']);
00716 }
00717 if ($conf['netprintApplicationLink']) {
00718 $thisImage .= $this->cObj->netprintApplication_offsiteLinkWrap($thisImage, $origImages[$i], $conf['netprintApplicationLink.']);
00719 }
00720 $thisImage = $this->cObj->stdWrap($thisImage, $conf['oneImageStdWrap.']);
00721 $classes = '';
00722 if ($addClassesImageConf[$colPos]['addClassesImage']) {
00723 $classes = ' ' . $addClassesImageConf[$colPos]['addClassesImage'];
00724 }
00725 $thisImage = str_replace('###CLASSES###', $classes, $thisImage);
00726
00727 if ($separateRows) {
00728 $thisRow .= $thisImage;
00729 } else {
00730 $allRows .= $thisImage;
00731 }
00732 if ($separateRows && ($colPos == ($colCount-1) || $i+1==count($imgsTag))) {
00733
00734 $allRows .= $this->cObj->stdWrap($thisRow, $conf['imageRowStdWrap.']);
00735 }
00736 }
00737 if ($separateRows) {
00738 $thisImages .= $allRows;
00739 } else {
00740 $thisImages .= $this->cObj->stdWrap($allRows, $conf['noRowsStdWrap.']);
00741 }
00742 if ($noRows) {
00743
00744 $images .= $this->cObj->stdWrap($thisImages, $conf['imageColumnStdWrap.']);
00745 } else {
00746 $images .= $thisImages;
00747 }
00748 }
00749
00750
00751 if ($caption) {
00752 $images .= $caption;
00753 }
00754
00755
00756 $captionClass = '';
00757 $classCaptionAlign = array(
00758 'center' => 'csc-textpic-caption-c',
00759 'right' => 'csc-textpic-caption-r',
00760 'left' => 'csc-textpic-caption-l',
00761 );
00762 $captionAlign = $this->cObj->stdWrap($conf['captionAlign'], $conf['captionAlign.']);
00763 if ($captionAlign) {
00764 $captionClass = $classCaptionAlign[$captionAlign];
00765 }
00766 $borderClass = '';
00767 if ($border) {
00768 $borderClass = 'csc-textpic-border';
00769 }
00770
00771
00772 $class = '';
00773 $class .= ($borderClass? ' '.$borderClass:'');
00774 $class .= ($captionClass? ' '.$captionClass:'');
00775 $class .= ($equalHeight? ' csc-textpic-equalheight':'');
00776 $addClasses = $this->cObj->stdWrap($conf['addClasses'], $conf['addClasses.']);
00777 $class .= ($addClasses ? ' '.$addClasses:'');
00778
00779
00780 $imgWrapWidth = '';
00781 if ($position == 0 || $position == 8) {
00782
00783 $imgWrapWidth = $imageBlockWidth;
00784 }
00785 if ($rowCount > 1) {
00786
00787 $imgWrapWidth = $imageBlockWidth;
00788 }
00789 if ($caption) {
00790
00791 $imgWrapWidth = $imageBlockWidth;
00792 }
00793
00794
00795 $GLOBALS['TSFE']->register['totalwidth'] = $imgWrapWidth;
00796 if ($imgWrapWidth) {
00797 $images = $this->cObj->stdWrap($images, $conf['imageStdWrap.']);
00798 } else {
00799 $images = $this->cObj->stdWrap($images, $conf['imageStdWrapNoWidth.']);
00800 }
00801
00802 $output = $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.']);
00803 $output = str_replace('###TEXT###', $content, $output);
00804 $output = str_replace('###IMAGES###', $images, $output);
00805 $output = str_replace('###CLASSES###', $class, $output);
00806
00807 if ($conf['stdWrap.']) {
00808 $output = $this->cObj->stdWrap($output, $conf['stdWrap.']);
00809 }
00810
00811 return $output;
00812 }
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00838 function getTableAttributes($conf,$type) {
00839
00840
00841 $tableTagParams_conf = $conf['tableParams_'.$type.'.'];
00842
00843 $conf['color.'][200] = '';
00844 $conf['color.'][240] = 'black';
00845 $conf['color.'][241] = 'white';
00846 $conf['color.'][242] = '#333333';
00847 $conf['color.'][243] = 'gray';
00848 $conf['color.'][244] = 'silver';
00849
00850
00851 $tableTagParams = array();
00852 $tableTagParams['border'] = $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border'];
00853 $tableTagParams['cellspacing'] = $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing'];
00854 $tableTagParams['cellpadding'] = $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding'];
00855 $tableTagParams['bgcolor'] = isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default'];
00856
00857
00858 return $tableTagParams;
00859 }
00860
00867 function &hookRequest($functionName) {
00868 global $TYPO3_CONF_VARS;
00869
00870
00871 if ($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]) {
00872 $hookObj = &t3lib_div::getUserObj($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]);
00873 if (method_exists ($hookObj, $functionName)) {
00874 $hookObj->pObj = &$this;
00875 return $hookObj;
00876 }
00877 }
00878 }
00879 }
00880
00881
00882
00883 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']) {
00884 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);
00885 }
00886 ?>