Added feature #5242: IRRE - Storage page for child records
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_recordlist.php
index a930164..526911e 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
- *   78: class t3lib_recordList
- *  119:     function addElement($h,$icon,$data,$tdParams='',$lMargin='',$altLine='')
- *  194:     function writeTop()
- *  202:     function writeBottom()
- *  221:     function fwd_rwd_nav($table='')
- *  254:     function fwd_rwd_HTML($type,$pointer,$table='')
- *  277:     function listURL()
- *  286:     function CBfunctions()
+ *   80: class t3lib_recordList
+ *  123:     function addElement($h,$icon,$data,$tdParams='',$lMargin='',$altLine='')
+ *  198:     function writeTop()
+ *  206:     function writeBottom()
+ *  225:     function fwd_rwd_nav($table='')
+ *  258:     function fwd_rwd_HTML($type,$pointer,$table='')
+ *  284:     function listURL($altId='')
+ *  294:     function CBfunctions()
+ *  344:     function initializeLanguages()
+ *  411:     function languageFlag($sys_language_uid)
  *
- * TOTAL FUNCTIONS: 7
+ * TOTAL FUNCTIONS: 9
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
@@ -70,7 +72,7 @@
 /**
  * This class is the base for listing of database records and files in the modules Web>List and File>Filelist
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage t3lib
  * @see typo3/db_list.php, typo3/file_list.php
@@ -85,7 +87,7 @@ class t3lib_recordList {
        var $oddColumnsTDParams ='';                    // If set this is <td>-params for odd columns in addElement. Used with db_layout / pages section
        var $backPath='';
        var $fieldArray = Array();                              // Decides the columns shown. Filled with values that refers to the keys of the data-array. $this->fieldArray[0] is the title column.
-       var $addElement_tdParams=array();               // Keys are fieldnames and values are td-parameters to add in addElement();
+       var $addElement_tdParams = array();             // Keys are fieldnames and values are td-parameters to add in addElement();
 
                // Not used in this class - but maybe extension classes...
        var $fixedL = 50;                                               // Max length of strings
@@ -101,6 +103,8 @@ class t3lib_recordList {
        var $eCounter=0;
        var $HTMLcode='';                       // String with accumulated HTML content
 
+       var $pageOverlays = array();                    // Contains page translation languages
+       var $languageIconTitles = array();              // Contains sys language icons and titles
 
 
 
@@ -150,8 +154,8 @@ class t3lib_recordList {
                $lastKey='';
                $c=0;
                $ccount=0;
-               $tdP[0]= $this->oddColumnsTDParams ? $this->oddColumnsTDParams : $tdParams;
-               $tdP[1]=$tdParams;
+               $tdP[0] = $this->oddColumnsTDParams ? $this->oddColumnsTDParams : $tdParams;
+               $tdP[1] = $tdParams;
 
                        // Traverse field array which contains the data to present:
                reset($this->fieldArray);
@@ -252,30 +256,34 @@ class t3lib_recordList {
         * @access private
         */
        function fwd_rwd_HTML($type,$pointer,$table='') {
+               $content = '';
                $tParam = $table ? '&table='.rawurlencode($table) : '';
                switch($type)   {
                        case 'fwd':
                                $href = $this->listURL().'&pointer='.($pointer-$this->iLimit).$tParam;
-                               return '<a href="'.htmlspecialchars($href).'">'.
+                               $content = '<a href="'.htmlspecialchars($href).'">'.
                                                '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/pilup.gif','width="14" height="14"').' alt="" />'.
                                                '</a> <i>[1 - '.$pointer.']</i>';
                        break;
                        case 'rwd':
                                $href = $this->listURL().'&pointer='.$pointer.$tParam;
-                               return '<a href="'.htmlspecialchars($href).'">'.
+                               $content = '<a href="'.htmlspecialchars($href).'">'.
                                                '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/pildown.gif','width="14" height="14"').' alt="" />'.
                                                '</a> <i>['.($pointer+1).' - '.$this->totalItems.']</i>';
                        break;
                }
+               return $content;
        }
 
        /**
-        * Returning "listURL" - the script with parameters to which forward/backward requests are sent
+        * Creates the URL to this script, including all relevant GPvars
         *
-        * @return      string
+        * @param       string          Alternative id value. Enter blank string for the current id ($this->id)
+        * @return      string          URL
         */
-       function listURL()      {
-               return 'dummy.php?';
+       function listURL($altId='')     {
+               return $this->script.
+                       '?id='.(strcmp($altId,'')?$altId:$this->id);
        }
 
        /**
@@ -327,6 +335,42 @@ class t3lib_recordList {
 
                ';
        }
+
+       /**
+        * Initializes page languages and icons
+        *
+        * @return      void
+        */
+       function initializeLanguages()  {
+               global $TCA,$LANG;
+
+                       // Look up page overlays:
+               $this->pageOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       '*',
+                       'pages_language_overlay',
+                       'pid='.intval($this->id).
+                               t3lib_BEfunc::deleteClause('pages_language_overlay').
+                               t3lib_BEfunc::versioningPlaceholderClause('pages_language_overlay'),
+                       '',
+                       '',
+                       '',
+                       'sys_language_uid'
+               );
+               
+               $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
+               $this->languageIconTitles = $t8Tools->getSystemLanguages($this->id, $this->backPath);
+       }
+
+       /**
+        * Return the icon for the language
+        *
+        * @param       integer         Sys language uid
+        * @return      string          Language icon
+        */
+       function languageFlag($sys_language_uid)        {
+               return ($this->languageIconTitles[$sys_language_uid]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$sys_language_uid]['flagIcon'].'" class="absmiddle" alt="" />&nbsp;' : '').
+                               htmlspecialchars($this->languageIconTitles[$sys_language_uid]['title']);
+       }
 }