Fixed bug #13365: Table headers in t3lib_fullsearch
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 7 Feb 2010 22:00:42 +0000 (22:00 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 7 Feb 2010 22:00:42 +0000 (22:00 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6870 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_fullsearch.php

index 1630e3e..76d5a76 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-02-07  Christian Kuhn  <lolli@schwarzbu.ch>
 
+       * Fixed bug #13365: Table headers in t3lib_fullsearch (thanks to Georg Ringer)
        * Fixed bug #13448: Typo in BE cache init section
        * Follow-up to #13193: Added tests for tx_scheduler_croncmd
        * Fixed bug #13193: Day of week in scheduler cron command is not calculated correctly
index b6d0324..a35b477 100644 (file)
@@ -1023,34 +1023,43 @@ class t3lib_fullsearch {
                return $out;
        }
 
-        /**
- * [Describe function...]
- *
- * @param      [type]          $row: ...
- * @param      [type]          $conf: ...
- * @param      [type]          $table: ...
- * @return     [type]          ...
- */
-       function resultRowTitles($row,$conf,$table)     {
+       /**
+        * Render table header
       *
+        * @param       array           row: Table columns
+        * @param       array           conf: Table TCA
+        * @param       string          table: Table name
+        * @return      string          HTML of table header
       */
+       function resultRowTitles($row, $conf, $table) {
                $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
-               $out='<tr class="bgColor5">';
-               reset($row);
-               while(list($fN,$fV)=each($row)) {
-                       if (t3lib_div::inList($SET['queryFields'], $fN) || (!$SET['queryFields'] && $fN!='pid' && $fN!='deleted'))      {
-                               if (strlen($fV) < 50)   $TDparams = ' nowrap';
-                               else $TDparams = '';
 
-                               if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'])     {
-                                       $out.='<td'.$TDparams.'><strong>'.$GLOBALS['LANG']->sL($conf['columns'][$fN]['label']?$conf['columns'][$fN]['label']:$fN,1).'</strong></td>';
+               $tableHeader = array();
+
+                       // Start header row
+               $tableHeader[] = '<thead><tr class="bgColor5">';
+
+                       // Iterate over given columns
+               foreach ($row as $fieldName => $fieldValue) {
+                       if (t3lib_div::inList($SET['queryFields'], $fieldName) || (!$SET['queryFields'] && $fieldName != 'pid' && $fieldName != 'deleted')) {
+                               $THparams = (strlen($fieldValue) < 50) ? ' style="white-space:nowrap;"' : '';
+
+                               if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
+                                       $title = $GLOBALS['LANG']->sL($conf['columns'][$fieldName]['label'] ? $conf['columns'][$fieldName]['label'] : $fieldName, 1);
                                } else {
-                                       $out.='<td'.$TDparams.'><strong>'.$GLOBALS['LANG']->sL($fN, 1).'</strong></td>';
+                                       $title = $GLOBALS['LANG']->sL($fieldName, 1);
                                }
+
+                               $tableHeader[] = '<th' . $THparams . '>' . $title . '</th>';
                        }
                }
-               $out.='<td nowrap></td>
-               </tr>
-               ';
-               return $out;
+
+                       // Add empty icon column
+               $tableHeader[] = '<th style="white-space:nowrap;"></th>';
+                       // Close header row
+               $tableHeader[] = '</tr></thead>';
+
+               return implode($tableHeader, chr(10));
        }
 
        /**