예제 #1
0
 /**
  * Returns field list with table name prepended
  *
  * @param	string		$table Table name
  * @param	mixed		$fields Field list as array or as string comma list.
  * @param	boolean		$check If set (default) the fields are checked if defined in TCA.
  * @param	boolean		$prependTableName If set (default) the fields are prepended with table.
  * @return	string		Comma list of fields with table name prepended
  */
 function compileFieldList($table, $fields, $checkTCA = TRUE, $prependTableName = TRUE)
 {
     global $TCA;
     $fieldList = array();
     $fields = is_array($fields) ? $fields : t3lib_div::trimExplode(',', $fields, 1);
     if ($checkTCA) {
         if (is_array($TCA[$table])) {
             $fields = tx_dam_db::cleanupFieldList($table, $fields);
         } else {
             $table = NULL;
         }
     }
     if ($table) {
         foreach ($fields as $field) {
             if ($prependTableName) {
                 $fieldList[$table . '.' . $field] = $table . '.' . $field;
             } else {
                 $fieldList[$field] = $field;
             }
         }
     }
     return implode(', ', $fieldList);
 }