Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

t3lib_recordList Class Reference

List of all members.

Public Member Functions

 addElement ($h, $icon, $data, $tdParams='', $lMargin='', $altLine='')
 Returns a table-row with the content from the fields in the input data array.
 writeTop ()
 Dummy function, used to write the top of a table listing.
 writeBottom ()
 Finishes the list with the "stopper"-gif, adding the HTML code for that item to the internal ->HTMLcode string.
 fwd_rwd_nav ($table='')
 Creates a forward/reverse button based on the status of ->eCounter, ->firstElementNumber, ->iLimit.
 fwd_rwd_HTML ($type, $pointer, $table='')
 Creates the button with link to either forward or reverse.
 listURL ($altId='')
 Creates the URL to this script, including all relevant GPvars.
 CBfunctions ()
 Returning JavaScript for ClipBoard functionality.
 initializeLanguages ()
 Initializes page languages and icons.
 languageFlag ($sys_language_uid)
 Return the icon for the language.

Public Attributes

 $iLimit = 10
 $leftMargin = 0
 $showIcon = 1
 $no_noWrap = 0
 $oddColumnsTDParams = ''
 $backPath = ''
 $fieldArray = Array()
 $addElement_tdParams = array()
 $fixedL = 50
 $script = ''
 $thumbScript = 'thumbs.php'
 $setLMargin = 1
 $counter = 0
 $totalItems = ''
 $firstElementNumber = 0
 $eCounter = 0
 $HTMLcode = ''
 $pageOverlays = array()
 $languageIconTitles = array()

Member Function Documentation

t3lib_recordList::addElement h,
icon,
data,
tdParams = '',
lMargin = '',
altLine = ''
 

Returns a table-row with the content from the fields in the input data array.

OBS: $this->fieldArray MUST be set! (represents the list of fields to display)

Parameters:
integer $h is an integer >=0 and denotes how tall a element is. Set to '0' makes a halv line, -1 = full line, set to 1 makes a 'join' and above makes 'line'
string $icon is the + of the record. If not supplied the first 'join'-icon will be a 'line' instead
array $data is the dataarray, record with the fields. Notice: These fields are (currently) NOT htmlspecialchar'ed before being wrapped in

-tags

Parameters:
string $tdParams is insert in the

-tags. Must carry a ' ' as first character

Parameters:
integer OBSOLETE - NOT USED ANYMORE. $lMargin is the leftMargin (integer)
string $altLine is the HTML -tag for an alternative 'gfx/ol/line.gif'-icon (used in the top)
Returns:
string HTML content for the table row

Definition at line 123 of file class.t3lib_recordlist.php.

References $a, and $out.

Referenced by fwd_rwd_nav(), and writeBottom().

00123                                                                               {
00124       $noWrap = ($this->no_noWrap) ? '' : ' nowrap="nowrap"';
00125 
00126          // Start up:
00127       $out='
00128       <!-- Element, begin: -->
00129       <tr>';
00130          // Show icon and lines
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          // Init rendering.
00153       $colsp='';
00154       $lastKey='';
00155       $c=0;
00156       $ccount=0;
00157       $tdP[0] = $this->oddColumnsTDParams ? $this->oddColumnsTDParams : $tdParams;
00158       $tdP[1] = $tdParams;
00159 
00160          // Traverse field array which contains the data to present:
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          // End row
00186       $out.='
00187       </tr>';
00188 
00189          // Return row.
00190       return $out;
00191    }

t3lib_recordList::CBfunctions  ) 
 

Returning JavaScript for ClipBoard functionality.

Returns:
string

Definition at line 292 of file class.t3lib_recordlist.php.

00292                            {
00293       return '
00294       // checkOffCB()
00295    function checkOffCB(listOfCBnames)  {  //
00296       var notChecked=0;
00297       var total=0;
00298 
00299          // Checking how many is checked, how many is not
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          // Setting the status...
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       // cbValue()
00324    function cbValue(CBname)   {  //
00325       var CBfullName = "CBC["+CBname+"]";
00326       return (document.dblistForm[CBfullName] && document.dblistForm[CBfullName].checked ? 1 : 0);
00327    }
00328       // setcbValue()
00329    function setcbValue(CBname,flag) {  //
00330       CBfullName = "CBC["+CBname+"]";
00331       document.dblistForm[CBfullName].checked = flag ? "on" : 0;
00332    }
00333 
00334       ';
00335    }

t3lib_recordList::fwd_rwd_HTML type,
pointer,
table = ''
 

Creates the button with link to either forward or reverse.

Parameters:
string Type: "fwd" or "rwd"
integer Pointer
string Table name
Returns:
string private

Definition at line 258 of file class.t3lib_recordlist.php.

References listURL(), and table().

Referenced by fwd_rwd_nav().

00258                                                    {
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    }

t3lib_recordList::fwd_rwd_nav table = ''  ) 
 

