00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00051 require_once(PATH_tslib.'class.tslib_pibase.php');
00052
00053
00054
00063 class tx_cssstyledcontent_pi1 extends tslib_pibase {
00064
00065
00066 var $prefixId = 'tx_cssstyledcontent_pi1';
00067 var $scriptRelPath = 'pi1/class.tx_cssstyledcontent_pi1.php';
00068 var $extKey = 'css_styled_content';
00069 var $conf = array();
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00091 function render_bullets($content,$conf) {
00092
00093
00094 $content = trim($this->cObj->data['bodytext']);
00095 if (!strcmp($content,'')) return '';
00096
00097
00098 $lines = t3lib_div::trimExplode(chr(10),$content);
00099 while(list($k)=each($lines)) {
00100 $lines[$k]='
00101 <li>'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'</li>';
00102 }
00103
00104
00105 $type = intval($this->cObj->data['layout']);
00106
00107
00108 $out = '
00109 <ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
00110 implode('',$lines).'
00111 </ul>';
00112
00113
00114 if ($conf['stdWrap.']) {
00115 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00116 }
00117
00118
00119 return $out;
00120 }
00121
00130 function render_table($content,$conf) {
00131
00132
00133 $content = trim($this->cObj->data['bodytext']);
00134 if (!strcmp($content,'')) return '';
00135
00136
00137 $rows = t3lib_div::trimExplode(chr(10),$content);
00138
00139
00140 $cols = t3lib_div::intInRange($this->cObj->data['cols']?$this->cObj->data['cols']:count(explode('|',current($rows))),0,100);
00141
00142
00143 $rCount = count($rows);
00144 foreach($rows as $k => $v) {
00145 $cells = explode('|',$v);
00146 $newCells=array();
00147 for($a=0;$a<$cols;$a++) {
00148 if (!strcmp(trim($cells[$a]),'')) $cells[$a]=' ';
00149 $cellAttribs = ($a>0 && ($cols-1)==$a) ? ' class="td-last"' : ' class="td-'.$a.'"';
00150 $newCells[$a] = '
00151 <td'.$cellAttribs.'><p>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</p></td>';
00152 }
00153
00154 $oddEven = $k%2 ? 'tr-odd' : 'tr-even';
00155 $rowAttribs = ($k>0 && ($rCount-1)==$k) ? ' class="'.$oddEven.' tr-last"' : ' class="'.$oddEven.' tr-'.$k.'"';
00156 $rows[$k]='
00157 <tr'.$rowAttribs.'>'.implode('',$newCells).'
00158 </tr>';
00159 }
00160
00161
00162 $type = intval($this->cObj->data['layout']);
00163
00164
00165 $tableTagParams = $this->getTableAttributes($conf,$type);
00166 $tableTagParams['class'] = 'contenttable contenttable-'.$type;
00167
00168
00169 $out = '
00170 <table '.t3lib_div::implodeAttributes($tableTagParams).'>'.
00171 implode('',$rows).'
00172 </table>';
00173
00174
00175 if ($conf['stdWrap.']) {
00176 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00177 }
00178
00179
00180 return $out;
00181 }
00182
00191 function render_uploads($content,$conf) {
00192
00193 $out = '';
00194
00195
00196 $type = intval($this->cObj->data['layout']);
00197
00198
00199 $lConf=array();
00200 $lConf['override.']['filelist.']['field'] = 'select_key';
00201 $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);
00202
00203
00204 $fileArray = t3lib_div::trimExplode(',',$fileList,1);
00205
00206
00207 if (count($fileArray)) {
00208
00209
00210 $selectKeyValues = explode('|',$this->cObj->data['select_key']);
00211 $path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/';
00212
00213
00214 $descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']);
00215
00216
00217 $conf['linkProc.']['path.']['current'] = 1;
00218 $conf['linkProc.']['icon'] = 1;
00219 $conf['linkProc.']['icon.']['wrap'] = ' |
00220 $conf['linkProc.']['icon_link'] = 1;
00221 $conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';
00222
00223
00224 $filesData = array();
00225 foreach($fileArray as $key => $fileName) {
00226 $absPath = t3lib_div::getFileAbsFileName($path.$fileName);
00227 if (@is_file($absPath)) {
00228 $fI = pathinfo($fileName);
00229 $filesData[$key] = array();
00230
00231 $filesData[$key]['filename'] = $fileName;
00232 $filesData[$key]['path'] = $path;
00233 $filesData[$key]['filesize'] = filesize($absPath);
00234 $filesData[$key]['fileextension'] = strtolower($fI['extension']);
00235 $filesData[$key]['description'] = trim($descriptions[$key]);
00236
00237 $this->cObj->setCurrentVal($path);
00238 $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
00239 $filesData[$key]['linkedFilenameParts'] = explode('
00240 }
00241 }
00242
00243
00244 $tRows = array();
00245 foreach($filesData as $key => $fileD) {
00246
00247
00248 $oddEven = $key%2 ? 'tr-odd' : 'tr-even';
00249
00250
00251 $tRows[]='
00252 <tr class="'.$oddEven.'">'.($type>0 ? '
00253 <td class="csc-uploads-icon">
00254 '.$fileD['linkedFilenameParts'][0].'
00255 </td>' : '').'
00256 <td class="csc-uploads-fileName">
00257 <p>'.$fileD['linkedFilenameParts'][1].'</p>'.
00258 ($fileD['description'] ? '
00259 <p class="csc-uploads-description">'.htmlspecialchars($fileD['description']).'</p>' : '').'
00260 </td>'.($this->cObj->data['filelink_size'] ? '
00261 <td class="csc-uploads-fileSize">
00262 <p>'.t3lib_div::formatSize($fileD['filesize']).'</p>
00263 </td>' : '').'
00264 </tr>';
00265 }
00266
00267
00268 $tableTagParams = $this->getTableAttributes($conf,$type);
00269 $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
00270
00271
00272
00273 $out = '
00274 <table '.t3lib_div::implodeAttributes($tableTagParams).'>
00275 '.implode('',$tRows).'
00276 </table>';
00277 }
00278
00279
00280 if ($conf['stdWrap.']) {
00281 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00282 }
00283
00284
00285 return $out;
00286 }
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00313 function getTableAttributes($conf,$type) {
00314
00315
00316 $tableTagParams_conf = $conf['tableParams_'.$type.'.'];
00317
00318 $conf['color.'][200] = '';
00319 $conf['color.'][240] = 'black';
00320 $conf['color.'][241] = 'white';
00321 $conf['color.'][242] = '#333333';
00322 $conf['color.'][243] = 'gray';
00323 $conf['color.'][244] = 'silver';
00324
00325
00326 $tableTagParams = array();
00327 $tableTagParams['border'] = $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border'];
00328 $tableTagParams['cellspacing'] = $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing'];
00329 $tableTagParams['cellpadding'] = $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding'];
00330 $tableTagParams['bgcolor'] = isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default'];
00331
00332
00333 return $tableTagParams;
00334 }
00335 }
00336
00337
00338
00339 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']) {
00340 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);
00341 }
00342 ?>