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 $tParam = $table ? '&table='.rawurlencode($table) : '';
00260 switch($type) {
00261 case 'fwd':
00262 $href = $this->listURL().'&pointer='.($pointer-$this->iLimit).$tParam;
00263 return '<a href="'.htmlspecialchars($href).'">'.
00264 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/pilup.gif','width="14" height="14"').' alt="" />'.
00265 '</a> <i>[1 - '.$pointer.']</i>';
00266 break;
00267 case 'rwd':
00268 $href = $this->listURL().'&pointer='.$pointer.$tParam;
00269 return '<a href="'.htmlspecialchars($href).'">'.
00270 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/pildown.gif','width="14" height="14"').' alt="" />'.
00271 '</a> <i>['.($pointer+1).' - '.$this->totalItems.']</i>';
00272 break;
00273 }
00274 }
00275
00282 function listURL($altId='') {
00283 return $this->script.
00284 '?id='.(strcmp($altId,'')?$altId:$this->id);
00285 }
00286
00292 function CBfunctions() {
00293 return '
00294
00295 function checkOffCB(listOfCBnames) {
00296 var notChecked=0;
00297 var total=0;
00298
00299
00300 var pointer=0;
00301 var pos = listOfCBnames.indexOf(",");
00302 while (pos!=-1) {
00303 if (!cbValue(listOfCBnames.substr(pointer,pos-pointer))) notChecked++;
00304 total++;
00305 pointer=pos+1;
00306 pos = listOfCBnames.indexOf(",",pointer);
00307 }
00308 if (!cbValue(listOfCBnames.substr(pointer))) notChecked++;
00309 total++;
00310
00311
00312 var flag = notChecked*2>total;
00313 pointer=0;
00314 pos = listOfCBnames.indexOf(",");
00315 while (pos!=-1) {
00316 setcbValue(listOfCBnames.substr(pointer,pos-pointer),flag);
00317
00318 pointer=pos+1;
00319 pos = listOfCBnames.indexOf(",",pointer);
00320 }
00321 setcbValue(listOfCBnames.substr(pointer),flag);
00322 }
00323
00324 function cbValue(CBname) {
00325 var CBfullName = "CBC["+CBname+"]";
00326 return (document.dblistForm[CBfullName] && document.dblistForm[CBfullName].checked ? 1 : 0);
00327 }
00328
00329 function setcbValue(CBname,flag) {
00330 CBfullName = "CBC["+CBname+"]";
00331 document.dblistForm[CBfullName].checked = flag ? "on" : 0;
00332 }
00333
00334 ';
00335 }
00336
00342 function initializeLanguages() {
00343 global $TCA,$LANG;
00344
00345
00346 $this->pageOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00347 '*',
00348 'pages_language_overlay',
00349 'pid='.intval($this->id).
00350 t3lib_BEfunc::deleteClause('pages_language_overlay'),
00351 '',
00352 '',
00353 '',
00354 'sys_language_uid'
00355 );
00356
00357
00358 t3lib_div::loadTCA ('sys_language');
00359 $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']);
00360 $flagIconPath = $this->backPath.'../'.substr($flagAbsPath, strlen(PATH_site));
00361
00362 $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
00363 $this->languageIconTitles = array();
00364
00365
00366 $this->languageIconTitles[0]=array(
00367 'uid' => 0,
00368 'title' => strlen ($this->modSharedTSconfig['properties']['defaultLanguageFlag']) ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$LANG->getLL('defaultLanguage').')' : $LANG->getLL('defaultLanguage'),
00369 'ISOcode' => 'DEF',
00370 'flagIcon' => strlen($this->modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath.$this->modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath.$this->modSharedTSconfig['properties']['defaultLanguageFlag'] : null,
00371 );
00372
00373
00374 $this->languageIconTitles[-1]=array(
00375 'uid' => -1,
00376 'title' => $LANG->getLL ('multipleLanguages'),
00377 'ISOcode' => 'DEF',
00378 'flagIcon' => $flagIconPath.'multi-language.gif',
00379 );
00380
00381
00382 $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00383 '*',
00384 'sys_language',
00385 ''
00386 );
00387 foreach($sys_languages as $row) {
00388 $this->languageIconTitles[$row['uid']] = $row;
00389
00390 if ($row['static_lang_isocode']) {
00391 $staticLangRow = t3lib_BEfunc::getRecord('static_languages',$row['static_lang_isocode'],'lg_iso_2');
00392 if ($staticLangRow['lg_iso_2']) {
00393 $this->languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
00394 }
00395 }
00396 if (strlen ($row['flag'])) {
00397 $this->languageIconTitles[$row['uid']]['flagIcon'] = @is_file($flagAbsPath.$row['flag']) ? $flagIconPath.$row['flag'] : '';
00398 }
00399 }
00400 }
00401
00408 function languageFlag($sys_language_uid) {
00409 return ($this->languageIconTitles[$sys_language_uid]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$sys_language_uid]['flagIcon'].'" class="absmiddle" alt="" /> ' : '').
00410 htmlspecialchars($this->languageIconTitles[$sys_language_uid]['title']);
00411 }
00412 }
00413
00414
00415 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_recordlist.php']) {
00416 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_recordlist.php']);
00417 }
00418 ?>