2006-08-31 Ernesto Baschny <ernst@cron-it.de>
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_loaddbgroup.php
index eb1fbc0..c370e66 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
@@ -30,7 +30,7 @@
  * $Id$
  * Revised for TYPO3 3.6 September/2003 by Kasper Skaarhoj
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
@@ -65,7 +65,7 @@
  * Load database groups (relations)
  * Used to process the relations created by the TCA element types "group" and "select" for database records. Manages MM-relations as well.
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage t3lib
  */
@@ -109,7 +109,7 @@ class t3lib_loadDBGroup     {
                        $this->tableArray[$tName] = Array();
                        if ($this->checkIfDeleted && $GLOBALS['TCA'][$tName]['ctrl']['delete']) {
                                $fieldN = $tName.'.'.$GLOBALS['TCA'][$tName]['ctrl']['delete'];
-                               $this->additionalWhere[$tName].=' AND NOT '.$fieldN;
+                               $this->additionalWhere[$tName].=' AND '.$fieldN.'=0';
                        }
                }
 
@@ -189,7 +189,7 @@ class t3lib_loadDBGroup     {
                        // Select all MM relations:
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $tableName, 'uid_local='.intval($uid), '', 'sorting');
                while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
-                       $theTable = $row['tablenames'] ? $row['tablenames'] : $this->firstTable;                // If tablesnames columns exists and contain a name, then this value is the table, else it's the the firstTable...
+                       $theTable = $row['tablenames'] ? $row['tablenames'] : $this->firstTable;                // If tablesnames columns exists and contain a name, then this value is the table, else it's the firstTable...
                        if (($row['uid_foreign'] || $theTable=='pages') && $theTable && isset($this->tableArray[$theTable]))    {
                                $this->itemArray[$key]['id'] = $row['uid_foreign'];
                                $this->itemArray[$key]['table'] = $theTable;
@@ -302,7 +302,7 @@ class t3lib_loadDBGroup     {
                        // Traverses the tables listed:
                foreach($this->tableArray as $key => $val)      {
                        if (is_array($val))     {
-                               $itemList = implode($val,',');
+                               $itemList = implode(',',$val);
                                if ($itemList)  {
                                        $from = '*';
                                        if ($this->fromTC)      {
@@ -310,6 +310,9 @@ class t3lib_loadDBGroup     {
                                                if ($GLOBALS['TCA'][$key]['ctrl']['label'])     {
                                                        $from.= ','.$GLOBALS['TCA'][$key]['ctrl']['label'];     // Titel
                                                }
+                                               if ($GLOBALS['TCA'][$key]['ctrl']['label_alt']) {
+                                                       $from.= ','.$GLOBALS['TCA'][$key]['ctrl']['label_alt']; // Alternative Title-Fields
+                                               }
                                                if ($GLOBALS['TCA'][$key]['ctrl']['thumbnail']) {
                                                        $from.= ','.$GLOBALS['TCA'][$key]['ctrl']['thumbnail']; // Thumbnail
                                                }
@@ -342,7 +345,7 @@ class t3lib_loadDBGroup     {
                foreach($this->itemArray as $key => $val)       {
                        $theRow = $this->results[$val['table']][$val['id']];
                        if ($theRow && is_array($TCA[$val['table']]))   {
-                               $label = t3lib_div::fixed_lgd_cs(strip_tags($theRow[$TCA[$val['table']]['ctrl']['label']]),$titleLen);
+                               $label = t3lib_div::fixed_lgd_cs(strip_tags(t3lib_BEfunc::getRecordTitle($val['table'], $theRow)),$titleLen);
                                $label = ($label)?$label:'[...]';
                                $output[]=str_replace(',','',$val['table'].'_'.$val['id'].'|'.rawurlencode($label));
                        }