'top-center', // 'textpic-above-centre', '1' => 'top-right', // 'textpic-above-right', '2' => 'top-left', // 'textpic-above-left', '8' => 'bottom-center', // 'textpic-below-centre', '9' => 'bottom-right', // 'textpic-below-right', '10' => 'bottom-left', // 'textpic-below-left', '17' => 'right-intext', // 'textpic-intext-right', '18' => 'left-intext', // 'textpic-intext-left', '25' => 'right-outtext', // 'textpic-intext-right-nowrap', '26' => 'left-outtext', // 'textpic-intext-left-nowrap' ); var $aligns = array( 'center' => 'caption-center', 'right' => 'caption-right', 'left' => 'caption-left', ); function imageText($conf) { extract($conf); $this->cObj->data['imagecaption_position']; // has to be put into caption class foreach($imgsTag as $key => $imgTag) { $images .= $imgTag; if($captionArray[$key]) { $images .= '

'.$captionArray[$key].'

'; } } $images = '
'.$images.'
'; if ($position == 26) $content = '
'.$content.'
'; else if ($position == 25) $content = '
'.$content.'
'; else $content = '
'.$content.'
'; $class = 'content '; switch ($position) { case 0: // textpic-above-centre $output = '
'.$images.$content.'
'; break; case 8: // textpic-below-centre $output = '
'.$content.$images.'
'; break; case 1: // textpic-above-right case 2: // textpic-above-left $output = '
'.$images.$content.'
'; break; case 9: //textpic-below-right case 10: // textpic-below-left $output = '
'.$content.$images.'
'; break; case 17: // textpic-intext-right case 18: // textpic-intext-left case 25: // textpic-intext-right-nowrap case 26: // textpic-intext-left-nowrap $output = '
'.$images.$content.'
'; break; } return $output; } /** * Rendering the IMGTEXT content element, called from TypoScript (tt_content.textpic.20) * * @param string Content input. Not used, ignore. * @param array TypoScript configuration. See TSRef "IMGTEXT". This function aims to be compatible. * @return string HTML output. * @access private */ function render_textpic($content,$conf) { if (is_array($conf['text.'])) { $content.= $this->cObj->stdWrap($this->cObj->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content } $imgList=trim($this->cObj->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images if ($imgList) { $imgs = explode(',',$imgList); $imgStart = intval($this->cObj->stdWrap($conf['imgStart'],$conf['imgStart.'])); $imgCount= count($imgs)-$imgStart; $imgMax = intval($this->cObj->stdWrap($conf['imgMax'],$conf['imgMax.'])); if ($imgMax) { $imgCount = t3lib_div::intInRange($imgCount,0,$conf['imgMax']); // reduces the number of images. } $imgPath = $this->cObj->stdWrap($conf['imgPath'],$conf['imgPath.']); // initialisation $caption=''; if (is_array($conf['caption.'])) { $caption= $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); } $captionArray=array(); if ($conf['captionSplit']) { $capSplit = $this->cObj->stdWrap($conf['captionSplit.']['token'],$conf['captionSplit.']['token.']); if (!$capSplit) {$capSplit=chr(10);} $caption2= $this->cObj->cObjGetSingle($conf['captionSplit.']['cObject'],$conf['captionSplit.']['cObject.'],'captionSplit.cObject'); $captionArray=explode($capSplit,$caption2); while(list($ca_key,$ca_val)=each($captionArray)) { $captionArray[$ca_key] = $this->cObj->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']); } } $tablecode=''; $position=$this->cObj->stdWrap($conf['textPos'],$conf['textPos.']); $tmppos = $position&7; $contentPosition = $position&24; $align = $this->cObj->align[$tmppos]; $cap = ($caption)?1:0; $txtMarg = intval($this->cObj->stdWrap($conf['textMargin'],$conf['textMargin.'])); if (!$conf['textMargin_outOfText'] && $contentPosition<16) { $txtMarg=0; } $cols = intval($this->cObj->stdWrap($conf['cols'],$conf['cols.'])); $rows = intval($this->cObj->stdWrap($conf['rows'],$conf['rows.'])); $colspacing = intval($this->cObj->stdWrap($conf['colSpace'],$conf['colSpace.'])); $rowspacing = intval($this->cObj->stdWrap($conf['rowSpace'],$conf['rowSpace.'])); $border = intval($this->cObj->stdWrap($conf['border'],$conf['border.'])) ? 1:0; $borderColor = $this->cObj->stdWrap($conf['borderCol'],$conf['borderCol.']); $borderThickness = intval($this->cObj->stdWrap($conf['borderThick'],$conf['borderThick.'])); $borderColor=$borderColor?$borderColor:'black'; $borderThickness=$borderThickness?$borderThickness:1; $caption_align = $this->cObj->stdWrap($conf['captionAlign'],$conf['captionAlign.']); if (!$caption_align) { $caption_align = $align; } // generate cols $colCount = ($cols > 1) ? $cols : 1; if ($colCount > $imgCount) {$colCount = $imgCount;} $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount; // generate rows if ($rows>1) { $rowCount = $rows; if ($rowCount > $imgCount) {$rowCount = $imgCount;} $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount; } // max Width $colRelations = trim($this->cObj->stdWrap($conf['colRelations'],$conf['colRelations.'])); $maxW = intval($this->cObj->stdWrap($conf['maxW'],$conf['maxW.'])); $maxWInText = intval($this->cObj->stdWrap($conf['maxWInText'],$conf['maxWInText.'])); if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 70 % of the max... $maxWInText = round($maxW/100*50); } if ($maxWInText && $contentPosition>=16) { // inText $maxW = $maxWInText; } if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount); } // create the relation between rows $colMaxW = Array(); if ($colRelations) { $rel_parts = explode(':',$colRelations); $rel_total = 0; for ($a=0;$a<$colCount;$a++) { $rel_parts[$a] = intval($rel_parts[$a]); $rel_total+= $rel_parts[$a]; } if ($rel_total) { for ($a=0;$a<$colCount;$a++) { $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]); } if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) { // The difference in size between the largest and smalles must be within a factor of ten. $colMaxW = Array(); } } } $image_compression = intval($this->cObj->stdWrap($conf['image_compression'],$conf['image_compression.'])); $image_effects = intval($this->cObj->stdWrap($conf['image_effects'],$conf['image_effects.'])); $image_frames = intval($this->cObj->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.'])); // fetches pictures $splitArr=array(); $splitArr['imgObjNum']=$conf['imgObjNum']; $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount); /*$alttext = $this->cObj->stdWrap($conf['altText'],$conf['altText.']); if ($alttext) { $altP = ' alt="'.htmlspecialchars(strip_tags($alttext)).'"'; }*/ // EqualHeight $equalHeight = intval($this->cObj->stdWrap($conf['equalH'],$conf['equalH.'])); if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder'); $gifCreator->init(); $relations = Array(); $relations_cols = Array(); $totalMaxW = $maxW*$colCount; for($a=0;$a<$imgCount;$a++) { $imgKey = $a+$imgStart; $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]); $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error. $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration. } } } $imageRowsFinalWidths = Array(); // contains the width of every image row $imageRowsMaxHeights = Array(); $imgsTag=array(); $origImages=array(); for($a=0;$a<$imgCount;$a++) { $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a; $imgKey = $a+$imgStart; $totalImagePath = $imgPath.$imgs[$imgKey]; $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath; $imgObjNum = intval($splitArr[$a]['imgObjNum']); $imgConf = $conf[$imgObjNum.'.']; if ($equalHeight) { $scale = 1; if ($totalMaxW) { $rowTotalMaxW = $relations_cols[floor($a/$colCount)]; if ($rowTotalMaxW > $totalMaxW) { $scale = $rowTotalMaxW / $totalMaxW; } } // transfer info to the imageObject. Please note, that $imgConf['file.']['height'] = round($equalHeight/$scale); unset($imgConf['file.']['width']); unset($imgConf['file.']['maxW']); unset($imgConf['file.']['maxH']); unset($imgConf['file.']['minW']); unset($imgConf['file.']['minH']); unset($imgConf['file.']['width.']); unset($imgConf['file.']['maxW.']); unset($imgConf['file.']['maxH.']); unset($imgConf['file.']['minW.']); unset($imgConf['file.']['minH.']); $maxW = 0; // setting this to zero, so that it doesn't disturb } if ($maxW) { if (count($colMaxW)) { $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)]; } else { $imgConf['file.']['maxW'] = $maxW; } } if ($imgConf || $imgConf['file']) { $imgConf['params'].=$altP; if ($this->cObj->image_effects[$image_effects]) { $imgConf['file.']['params'].= ' '.$this->cObj->image_effects[$image_effects]; } if ($image_frames) { if (is_array($conf['image_frames.'][$image_frames.'.'])) { $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.']; } } if ($image_compression && $imgConf['file']!='GIFBUILDER') { if ($image_compression==1) { $tempImport = $imgConf['file.']['import']; $tempImport_dot = $imgConf['file.']['import.']; unset($imgConf['file.']); $imgConf['file.']['import'] = $tempImport; $imgConf['file.']['import.'] = $tempImport_dot; } elseif (isset($this->cObj->image_compression[$image_compression])) { $imgConf['file.']['params'].= ' '.$this->cObj->image_compression[$image_compression]['params']; $imgConf['file.']['ext'] = $this->cObj->image_compression[$image_compression]['ext']; unset($imgConf['file.']['ext.']); } } $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf); } else { $imgsTag[$imgKey] = $this->cObj->IMAGE(Array('params'=>$altP, 'file'=>$totalImagePath)); // currentValKey !!! } // Store the original filepath $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo; $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0]; if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) { $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1]; } } // calculating the tableWidth: // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth. $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2; // make table for pictures $index=$imgStart; $noRows = $this->cObj->stdWrap($conf['noRows'],$conf['noRows.']); $noCols = $this->cObj->stdWrap($conf['noCols'],$conf['noCols.']); if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time. if ($equalHeight) { $noCols=1; $noRows=0; } $rowCount_temp=1; $colCount_temp=$colCount; if ($noRows) { $rowCount_temp = $rowCount; $rowCount=1; } if ($noCols) { $colCount=1; } // col- and rowspans calculated $colspan = (($colspacing) ? $colCount*2-1 : $colCount); $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap; // put all variables that are needed for the new implementation in one conf array. $output = $this->imageText(compact('captionArray', 'content', 'caption','borderColor', 'borderThickness', 'border', 'txtMarg', 'cap', 'align', 'contentPosition', 'tmppos', 'position', 'captionArray', 'imgPath', 'imgsTag', 'origImages', 'imageRowsFinalWidths', 'imageRowsMaxHeights','tableWidth', 'noCols', 'noRows', 'rowCount', 'colCount', 'rowspan', 'colspan', 'conf', 'colCount_temp', 'rowCount_temp', 'splitArr', 'colRelations', 'maxW', 'caption_align')); } else { $output= $content; } if ($conf['stdWrap.']) { $output = $this->cObj->stdWrap($output, $conf['stdWrap.']); } return $output; } /** * Rendering the IMAGE content element, called from TypoScript (tt_content.image.20) * * @param string Content input. Not used, ignore. * @param array TypoScript configuration. See TSRef "IMAGE". This function aims to be compatible. * @return string HTML output. * @access private */ function render_image($content,$conf) { if (is_array($conf['text.'])) { $content.= $this->cObj->stdWrap($this->cObj->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content } $imgList=trim($this->cObj->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images if ($imgList) { $imgs = explode(',',$imgList); $imgStart = intval($this->cObj->stdWrap($conf['imgStart'],$conf['imgStart.'])); $imgCount= count($imgs)-$imgStart; $imgMax = intval($this->cObj->stdWrap($conf['imgMax'],$conf['imgMax.'])); if ($imgMax) { $imgCount = t3lib_div::intInRange($imgCount,0,$conf['imgMax']); // reduces the number of images. } $imgPath = $this->cObj->stdWrap($conf['imgPath'],$conf['imgPath.']); // initialisation $caption=''; if (is_array($conf['caption.'])) { $caption= $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); } $captionArray=array(); if ($conf['captionSplit']) { $capSplit = $this->cObj->stdWrap($conf['captionSplit.']['token'],$conf['captionSplit.']['token.']); if (!$capSplit) {$capSplit=chr(10);} $caption2= $this->cObj->cObjGetSingle($conf['captionSplit.']['cObject'],$conf['captionSplit.']['cObject.'],'captionSplit.cObject'); $captionArray=explode($capSplit,$caption2); while(list($ca_key,$ca_val)=each($captionArray)) { $captionArray[$ca_key] = $this->cObj->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']); } } $tablecode=''; $position=$this->cObj->stdWrap($conf['textPos'],$conf['textPos.']); $tmppos = $position&7; $contentPosition = $position&24; $align = $this->cObj->align[$tmppos]; $cap = ($caption)?1:0; $txtMarg = intval($this->cObj->stdWrap($conf['textMargin'],$conf['textMargin.'])); if (!$conf['textMargin_outOfText'] && $contentPosition<16) { $txtMarg=0; } $cols = intval($this->cObj->stdWrap($conf['cols'],$conf['cols.'])); $rows = intval($this->cObj->stdWrap($conf['rows'],$conf['rows.'])); $colspacing = intval($this->cObj->stdWrap($conf['colSpace'],$conf['colSpace.'])); $rowspacing = intval($this->cObj->stdWrap($conf['rowSpace'],$conf['rowSpace.'])); $border = intval($this->cObj->stdWrap($conf['border'],$conf['border.'])) ? 1:0; $borderColor = $this->cObj->stdWrap($conf['borderCol'],$conf['borderCol.']); $borderThickness = intval($this->cObj->stdWrap($conf['borderThick'],$conf['borderThick.'])); $borderColor=$borderColor?$borderColor:'black'; $borderThickness=$borderThickness?$borderThickness:1; $caption_align = $this->cObj->stdWrap($conf['captionAlign'],$conf['captionAlign.']); if (!$caption_align) { $caption_align = $align; } // generate cols $colCount = ($cols > 1) ? $cols : 1; if ($colCount > $imgCount) {$colCount = $imgCount;} $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount; // generate rows if ($rows>1) { $rowCount = $rows; if ($rowCount > $imgCount) {$rowCount = $imgCount;} $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount; } // max Width $colRelations = trim($this->cObj->stdWrap($conf['colRelations'],$conf['colRelations.'])); $maxW = intval($this->cObj->stdWrap($conf['maxW'],$conf['maxW.'])); $maxWInText = intval($this->cObj->stdWrap($conf['maxWInText'],$conf['maxWInText.'])); if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 70 % of the max... $maxWInText = round($maxW/100*50); } if ($maxWInText && $contentPosition>=16) { // inText $maxW = $maxWInText; } if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount); } // create the relation between rows $colMaxW = Array(); if ($colRelations) { $rel_parts = explode(':',$colRelations); $rel_total = 0; for ($a=0;$a<$colCount;$a++) { $rel_parts[$a] = intval($rel_parts[$a]); $rel_total+= $rel_parts[$a]; } if ($rel_total) { for ($a=0;$a<$colCount;$a++) { $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]); } if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) { // The difference in size between the largest and smalles must be within a factor of ten. $colMaxW = Array(); } } } $image_compression = intval($this->cObj->stdWrap($conf['image_compression'],$conf['image_compression.'])); $image_effects = intval($this->cObj->stdWrap($conf['image_effects'],$conf['image_effects.'])); $image_frames = intval($this->cObj->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.'])); // fetches pictures $splitArr=array(); $splitArr['imgObjNum']=$conf['imgObjNum']; $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount); /*$alttext = $this->cObj->stdWrap($conf['altText'],$conf['altText.']); if ($alttext) { $altP = ' alt="'.htmlspecialchars(strip_tags($alttext)).'"'; }*/ // EqualHeight $equalHeight = intval($this->cObj->stdWrap($conf['equalH'],$conf['equalH.'])); if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder'); $gifCreator->init(); $relations = Array(); $relations_cols = Array(); $totalMaxW = $maxW*$colCount; for($a=0;$a<$imgCount;$a++) { $imgKey = $a+$imgStart; $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]); $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error. $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration. } } } $imageRowsFinalWidths = Array(); // contains the width of every image row $imageRowsMaxHeights = Array(); $imgsTag=array(); $origImages=array(); for($a=0;$a<$imgCount;$a++) { $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a; $imgKey = $a+$imgStart; $totalImagePath = $imgPath.$imgs[$imgKey]; $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath; $imgObjNum = intval($splitArr[$a]['imgObjNum']); $imgConf = $conf[$imgObjNum.'.']; if ($equalHeight) { $scale = 1; if ($totalMaxW) { $rowTotalMaxW = $relations_cols[floor($a/$colCount)]; if ($rowTotalMaxW > $totalMaxW) { $scale = $rowTotalMaxW / $totalMaxW; } } // transfer info to the imageObject. Please note, that $imgConf['file.']['height'] = round($equalHeight/$scale); unset($imgConf['file.']['width']); unset($imgConf['file.']['maxW']); unset($imgConf['file.']['maxH']); unset($imgConf['file.']['minW']); unset($imgConf['file.']['minH']); unset($imgConf['file.']['width.']); unset($imgConf['file.']['maxW.']); unset($imgConf['file.']['maxH.']); unset($imgConf['file.']['minW.']); unset($imgConf['file.']['minH.']); $maxW = 0; // setting this to zero, so that it doesn't disturb } if ($maxW) { if (count($colMaxW)) { $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)]; } else { $imgConf['file.']['maxW'] = $maxW; } } if ($imgConf || $imgConf['file']) { $imgConf['params'].=$altP; if ($this->cObj->image_effects[$image_effects]) { $imgConf['file.']['params'].= ' '.$this->cObj->image_effects[$image_effects]; } if ($image_frames) { if (is_array($conf['image_frames.'][$image_frames.'.'])) { $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.']; } } if ($image_compression && $imgConf['file']!='GIFBUILDER') { if ($image_compression==1) { $tempImport = $imgConf['file.']['import']; $tempImport_dot = $imgConf['file.']['import.']; unset($imgConf['file.']); $imgConf['file.']['import'] = $tempImport; $imgConf['file.']['import.'] = $tempImport_dot; } elseif (isset($this->cObj->image_compression[$image_compression])) { $imgConf['file.']['params'].= ' '.$this->cObj->image_compression[$image_compression]['params']; $imgConf['file.']['ext'] = $this->cObj->image_compression[$image_compression]['ext']; unset($imgConf['file.']['ext.']); } } $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf); } else { $imgsTag[$imgKey] = $this->cObj->IMAGE(Array('params'=>$altP, 'file'=>$totalImagePath)); // currentValKey !!! } // Store the original filepath $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo; $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0]; if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) { $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1]; } } // calculating the tableWidth: // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth. $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2; // make table for pictures $index=$imgStart; $noRows = $this->cObj->stdWrap($conf['noRows'],$conf['noRows.']); $noCols = $this->cObj->stdWrap($conf['noCols'],$conf['noCols.']); if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time. if ($equalHeight) { $noCols=1; $noRows=0; } $rowCount_temp=1; $colCount_temp=$colCount; if ($noRows) { $rowCount_temp = $rowCount; $rowCount=1; } if ($noCols) { $colCount=1; } // col- and rowspans calculated $colspan = (($colspacing) ? $colCount*2-1 : $colCount); $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap; // put all variables that are needed for the new implementation in one conf array. $output = $this->imageTable(compact('captionArray', 'content', 'caption','borderColor', 'borderThickness', 'border', 'txtMarg', 'cap', 'align', 'contentPosition', 'tmppos', 'position', 'captionArray', 'imgPath', 'imgsTag', 'origImages', 'imageRowsFinalWidths', 'imageRowsMaxHeights','tableWidth', 'noCols', 'noRows', 'rowCount', 'colCount', 'rowspan', 'colspan', 'conf', 'colCount_temp', 'rowCount_temp', 'splitArr', 'colRelations', 'maxW', 'caption_align')); } else { $output= $content; } if ($conf['stdWrap.']) { $output = $this->cObj->stdWrap($output, $conf['stdWrap.']); } return $output; } function imageTable($conf) { //debug($conf, 'testname', __LINE__, __FILE__); extract($conf); // Edit icons: $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->cObj->editIcons('',$conf['editIcons'],$conf['editIcons.']) : ''; // strech out table: $tablecode=''; /* $flag=0; if ($conf['noStretchAndMarginCells']!=1) { $tablecode.=''; if ($txtMarg && $align=='right') { // If right aligned, the textborder is added on the right side $tablecode.=''.($editIconsHTML?'
'.$editIconsHTML:'').''; $editIconsHTML=''; $flag=1; } if ($txtMarg && $align=='left') { // If left aligned, the textborder is added on the left side $tablecode.=''.($editIconsHTML?'
'.$editIconsHTML:'').''; $editIconsHTML=''; $flag=1; } if ($flag) $tableWidth+=$txtMarg+1; // $tableWidth=0; $tablecode.=''; }*/ // draw table for ($c=0;$c<$rowCount;$c++) { // Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows! $tablecode.=''; // starting row for ($b=0; $b<$colCount_temp; $b++) { // Looping through the columns if ($b && $colspacing) { // If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell. if (!$noCols) { } else { $colSpacer=''.$colSpacer.''; // added 160301, needed for the new "noCols"-table... $tablecode.=$colSpacer; } } if (!$noCols || ($noCols && !$b)) { $tablecode.=''; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image. if ($noCols) {$tablecode.='';} // In case of "noCols" we must set the table-tag that surrounds the images in the row. } for ($a=0;$a<$rowCount_temp;$a++) { // Looping through the rows IF "noRows" is set. "noRows" means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set. $imgIndex = $index+$a*$colCount_temp; if ($imgsTag[$imgIndex]) { if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop $tablecode.= ''; } $imageHTML = $imgsTag[$imgIndex]; $Talign = (!trim($captionArray[$imgIndex]) && !$noRows && !$conf['netprintApplicationLink']) ? ' align="left"' : ''; // this is necessary if the tablerows are supposed to space properly together! "noRows" is excluded because else the images "layer" together. if ($border) {$imageHTML='
'.$imageHTML.'
';} // break-tag added 160301 , ($noRows?'':' align="left"') removed 160301, break tag removed 160301 (later...) $imageHTML.=$editIconsHTML; $editIconsHTML=''; if ($conf['netprintApplicationLink']) {$imageHTML = $this->cObj->netprintApplication_offsiteLinkWrap($imageHTML,$origImages[$imgIndex],$conf['netprintApplicationLink.']);} $imageHTML.=$captionArray[$imgIndex]; // Adds caption. if ($noCols) {$imageHTML=''.$imageHTML.'';} // If noCols, put in table cell. $tablecode.=$imageHTML; } } $index++; if (!$noCols || ($noCols && $b+1==$colCount_temp)) { if ($noCols) {$tablecode.='';} // In case of "noCols" we must finish the table that surrounds the images in the row. $tablecode.=''; // Ending the cell. In case of "noCols" the cell holds all pictures! } } $tablecode.=''; // ending row } if ($c) { // Table-tag is inserted $i=$contentPosition; $table_align = (($i==16) ? 'align="'.$align.'"' : ''); $tablecode = '
'.$tablecode; if ($editIconsHTML) { // IF this value is not long since reset. $tablecode.=''.$editIconsHTML.''; $editIconsHTML=''; } if ($cap) { $tablecode.=''.$caption.''; } $tablecode.='
'; if ($conf['tableStdWrap.']) {$tablecode=$this->cObj->stdWrap($tablecode,$conf['tableStdWrap.']);} } $spaceBelowAbove = intval($this->cObj->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.'])); /* switch ($contentPosition) { case '0': // above $output= $tablecode; break; case '8': // below $output= $tablecode; break; case '16': // in text $output= $tablecode; break; case '24': // in text, no wrap $theResult = ''; $theResult.= ''; if ($align=='right') { $theResult.= ''; } else { $theResult.= ''; } $theResult.= '
'.$content.''.$tablecode.''.$tablecode.''.$content.'
'; $output= $theResult; break; } return $output;*/ return $tablecode; } /** * Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20) * * @param string Content input. Not used, ignore. * @param array TypoScript configuration * @return string HTML output. * @access private */ function render_uploads($content,$conf) { $out = ''; // Set layout type: $type = intval($this->cObj->data['layout']); $type = 1; // override setting. (MN) // Get the list of files (using stdWrap function since that is easiest) $lConf=array(); $lConf['override.']['filelist.']['field'] = 'select_key'; $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf); // Explode into an array: $fileArray = t3lib_div::trimExplode(',',$fileList,1); // If there were files to list...: if (count($fileArray)) { // Get the path from which the images came: $selectKeyValues = explode('|',$this->cObj->data['select_key']); $path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/'; // Get the descriptions for the files (if any): $descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']); // Adding hardcoded TS to linkProc configuration: $conf['linkProc.']['path.']['current'] = 1; $conf['linkProc.']['icon'] = 1; // Always render icon - is inserted by PHP if needed. $conf['linkProc.']['icon.']['wrap'] = ' | //**//'; // Temporary, internal split-token! $conf['linkProc.']['icon_link'] = 1; // ALways link the icon $conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : ''; // If the layout is type 2 or 3 we will render an image based icon if possible. // Traverse the files found: $filesData = array(); foreach($fileArray as $key => $fileName) { $absPath = t3lib_div::getFileAbsFileName($path.$fileName); if (@is_file($absPath)) { $fI = pathinfo($fileName); $filesData[$key] = array(); $filesData[$key]['filename'] = $fileName; $filesData[$key]['path'] = $path; $filesData[$key]['filesize'] = filesize($absPath); $filesData[$key]['fileextension'] = strtolower($fI['extension']); $filesData[$key]['description'] = trim($descriptions[$key]); $this->cObj->setCurrentVal($path); $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName; $filesData[$key]['linkedFilenameParts'] = explode('//**//',$this->cObj->filelink($fileName, $conf['linkProc.'])); } } // Now, lets render the list! $tRows = array(); foreach($filesData as $key => $fileD) { // Setting class of table row for odd/even rows: $oddEven = $key%2 ? 'tr-odd' : 'tr-even'; // Render row, based on the "layout" setting $tRows[]='
'.$fileD['linkedFilenameParts'][0].' '.$fileD['linkedFilenameParts'][1].'
'.htmlspecialchars($fileD['description']). ', ' . t3lib_div::formatSize($fileD['filesize']).'
'; } // Table tag params. /* $tableTagParams = $this->getTableAttributes($conf,$type); $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;*/ // Compile it all into table tags: $out = '
'.implode('',$tRows).'
'; } // Calling stdWrap: if ($conf['stdWrap.']) { $out = $this->cObj->stdWrap($out, $conf['stdWrap.']); } // Return value return $out; } } ?>