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
00080 class t3lib_recordList {
00081
00082
00083 var $iLimit = 10;
00084 var $leftMargin = 0;
00085 var $showIcon = 1;
00086 var $no_noWrap = 0;
00087 var $oddColumnsTDParams ='';
00088 var $backPath='';
00089 var $fieldArray = Array();
00090 var $addElement_tdParams = array();
00091
00092
00093 var $fixedL = 50;
00094 var $script = '';
00095 var $thumbScript = 'thumbs.php';
00096 var $setLMargin=1;
00097
00098 var $counter=0;
00099 var $totalItems = '';
00100
00101
00102 var $firstElementNumber=0;
00103 var $eCounter=0;
00104 var $HTMLcode='';
00105
00106 var $pageOverlays = array();
00107 var $languageIconTitles = array();
00108
00109
00110
00123 function addElement($h,$icon,$data,$tdParams='',$lMargin='',$altLine='') {
00124 $noWrap = ($this->no_noWrap) ? '' : ' nowrap="nowrap"';
00125
00126
00127 $out='
00128 <!-- Element, begin: -->
00129 <tr>';
00130
00131 if ($this->showIcon) {
00132 $out.='
00133 <td nowrap="nowrap"'.$tdParams.'>';
00134
00135 if (!$h) {
00136 # $out.='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/halfline.gif','width="18" height="8"').' alt="" />';
00137 $out.='<img src="clear.gif" width="1" height="8" alt="" />';
00138 } else {
00139 for ($a=0;$a<$h;$a++) {
00140 if (!$a) {
00141 # $out.= $altLine ? $altLine : '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/line.gif','width="18" height="16"').' alt="" />';
00142 if ($icon) $out.= $icon;
00143 } else {
00144 # $out.= $altLine ? $altLine :'<br /><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/line.gif','width="18" height="16"').' alt="" />';
00145 }
00146 }
00147 }
00148 $out.='</td>
00149 ';
00150 }
00151
00152
00153 $colsp='';
00154 $lastKey='';
00155 $c=0;
00156 $ccount=0;
00157 $tdP[0] = $this->oddColumnsTDParams ? $this->oddColumnsTDParams : $tdParams;
00158 $tdP[1] = $tdParams;
00159
00160
00161 reset($this->fieldArray);
00162 while(list(,$vKey)=each($this->fieldArray)) {
00163 if (isset($data[$vKey])) {
00164 if ($lastKey) {
00165 $out.='
00166 <td'.
00167 $noWrap.
00168 $tdP[($ccount%2)].
00169 $colsp.
00170 $this->addElement_tdParams[$lastKey].
00171 '>'.$data[$lastKey].'</td>';
00172 }
00173 $lastKey=$vKey;
00174 $c=1;
00175 $ccount++;
00176 } else {
00177 if (!$lastKey) {$lastKey=$vKey;}
00178 $c++;
00179 }
00180 if ($c>1) {$colsp=' colspan="'.$c.'"';} else {$colsp='';}
00181 }
00182 if ($lastKey) { $out.='
00183 <td'.$noWrap.$tdP[($ccount%2)].$colsp.$this->addElement_tdParams[$lastKey].'>'.$data[$lastKey].'</td>'; }
00184
00185
00186 $out.='
00187 </tr>';
00188
00189
00190 return $out;
00191 }
00192
00198 function writeTop() {
00199 }
00200
00206 function writeBottom() {
00207 $this->HTMLcode.='
00208
00209 <!--
00210 End of list table:
00211 -->
00212 <table border="0" cellpadding="0" cellspacing="0">';
00213 $theIcon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/stopper.gif','width="18" height="16"').' alt="" />';
00214 $this->HTMLcode.=$this->addElement(1,'','','',$this->leftMargin,$theIcon);
00215 $this->HTMLcode.='
00216 </table>';
00217 }
00218
00225 function fwd_rwd_nav($table='') {
00226 $code='';
00227 if ($this->eCounter >= $this->firstElementNumber && $this->eCounter < $this->firstElementNumber+$this->iLimit) {
00228 if ($this->firstElementNumber && $this->eCounter==$this->firstElementNumber) {
00229
00230 $theData = Array();
00231 $titleCol=$this->fieldArray[0];
00232 $theData[$titleCol] = $this->fwd_rwd_HTML('fwd',$this->eCounter,$table);
00233 $code=$this->addElement(1,'',$theData);
00234 }
00235 return Array(1,$code);
00236 } else {
00237 if ($this->eCounter==$this->firstElementNumber+$this->iLimit) {
00238
00239 $theData = Array();
00240 $titleCol=$this->fieldArray[0];
00241 $theData[$titleCol] = $this->fwd_rwd_HTML('rwd',$this->eCounter,$table);
00242 $code=$this->addElement(1,'',$theData);
00243 }
00244 return Array(0,$code);
00245 }
00246
00247 }
00248
00258 function fwd_rwd_HTML($type,$pointer,$table='') {
00259 $content = '';
00260 $tParam = $table ? '&table='.rawurlencode($table) : '';
00261 switch($type) {
00262 case 'fwd':
00263 $href = $this->listURL().'&pointer='.($pointer-$this->iLimit).$tParam;
00264 $content = '<a href="'.htmlspecialchars($href).'">'.
00265 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/pilup.gif','width="14" height="14"').' alt="" />'.
00266 '</a> <i>[1 - '.$pointer.']</i>';
00267 break;
00268 case 'rwd':
00269 $href = $this->listURL().'&pointer='.$pointer.$tParam;
00270 $content = '<a href="'.htmlspecialchars($href).'">'.
00271 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/pildown.gif','width="14" height="14"').' alt="" />'.
00272 '</a> <i>['.($pointer+1).' - '.$this->totalItems.']</i>';
00273 break;
00274 }
00275 return $content;
00276 }
00277
00284 function listURL($altId='') {
00285 return $this->script.
00286 '?id='.(strcmp($altId,'')?$altId:$this->id);
00287 }
00288
00294 function CBfunctions() {
00295 return '
00296
00297 function checkOffCB(listOfCBnames) {
00298 var notChecked=0;
00299 var total=0;
00300
00301
00302 var pointer=0;
00303 var pos = listOfCBnames.indexOf(",");
00304 while (pos!=-1) {
00305 if (!cbValue(listOfCBnames.substr(pointer,pos-pointer))) notChecked++;
00306 total++;
00307 pointer=pos+1;
00308 pos = listOfCBnames.indexOf(",",pointer);
00309 }
00310 if (!cbValue(listOfCBnames.substr(pointer))) notChecked++;
00311 total++;
00312
00313
00314 var flag = notChecked*2>total;
00315 pointer=0;
00316 pos = listOfCBnames.indexOf(",");
00317 while (pos!=-1) {
00318 setcbValue(listOfCBnames.substr(pointer,pos-pointer),flag);
00319
00320 pointer=pos+1;
00321 pos = listOfCBnames.indexOf(",",pointer);
00322 }
00323 setcbValue(listOfCBnames.substr(pointer),flag);
00324 }
00325
00326 function cbValue(CBname) {
00327 var CBfullName = "CBC["+CBname+"]";
00328 return (document.dblistForm[CBfullName] && document.dblistForm[CBfullName].checked ? 1 : 0);
00329 }
00330
00331 function setcbValue(CBname,flag) {
00332 CBfullName = "CBC["+CBname+"]";
00333 document.dblistForm[CBfullName].checked = flag ? "on" : 0;
00334 }
00335
00336 ';
00337 }
00338
00344 function initializeLanguages() {
00345 global $TCA,$LANG;
00346
00347
00348 $this->pageOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00349 '*',
00350 'pages_language_overlay',
00351 'pid='.intval($this->id).
00352 t3lib_BEfunc::deleteClause('pages_language_overlay').
00353 t3lib_BEfunc::versioningPlaceholderClause('pages_language_overlay'),
00354 '',
00355 '',
00356 '',
00357 'sys_language_uid'
00358 );
00359
00360
00361 t3lib_div::loadTCA ('sys_language');
00362 $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']);
00363 $flagIconPath = $this->backPath.'../'.substr($flagAbsPath, strlen(PATH_site));
00364
00365 $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
00366 $this->languageIconTitles = array();
00367
00368
00369 $this->languageIconTitles[0]=array(
00370 'uid' => 0,
00371 'title' => strlen ($this->modSharedTSconfig['properties']['defaultLanguageLabel']) ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$LANG->getLL('defaultLanguage').')' : $LANG->getLL('defaultLanguage'),
00372 'ISOcode' => 'DEF',
00373 'flagIcon' => strlen($this->modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath.$this->modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath.$this->modSharedTSconfig['properties']['defaultLanguageFlag'] : null,
00374 );
00375
00376
00377 $this->languageIconTitles[-1]=array(
00378 'uid' => -1,
00379 'title' => $LANG->getLL ('multipleLanguages'),
00380 'ISOcode' => 'DEF',
00381 'flagIcon' => $flagIconPath.'multi-language.gif',
00382 );
00383
00384
00385 $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00386 '*',
00387 'sys_language',
00388 ''
00389 );
00390 foreach($sys_languages as $row) {
00391 $this->languageIconTitles[$row['uid']] = $row;
00392
00393 if ($row['static_lang_isocode']) {
00394 $staticLangRow = t3lib_BEfunc::getRecord('static_languages',$row['static_lang_isocode'],'lg_iso_2');
00395 if ($staticLangRow['lg_iso_2']) {
00396 $this->languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
00397 }
00398 }
00399 if (strlen ($row['flag'])) {
00400 $this->languageIconTitles[$row['uid']]['flagIcon'] = @is_file($flagAbsPath.$row['flag']) ? $flagIconPath.$row['flag'] : '';
00401 }
00402 }
00403 }
00404
00411 function languageFlag($sys_language_uid) {
00412 return ($this->languageIconTitles[$sys_language_uid]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$sys_language_uid]['flagIcon'].'" class="absmiddle" alt="" /> ' : '').
00413 htmlspecialchars($this->languageIconTitles[$sys_language_uid]['title']);
00414 }
00415 }
00416
00417
00418 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_recordlist.php']) {
00419 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_recordlist.php']);
00420 }
00421 ?>