Creates a forward/reverse button based on the status of ->eCounter, ->firstElementNumber, ->iLimit.

Parameters:
string Table name
Returns:
array array([boolean], [HTML]) where [boolean] is 1 for reverse element, [HTML] is the table-row code for the element

Definition at line 225 of file class.t3lib_recordlist.php.

References addElement(), fwd_rwd_HTML(), and table().

00225                                     {
00226       $code='';
00227       if ($this->eCounter >= $this->firstElementNumber   &&   $this->eCounter < $this->firstElementNumber+$this->iLimit)   {
00228          if ($this->firstElementNumber && $this->eCounter==$this->firstElementNumber)  {
00229                //    reverse
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                //    forward
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    }

t3lib_recordList::initializeLanguages  ) 
 

Initializes page languages and icons.

Returns:
void

Definition at line 342 of file class.t3lib_recordlist.php.

References $LANG, t3lib_BEfunc::getModTSconfig(), t3lib_BEfunc::getRecord(), and PATH_site.

00342                                     {
00343       global $TCA,$LANG;
00344 
00345          // Look up page overlays:
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          // icons and language titles:
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          // Set default:
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          // Set "All" language:
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          // Find all system languages:
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    }

t3lib_recordList::languageFlag sys_language_uid  ) 
 

Return the icon for the language.

Parameters:
integer Sys language uid
Returns:
string Language icon

Definition at line 408 of file class.t3lib_recordlist.php.

00408                                              {
00409       return ($this->languageIconTitles[$sys_language_uid]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$sys_language_uid]['flagIcon'].'" class="absmiddle" alt="" />&nbsp;' : '').
00410             htmlspecialchars($this->languageIconTitles[$sys_language_uid]['title']);
00411    }

t3lib_recordList::listURL altId = ''  ) 
 

Creates the URL to this script, including all relevant GPvars.

Parameters:
string Alternative id value. Enter blank string for the current id ($this->id)
Returns:
string URL

Definition at line 282 of file class.t3lib_recordlist.php.

Referenced by fwd_rwd_HTML().

00282                                  {
00283       return $this->script.
00284          '?id='.(strcmp($altId,'')?$altId:$this->id);
00285    }

t3lib_recordList::writeBottom  ) 
 

Finishes the list with the "stopper"-gif, adding the HTML code for that item to the internal ->HTMLcode string.

Returns:
void

Definition at line 206 of file class.t3lib_recordlist.php.

References addElement(), and table().

00206                            {
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    }

t3lib_recordList::writeTop  ) 
 

Dummy function, used to write the top of a table listing.

Returns:
void

Definition at line 198 of file class.t3lib_recordlist.php.

00198                         {
00199    }


Member Data Documentation

t3lib_recordList::$addElement_tdParams = array()
 

Definition at line 90 of file class.t3lib_recordlist.php.

t3lib_recordList::$backPath = ''
 

Definition at line 88 of file class.t3lib_recordlist.php.

t3lib_recordList::$counter = 0
 

Definition at line 98 of file class.t3lib_recordlist.php.

t3lib_recordList::$eCounter = 0
 

Definition at line 103 of file class.t3lib_recordlist.php.

t3lib_recordList::$fieldArray = Array()
 

Definition at line 89 of file class.t3lib_recordlist.php.

t3lib_recordList::$firstElementNumber = 0
 

Definition at line 102 of file class.t3lib_recordlist.php.

t3lib_recordList::$fixedL = 50
 

Definition at line 93 of file class.t3lib_recordlist.php.

t3lib_recordList::$HTMLcode = ''
 

Definition at line 104 of file class.t3lib_recordlist.php.

t3lib_recordList::$iLimit = 10
 

Definition at line 83 of file class.t3lib_recordlist.php.

t3lib_recordList::$languageIconTitles = array()
 

Definition at line 107 of file class.t3lib_recordlist.php.

t3lib_recordList::$leftMargin = 0
 

Definition at line 84 of file class.t3lib_recordlist.php.

t3lib_recordList::$no_noWrap = 0
 

Definition at line 86 of file class.t3lib_recordlist.php.

t3lib_recordList::$oddColumnsTDParams = ''
 

Definition at line 87 of file class.t3lib_recordlist.php.

t3lib_recordList::$pageOverlays = array()
 

Definition at line 106 of file class.t3lib_recordlist.php.

t3lib_recordList::$script = ''
 

Definition at line 94 of file class.t3lib_recordlist.php.

t3lib_recordList::$setLMargin = 1
 

Definition at line 96 of file class.t3lib_recordlist.php.

t3lib_recordList::$showIcon = 1
 

Definition at line 85 of file class.t3lib_recordlist.php.

t3lib_recordList::$thumbScript = 'thumbs.php'
 

Definition at line 95 of file class.t3lib_recordlist.php.

t3lib_recordList::$totalItems = ''
 

Definition at line 99 of file class.t3lib_recordlist.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:07:09 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913