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

t3lib_transferData Class Reference

Inherited by transferData.

List of all members.

Public Member Functions

 fetchRecord ($table, $idList, $operation)
 A function which can be used for load a batch of records from $table into internal memory of this object.
 renderRecord ($table, $id, $pid, $row)
 This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend! The objective with this function is to prepare the content for handling in TCEforms.
 renderRecordRaw ($table, $id, $pid, $row, $TSconfig='', $tscPID=0)
 This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend! The objective with this function is to prepare the content for handling in TCEforms.
 renderRecord_SW ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 Function with the switch() construct which triggers functions for processing of the data value depending on the TCA-config field type.
 renderRecord_groupProc ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 Processing of the data value in case the field type is "group".
 renderRecord_selectProc ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 Processing of the data value in case the field type is "select".
 renderRecord_flexProc ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 Processing of the data value in case the field type is "flex" MUST NOT be called in case of already INSIDE a flexform!
 renderRecord_typesProc ($totalRecordContent, $types_fieldConfig, $tscPID, $table, $pid)
 Processing of the content in $totalRecordcontent based on settings in the types-configuration.
 renderRecord_flexProc_procInData ($dataPart, $dataStructArray, $pParams)
 Function traversing sheets/languages for flex form data structures.
 renderRecord_flexProc_procInData_travDS (&$dataValues, $DSelements, $pParams)
 Traverse data array / structure.
 selectAddSpecial ($dataAcc, $elements, $specialKey)
 Adding "special" types to the $dataAcc array of selector items.
 selectAddForeign ($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row)
 Adds the foreign record elements to $dataAcc, if any.
 getDataIdList ($elements, $fieldConfig, $row)
 Returning the id-list processed by loadDBgroup for the foreign tables.
 procesItemArray ($selItems, $config, $fieldTSConfig, $table, $row, $field)
 Processing of selector box items.
 addItems ($items, $iArray)
 Adding items from $iArray to $items array.
 procItems ($items, $itemsProcFuncTSconfig, $config, $table, $row, $field)
 User processing of a selector box array of values.
 lockRecord ($table, $id, $pid=0)
 Sets the lock for a record from table/id, IF $this->lockRecords is set!
 regItem ($table, $id, $field, $content)
 Dummy function, can be used to "register" records.
 sL ($in)
 Local wrapper function for LANG->sL (returning language labels).

Public Attributes

 $lockRecords = 0
 $disableRTE = 0
 $prevPageID = ''
 $defVals = array()
 $addRawData = FALSE
 $regTableItems = Array()
 $regTableItems_data = Array()
 $loadModules = ''


Member Function Documentation

t3lib_transferData::addItems items,
iArray
 

Adding items from $iArray to $items array.

Parameters:
array The array of selector box items to which key(value) / value(label) pairs from $iArray will be added.
array The array of elements to add. The keys will become values. The value will become the label.
Returns:
array The modified input $items array private
See also:
procesItemArray()

Definition at line 875 of file class.t3lib_transferdata.php.

Referenced by procesItemArray().

00875                                        {
00876       if (is_array($iArray))  {
00877          foreach($iArray as $value => $label)   {
00878             $items[]=array($label,$value);
00879          }
00880       }
00881       return $items;
00882    }

t3lib_transferData::fetchRecord table,
idList,
operation
 

A function which can be used for load a batch of records from $table into internal memory of this object.

The function is also used to produce proper default data for new records Ultimately the function will call renderRecord()

Parameters:
string Table name, must be found in $TCA
string Comma list of id values. If $idList is "prev" then the value from $this->prevPageID is used. NOTICE: If $operation is "new", then negative ids are meant to point to a "previous" record and positive ids are PID values for new records. Otherwise (for existing records that is) it is straight forward table/id pairs.
string If "new", then a record with default data is returned. Further, the $id values are meant to be PID values (or if negative, pointing to a previous record). If NOT new, then the table/ids are just pointing to an existing record!
Returns:
void
See also:
renderRecord()

Definition at line 137 of file class.t3lib_transferdata.php.

References $TCA, lockRecord(), renderRecord(), and table().

00137                                                    {
00138       global $TCA;
00139 
00140       if ((string)$idList == 'prev')   {$idList = $this->prevPageID;}
00141 
00142       if ($TCA[$table]) {
00143          t3lib_div::loadTCA($table);
00144 
00145             // For each ID value (integer) we
00146          $ids = t3lib_div::trimExplode(',',$idList,1);
00147          foreach($ids as $id) {
00148             if (strcmp($id,''))  {  // If ID is not blank:
00149 
00150                   // For new records to be created, find default values:
00151                if ($operation=='new')  {
00152 
00153                      // Default values:
00154                   $newRow = Array();   // Used to store default values as found here:
00155 
00156                      // Default values as set in userTS:
00157                   $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
00158                   if (is_array($TCAdefaultOverride[$table.'.']))  {
00159                      foreach($TCAdefaultOverride[$table.'.'] as $theF => $theV)  {
00160                         if (isset($TCA[$table]['columns'][$theF]))   {
00161                            $newRow[$theF]=$theV;
00162                         }
00163                      }
00164                   }
00165 
00166                      // Default values as submitted:
00167                   if (is_array($this->defVals[$table]))  {
00168                      foreach($this->defVals[$table] as $theF => $theV)  {
00169                         if (isset($TCA[$table]['columns'][$theF]))   {
00170                            $newRow[$theF]=$theV;
00171                         }
00172                      }
00173                   }
00174 
00175                      // Fetch default values if a previous record exists
00176                   if ($id<0 && $TCA[$table]['ctrl']['useColumnsForDefaultValues'])  {
00177                         // Fetches the previous record:
00178                      $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid='.abs($id).t3lib_BEfunc::deleteClause($table));
00179                      if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00180                            // Gets the list of fields to copy from the previous record.
00181                         $fArr=t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['useColumnsForDefaultValues'],1);
00182                         while(list(,$theF)=each($fArr))  {
00183                            if (isset($TCA[$table]['columns'][$theF]))   {
00184                               $newRow[$theF]=$row[$theF];
00185                            }
00186                         }
00187                      }
00188                      $GLOBALS['TYPO3_DB']->sql_free_result($res);
00189                   }
00190 
00191                      // Finally, call renderRecord:
00192                   $this->renderRecord($table, uniqid('NEW'), $id, $newRow);
00193                } else {
00194                   $id=intval($id);
00195 
00196                      // Fetch database values
00197                   $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid='.intval($id).t3lib_BEfunc::deleteClause($table));
00198                   if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00199                      $this->renderRecord($table, $id, $row['pid'], $row);
00200                      $contentTable = $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'];
00201                      $this->lockRecord($table, $id, $contentTable==$table?$row['pid']:0); // Locking the pid if the table edited is the content table.
00202                   }
00203                   $GLOBALS['TYPO3_DB']->sql_free_result($res);
00204                }
00205             }
00206          }
00207       }
00208    }

t3lib_transferData::getDataIdList elements,
fieldConfig,
row
 

Returning the id-list processed by loadDBgroup for the foreign tables.

Parameters:
array The array of original elements - basically the field value exploded by ","
array Field configuration from TCA
array The data array, currently. Used to set the "local_uid" for selecting MM relation records.
Returns:
array An array with ids of the records from the input elements array. private

Definition at line 837 of file class.t3lib_transferdata.php.

Referenced by renderRecord_selectProc(), and selectAddForeign().

00837                                                          {
00838       $loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
00839       $loadDB->registerNonTableValues=$fieldConfig['config']['allowNonIdValues'] ? 1 : 0;
00840       $loadDB->start(implode(',',$elements), $fieldConfig['config']['foreign_table'].','.$fieldConfig['config']['neg_foreign_table'], $fieldConfig['config']['MM'], $row['uid']);
00841 
00842       $idList = $loadDB->convertPosNeg($loadDB->getValueArray(),$fieldConfig['config']['foreign_table'],$fieldConfig['config']['neg_foreign_table']);
00843 
00844       return $idList;
00845    }

t3lib_transferData::lockRecord table,
id,
pid = 0
 

Sets the lock for a record from table/id, IF $this->lockRecords is set!

Parameters:
string The table name
integer The id of the record
integer The pid of the record
Returns:
void

Definition at line 932 of file class.t3lib_transferdata.php.

References t3lib_BEfunc::lockRecords(), and table().

Referenced by fetchRecord().

00932                                              {
00933       if ($this->lockRecords) {
00934          t3lib_BEfunc::lockRecords($table,$id,$pid);
00935       }
00936    }

t3lib_transferData::procesItemArray selItems,
config,
fieldTSConfig,
table,
row,
field
 

Processing of selector box items.

This includes the automated adding of elements plus user-function processing.

Parameters:
array The elements to process
array TCA/columns configuration
array TSconfig for the field
string The table name
array The current row
string The field name
Returns:
array The modified input $selItems array private
See also:
renderRecord_selectProc()

Definition at line 860 of file class.t3lib_transferdata.php.

References addItems(), procItems(), and table().

Referenced by renderRecord_selectProc().

00860                                                                                  {
00861       $selItems = $this->addItems($selItems,$fieldTSConfig['addItems.']);
00862       if ($config['itemsProcFunc']) $selItems = $this->procItems($selItems,$fieldTSConfig['itemsProcFunc.'],$config,$table,$row,$field);
00863       return $selItems;
00864    }

t3lib_transferData::procItems items,
itemsProcFuncTSconfig,
config,
table,
row,
field
 

User processing of a selector box array of values.

Parameters:
array The array of selector box items
array TSconfig for the fields itemProcFunc
array TCA/columns configuration
string The table name
array The current row
string The field name
Returns:
array The modified input $items array private
See also:
procesItemArray()

Definition at line 897 of file class.t3lib_transferdata.php.

References table().

Referenced by procesItemArray().

00897                                                                                  {
00898       $params=array();
00899       $params['items'] = &$items;
00900       $params['config'] = $config;
00901       $params['TSconfig'] = $itemsProcFuncTSconfig;
00902       $params['table'] = $table;
00903       $params['row'] = $row;
00904       $params['field'] = $field;
00905 
00906       t3lib_div::callUserFunction($config['itemsProcFunc'],$params,$this);
00907       return $items;
00908    }

t3lib_transferData::regItem table,
id,
field,
content
 

Dummy function, can be used to "register" records.

Used by eg. the "show_item" script.

Parameters:
string Table name
integer Record id
string Field name
string Field content.
Returns:
void private
See also:
renderRecord()

Reimplemented in transferData.

Definition at line 949 of file class.t3lib_transferdata.php.

Referenced by renderRecordRaw().

00949                                                    {
00950    }

t3lib_transferData::renderRecord table,
id,
pid,
row
 

This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend! The objective with this function is to prepare the content for handling in TCEforms.

Default values from outside/TSconfig is added by fetchRecord(). In this function default values from TCA is used if a field is NOT defined in $row. The resulting, processed row is stored in $this->regTableItems_data[$uniqueItemRef], where $uniqueItemRef is "[tablename]_[id-value]"

Parameters:
string The table name
string The uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
integer The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
array The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
Returns:
void
See also:
fetchRecord()

Definition at line 223 of file class.t3lib_transferdata.php.

References getTCEFORM_TSconfig(), getTSCpid(), renderRecordRaw(), and table().

Referenced by fetchRecord().

00223                                                    {
00224       global $TCA;
00225 
00226          // Init:
00227       $uniqueItemRef = $table.'_'.$id;
00228       t3lib_div::loadTCA($table);
00229 
00230          // Fetches the true PAGE TSconfig pid to use later, if needed. (Until now, only for the RTE, but later..., who knows?)
00231       list($tscPID)=t3lib_BEfunc::getTSCpid($table,$id,$pid);
00232       $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($table,array_merge($row,array('uid'=>$id,'pid'=>$pid)));
00233 
00234          // If the record has not already been loaded (in which case we DON'T do it again)...
00235       if (!$this->regTableItems[$uniqueItemRef])   {
00236          $this->regTableItems[$uniqueItemRef] = 1; // set "loaded" flag.
00237 
00238             // If the table is pages, set the previous page id internally.
00239          if ($table == 'pages')  {$this->prevPageID = $id;}
00240 
00241          $this->regTableItems_data[$uniqueItemRef] = $this->renderRecordRaw($table, $id, $pid, $row, $TSconfig, $tscPID);
00242 
00243             // Merges the processed array on-top of the raw one - this is done because some things in TCEforms may need access to other fields than those in the columns configuration!
00244          if ($this->addRawData && is_array($row) && is_array($this->regTableItems_data[$uniqueItemRef])) {
00245             $this->regTableItems_data[$uniqueItemRef] = array_merge($row, $this->regTableItems_data[$uniqueItemRef]);
00246          }
00247       }
00248    }

t3lib_transferData::renderRecord_flexProc data,
fieldConfig,
TSconfig,
table,
row,
field
 

Processing of the data value in case the field type is "flex" MUST NOT be called in case of already INSIDE a flexform!

Parameters:
string The field value
array TCA field config
array TCEform TSconfig for the record
string Table name
array The row
string Field name
Returns:
string The processed input field value ($data) private
See also:
renderRecord()

Definition at line 469 of file class.t3lib_transferdata.php.

References t3lib_BEfunc::getFlexFormDS(), renderRecord_flexProc_procInData(), and table().

Referenced by renderRecord_SW().

00469                                                                                     {
00470       global $TCA;
00471 
00472          // Convert the XML data to PHP array:
00473       $currentValueArray = t3lib_div::xml2array($data);
00474       if (is_array($currentValueArray))   {
00475 
00476             // Get current value array:
00477          $dataStructArray = t3lib_BEfunc::getFlexFormDS($fieldConfig['config'],$row,$table);
00478          if (is_array($dataStructArray))  {
00479             $currentValueArray['data'] = $this->renderRecord_flexProc_procInData($currentValueArray['data'],$dataStructArray,array($data,$fieldConfig,$TSconfig,$table,$row,$field));
00480             $data = t3lib_div::array2xml($currentValueArray);
00481          }
00482       }
00483 
00484       return $data;
00485    }

t3lib_transferData::renderRecord_flexProc_procInData dataPart,
dataStructArray,
pParams
 

Function traversing sheets/languages for flex form data structures.

Parameters:
array Data array
array Data Structure array
array Various parameters to pass-through
Returns:
array Modified $dataPart array. private
See also:
t3lib_TCEmain::checkValue_flex_procInData(), renderRecord_flexProc_procInData_travDS()

Definition at line 554 of file class.t3lib_transferdata.php.

References renderRecord_flexProc_procInData_travDS().

Referenced by renderRecord_flexProc().

00554                                                                                     {
00555       if (is_array($dataPart))   {
00556          foreach($dataPart as $sKey => $sheetDef)  {
00557             list ($dataStruct,$actualSheet) = t3lib_div::resolveSheetDefInDS($dataStructArray,$sKey);
00558 
00559             if (is_array($dataStruct) && $actualSheet==$sKey && is_array($sheetDef))   {
00560                foreach($sheetDef as $lKey => $lData)  {
00561                   $this->renderRecord_flexProc_procInData_travDS(
00562                      $dataPart[$sKey][$lKey],
00563                      $dataStruct['ROOT']['el'],
00564                      $pParams
00565                   );
00566                }
00567             }
00568          }
00569       }
00570 
00571       return $dataPart;
00572    }

t3lib_transferData::renderRecord_flexProc_procInData_travDS &$  dataValues,
DSelements,
pParams
 

Traverse data array / structure.

Parameters:
array Data array passed by reference.
array Data structure
array Various parameters pass-through.
Returns:
void
See also:
renderRecord_flexProc_procInData(), t3lib_TCEmain::checkValue_flex_procInData_travDS()

Definition at line 583 of file class.t3lib_transferdata.php.

References renderRecord_SW(), and section().

Referenced by renderRecord_flexProc_procInData().

00583                                                                                           {
00584       if (is_array($DSelements)) {
00585 
00586             // For each DS element:
00587          foreach($DSelements as $key => $dsConf)   {
00588 
00589                   // Array/Section:
00590             if ($DSelements[$key]['type']=='array')   {
00591                if (is_array($dataValues[$key]['el'])) {
00592                   if ($DSelements[$key]['section'])   {
00593                      foreach($dataValues[$key]['el'] as $ik => $el)  {
00594                         $theKey = key($el);
00595                         if (is_array($dataValues[$key]['el'][$ik][$theKey]['el']))  {
00596                            $this->renderRecord_flexProc_procInData_travDS(
00597                                  $dataValues[$key]['el'][$ik][$theKey]['el'],
00598                                  $DSelements[$key]['el'][$theKey]['el'],
00599                                  $pParams
00600                               );
00601                         }
00602                      }
00603                   } else {
00604                      if (!isset($dataValues[$key]['el']))   $dataValues[$key]['el']=array();
00605                      $this->renderRecord_flexProc_procInData_travDS(
00606                            $dataValues[$key]['el'],
00607                            $DSelements[$key]['el'],
00608                            $pParams
00609                         );
00610                   }
00611                }
00612             } else {
00613                if (is_array($dsConf['TCEforms']['config']) && is_array($dataValues[$key]))   {
00614                   foreach($dataValues[$key] as $vKey => $data) {
00615 
00616                         // $data,$fieldConfig,$TSconfig,$table,$row,$field
00617                      list(,,$CVTSconfig,$CVtable,$CVrow,$CVfield) = $pParams;
00618 ;
00619                         // Set default value:
00620                      if (!isset($dataValues[$key][$vKey]))  {
00621                         $dataValues[$key][$vKey] = $dsConf['TCEforms']['config']['default'];
00622                      }
00623 
00624                         // Process value:
00625                      $dataValues[$key][$vKey] = $this->renderRecord_SW($dataValues[$key][$vKey],$dsConf['TCEforms'],$CVTSconfig,$CVtable,$CVrow,'');
00626                   }
00627                }
00628             }
00629          }
00630       }
00631    }

t3lib_transferData::renderRecord_groupProc data,
fieldConfig,
TSconfig,
table,
row,
field
 

Processing of the data value in case the field type is "group".

Parameters:
string The field value
array TCA field config
array TCEform TSconfig for the record
string Table name
array The row
string Field name
Returns:
string The processed input field value ($data) private
See also:
renderRecord()

Definition at line 355 of file class.t3lib_transferdata.php.

Referenced by renderRecord_SW().

00355                                                                                     {
00356       switch ($fieldConfig['config']['internal_type'])   {
00357          case 'file':
00358                // Init array used to accumulate the files:
00359             $dataAcc=array();
00360 
00361                // Now, load the files into the $dataAcc array, whether stored by MM or as a list of filenames:
00362             if ($fieldConfig['config']['MM'])   {
00363                $loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
00364                $loadDB->start('', 'files', $fieldConfig['config']['MM'], $row['uid']); // Setting dummy startup
00365 
00366                foreach($loadDB->itemArray as $value)  {
00367                   if ($value['id']) {
00368                      $dataAcc[]=rawurlencode($value['id']).'|'.rawurlencode($value['id']);
00369                   }
00370                }
00371             } else {
00372                $fileList = t3lib_div::trimExplode(',',$data,1);
00373                foreach($fileList as $value)  {
00374                   if ($value) {
00375                      $dataAcc[]=rawurlencode($value).'|'.rawurlencode($value);
00376                   }
00377                }
00378             }
00379                // Implode the accumulation array to a comma separated string:
00380             $data = implode(',',$dataAcc);
00381          break;
00382          case 'db':
00383             $loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
00384             $loadDB->start($data, $fieldConfig['config']['allowed'], $fieldConfig['config']['MM'], $row['uid']);
00385             $loadDB->getFromDB();
00386             $data = $loadDB->readyForInterface();
00387          break;
00388       }
00389 
00390       return $data;
00391    }

t3lib_transferData::renderRecord_selectProc data,
fieldConfig,
TSconfig,
table,
row,
field
 

Processing of the data value in case the field type is "select".

Parameters:
string The field value
array TCA field config
array TCEform TSconfig for the record
string Table name
array The row
string Field name
Returns:
string The processed input field value ($data) private
See also:
renderRecord()

Definition at line 406 of file class.t3lib_transferdata.php.

References $TCA, getDataIdList(), procesItemArray(), selectAddForeign(), selectAddSpecial(), and table().

Referenced by renderRecord_SW().

00406                                                                                        {
00407       global $TCA;
00408 
00409          // Initialize:
00410       $elements = t3lib_div::trimExplode(',',$data,1);   // Current data set.
00411       $dataAcc=array(); // New data set, ready for interface (list of values, rawurlencoded)
00412 
00413          // For list selectors (multi-value):
00414       if (intval($fieldConfig['config']['maxitems'])>1)  {
00415 
00416             // Add regular elements:
00417          if (is_array($fieldConfig['config']['items']))  {
00418             $fieldConfig['config']['items'] = $this->procesItemArray($fieldConfig['config']['items'], $fieldConfig['config'], $TSconfig[$field], $table, $row, $field);
00419             foreach($fieldConfig['config']['items'] as $pvpv)  {
00420                foreach($elements as $eKey => $value)  {
00421                   if (!strcmp($value,$pvpv[1])) {
00422                      $dataAcc[$eKey]=rawurlencode($pvpv[1]).'|'.rawurlencode($pvpv[0]);
00423                   }
00424                }
00425             }
00426          }
00427 
00428             // Add "special"
00429          if ($fieldConfig['config']['special']) {
00430             $dataAcc = $this->selectAddSpecial($dataAcc, $elements, $fieldConfig['config']['special']);
00431          }
00432 
00433             // Add "foreign table" stuff:
00434          if ($TCA[$fieldConfig['config']['foreign_table']]) {
00435             $dataAcc = $this->selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row);
00436          }
00437 
00438             // Always keep the native order for display in interface:
00439          ksort($dataAcc);
00440       } else { // Normal, <= 1 -> value without title on it
00441          if ($TCA[$fieldConfig['config']['foreign_table']]) {
00442             // Getting the data
00443             $dataIds = $this->getDataIdList($elements, $fieldConfig, $row);
00444 
00445             if (!count($dataIds))   $dataIds = array(0);
00446             $dataAcc[]=$dataIds[0];
00447          } else {
00448             $dataAcc[]=$elements[0];
00449          }
00450       }
00451 
00452       return implode(',',$dataAcc);
00453    }

t3lib_transferData::renderRecord_SW data,
fieldConfig,
TSconfig,
table,
row,
field
 

Function with the switch() construct which triggers functions for processing of the data value depending on the TCA-config field type.

Parameters:
string Value to process
array TCA/columns array for field (independant of TCA for flexforms - coming from XML then)
array TSconfig (blank for flexforms for now)
string Table name
array The row array, always of the real record (also for flexforms)
string The field (empty for flexforms!)
Returns:
string Modified $value

Definition at line 325 of file class.t3lib_transferdata.php.

References renderRecord_flexProc(), renderRecord_groupProc(), renderRecord_selectProc(), and table().

Referenced by renderRecord_flexProc_procInData_travDS(), and renderRecordRaw().

00325                                                                               {
00326 
00327       switch((string)$fieldConfig['config']['type'])  {
00328          case 'group':
00329             $data = $this->renderRecord_groupProc($data,$fieldConfig,$TSconfig,$table,$row,$field);
00330          break;
00331          case 'select':
00332             $data = $this->renderRecord_selectProc($data,$fieldConfig,$TSconfig,$table,$row,$field);
00333          break;
00334          case 'flex':
00335             $data = $this->renderRecord_flexProc($data,$fieldConfig,$TSconfig,$table,$row,$field);
00336          break;
00337       }
00338 
00339       return $data;
00340    }

t3lib_transferData::renderRecord_typesProc totalRecordContent,
types_fieldConfig,
tscPID,
table,
pid
 

Processing of the content in $totalRecordcontent based on settings in the types-configuration.

Parameters:
array The array of values which has been processed according to their type (eg. "group" or "select")
array The "types" configuration for the current display of fields.
integer PAGE TSconfig PID
string Table name
integer PID value
Returns:
array The processed version of $totalRecordContent private

Definition at line 498 of file class.t3lib_transferdata.php.

References t3lib_parsehtml_proc::evalWriteFile().

Referenced by renderRecordRaw().

00498                                                                                                 {
00499       foreach($types_fieldConfig as $vconf)  {
00500 
00501             // Find file to write to, if configured:
00502          $eFile = t3lib_parsehtml_proc::evalWriteFile($vconf['spec']['static_write'],$totalRecordContent);
00503 
00504             // Write file configuration:
00505          if (is_array($eFile))   {
00506             if ($eFile['loadFromFileField'] && $totalRecordContent[$eFile['loadFromFileField']])   {
00507                   // Read the external file, and insert the content between the ###TYPO3_STATICFILE_EDIT### markers:
00508                $SW_fileContent = t3lib_div::getUrl($eFile['editFile']);
00509                $parseHTML = t3lib_div::makeInstance('t3lib_parsehtml_proc');
00510                $parseHTML->init('','');
00511 
00512                $totalRecordContent[$vconf['field']] = $parseHTML->getSubpart(
00513                   $SW_fileContent,
00514                   $eFile['markerField']&&trim($totalRecordContent[$eFile['markerField']])
00515                      ? trim($totalRecordContent[$eFile['markerField']])
00516                      : '###TYPO3_STATICFILE_EDIT###'
00517                );
00518             }
00519          }
00520       }
00521 
00522       return $totalRecordContent;
00523    }

t3lib_transferData::renderRecordRaw table,
id,
pid,
row,
TSconfig = '',
tscPID = 0
 

This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend! The objective with this function is to prepare the content for handling in TCEforms.

In opposite to renderRecord() this function do not prepare things like fetching TSconfig and others. The resulting, processed row will be returned.

Parameters:
string The table name
string The uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
integer The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
array The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
array Tsconfig array
integer PAGE TSconfig pid
Returns:
array Processed record data
See also:
renderRecord()

Definition at line 267 of file class.t3lib_transferdata.php.

References $TCA, t3lib_BEfunc::getTCAtypes(), regItem(), renderRecord_SW(), renderRecord_typesProc(), and table().

Referenced by renderRecord().

00267                                                                               {
00268       global $TCA;
00269 
00270       if(!is_array($TSconfig)) {
00271          $TSconfig = array();
00272       }
00273 
00274          // Create blank accumulation array:
00275       $totalRecordContent=array();
00276 
00277          // Traverse the configured columns for the table (TCA):
00278          // For each column configured, we will perform processing if needed based on the type (eg. for "group" and "select" types this is needed)
00279       t3lib_div::loadTCA($table);
00280       $copyOfColumns = $TCA[$table]['columns'];
00281       foreach($copyOfColumns as $field => $fieldConfig)  {
00282             // Set $data variable for the field, either inputted value from $row - or if not found, the default value as defined in the "config" array
00283          if (isset($row[$field]))   {
00284             $data = $row[$field];
00285          } else {
00286             $data = $fieldConfig['config']['default'];
00287          }
00288 
00289          $data = $this->renderRecord_SW($data,$fieldConfig,$TSconfig,$table,$row,$field);
00290 
00291             // Set the field in the accumulation array IF the $data variabel is set:
00292          $totalRecordContent[$field] = isset($data) ? $data : '';
00293       }
00294 
00295          // Further processing may apply for each field in the record depending on the settings in the "types" configuration (the list of fields to currently display for a record in TCEforms).
00296          // For instance this could be processing instructions for the Rich Text Editor.
00297       $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$totalRecordContent);
00298       if (is_array($types_fieldConfig))   {
00299          $totalRecordContent = $this->renderRecord_typesProc($totalRecordContent,$types_fieldConfig,$tscPID,$table,$pid);
00300       }
00301 
00302          // Register items, mostly for external use (overriding the regItem() function)
00303       foreach($totalRecordContent as $field => $data) {
00304          $this->regItem($table,$id,$field,$data);
00305       }
00306 
00307          // Finally, store the result:
00308       reset($totalRecordContent);
00309 
00310       return $totalRecordContent;
00311 
00312    }

t3lib_transferData::selectAddForeign dataAcc,
elements,
fieldConfig,
field,
TSconfig,
row
 

Adds the foreign record elements to $dataAcc, if any.

Parameters:
array Array with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed.
array The array of original elements - basically the field value exploded by ","
array Field configuration from TCA
string The field name
array TSconfig for the record
array The record
Returns:
array Modified $dataAcc array private
See also:
renderRecord_selectProc()

Definition at line 784 of file class.t3lib_transferdata.php.

References t3lib_BEfunc::exec_foreign_table_where_query(), getDataIdList(), t3lib_BEfunc::getRecordTitle(), and sL().

Referenced by renderRecord_selectProc().

00784                                                                                           {
00785       global $TCA;
00786 
00787          // Init:
00788       $recordList = Array();
00789 
00790          // foreign_table
00791       $subres = t3lib_BEfunc::exec_foreign_table_where_query($fieldConfig,$field,$TSconfig);
00792       while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres))  {
00793          $recordList[$subrow['uid']] = t3lib_BEfunc::getRecordTitle($fieldConfig['config']['foreign_table'],$subrow);
00794       }
00795 
00796          // neg_foreign_table
00797       if (is_array($TCA[$fieldConfig['config']['neg_foreign_table']]))  {
00798          $subres = t3lib_BEfunc::exec_foreign_table_where_query($fieldConfig,$field,$TSconfig,'neg_');
00799          while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres))  {
00800             $recordList[-$subrow['uid']] = t3lib_BEfunc::getRecordTitle($fieldConfig['config']['neg_foreign_table'],$subrow);
00801          }
00802       }
00803 
00804          // At this point all records that CAN be selected is found in $recordList
00805          // Now, get the data from loadDBgroup based on the input list of values.
00806       $dataIds = $this->getDataIdList($elements, $fieldConfig, $row);
00807       if ($fieldConfig['config']['MM'])   $dataAcc=array(); // Reset, if MM (which cannot bear anything but real relations!)
00808 
00809          // After this we can traverse the loadDBgroup values and match values with the list of possible values in $recordList:
00810       foreach($dataIds as $theId)   {
00811          if (isset($recordList[$theId]))  {
00812             $lPrefix = $this->sL($fieldConfig['config'][($theId>0?'':'neg_').'foreign_table_prefix']);
00813             if ($fieldConfig['config']['MM'])   {
00814                $dataAcc[]=rawurlencode($theId).'|'.rawurlencode(t3lib_div::fixed_lgd_cs($lPrefix.strip_tags($recordList[$theId]),$GLOBALS['BE_USER']->uc['titleLen']));
00815             } else {
00816                foreach($elements as $eKey => $value)  {
00817                   if (!strcmp($theId,$value))   {
00818                      $dataAcc[$eKey]=rawurlencode($theId).'|'.rawurlencode(t3lib_div::fixed_lgd_cs($lPrefix.strip_tags($recordList[$theId]),$GLOBALS['BE_USER']->uc['titleLen']));
00819                   }
00820                }
00821             }
00822          }
00823       }
00824 
00825       return $dataAcc;
00826    }

t3lib_transferData::selectAddSpecial dataAcc,
elements,
specialKey
 

Adding "special" types to the $dataAcc array of selector items.

Parameters:
array Array with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed.
array The array of original elements - basically the field value exploded by ","
string The "special" key from the TCA config of the field. Determines the type of processing in here.
Returns:
array Modified $dataAcc array private
See also:
renderRecord_selectProc()

Definition at line 660 of file class.t3lib_transferdata.php.

References $TCA, t3lib_BEfunc::getExcludeFields(), t3lib_BEfunc::getExplicitAuthFieldValues(), and t3lib_BEfunc::getSystemLanguages().

Referenced by renderRecord_selectProc().

00660                                                                {
00661       global $TCA;
00662 
00663          // Special select types:
00664       switch ((string)$specialKey)  {
00665          case 'tables':    // Listing all tables from $TCA:
00666             $tNames = array_keys($TCA);
00667             foreach($tNames as $tableName)   {
00668                foreach($elements as $eKey => $value)  {
00669                   if (!strcmp($tableName,$value))  {
00670                      $dataAcc[$eKey]=rawurlencode($value).'|'.rawurlencode($this->sL($TCA[$value]['ctrl']['title']));
00671                   }
00672                }
00673             }
00674          break;
00675          case 'pagetypes': // Listing all page types (doktype)
00676             $theTypes = $TCA['pages']['columns']['doktype']['config']['items'];
00677             if (is_array($theTypes))   {
00678                foreach($theTypes as $theTypesArrays)  {
00679                   foreach($elements as $eKey => $value)  {
00680                      if (!strcmp($theTypesArrays[1],$value))   {
00681                         $dataAcc[$eKey]=rawurlencode($value).'|'.rawurlencode($this->sL($theTypesArrays[0]));
00682                      }
00683                   }
00684                }
00685             }
00686          break;
00687          case 'exclude':      // Listing exclude fields.
00688             $theExcludeFields = t3lib_BEfunc::getExcludeFields();
00689 
00690             if (is_array($theExcludeFields)) {
00691                foreach($theExcludeFields as $theExcludeFieldsArrays) {
00692                   foreach($elements as $eKey => $value)  {
00693                      if (!strcmp($theExcludeFieldsArrays[1],$value)) {
00694                         $dataAcc[$eKey]=rawurlencode($value).'|'.rawurlencode(ereg_replace(':$','',$theExcludeFieldsArrays[0]));
00695                      }
00696                   }
00697                }
00698             }
00699          break;
00700          case 'explicitValues':
00701             $theTypes = t3lib_BEfunc::getExplicitAuthFieldValues();
00702 
00703             foreach($theTypes as $tableFieldKey => $theTypeArrays)   {
00704                if (is_array($theTypeArrays['items'])) {
00705                   foreach($theTypeArrays['items'] as $itemValue => $itemContent) {
00706                      foreach($elements as $eKey => $value)  {
00707                         if (!strcmp($tableFieldKey.':'.$itemValue.':'.$itemContent[0], $value)) {
00708                            $dataAcc[$eKey] = rawurlencode($value).'|'.rawurlencode('['.$itemContent[2].'] '.$itemContent[1]);
00709                         }
00710                      }
00711                   }
00712                }
00713             }
00714          break;
00715          case 'languages':
00716             $theLangs = t3lib_BEfunc::getSystemLanguages();
00717             foreach($theLangs as $lCfg)   {
00718                foreach($elements as $eKey => $value)  {
00719                   if (!strcmp($lCfg[1], $value))   {
00720                      $dataAcc[$eKey] = rawurlencode($value).'|'.rawurlencode($lCfg[0]);
00721                   }
00722                }
00723             }
00724          break;
00725          case 'custom':
00726             $customOptions = $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'];
00727 
00728             if (is_array($customOptions)) {
00729                foreach($customOptions as $coKey => $coValue) {
00730                   if (is_array($coValue['items'])) {
00731                         // Traverse items:
00732                      foreach($coValue['items'] as $itemKey => $itemCfg) {
00733                         foreach($elements as $eKey => $value)  {
00734                            if (!strcmp($coKey.':'.$itemKey, $value)) {
00735                               $dataAcc[$eKey] = rawurlencode($value).'|'.rawurlencode($GLOBALS['LANG']->sl($itemCfg[0]));
00736                            }
00737                         }
00738                      }
00739                   }
00740                }
00741             }
00742          break;
00743          case 'modListGroup': // Listing modules for GROUPS
00744          case 'modListUser':     // Listing modules for USERS:
00745             if (!$this->loadModules)   {
00746                $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00747                $this->loadModules->load($GLOBALS['TBE_MODULES']);
00748             }
00749             $modList = ($specialKey=='modListUser') ? $this->loadModules->modListUser : $this->loadModules->modListGroup;
00750 
00751             foreach($modList as $theModName) {
00752                foreach($elements as $eKey => $value)  {
00753                   $label = '';
00754                      // Add label for main module:
00755                   $pp = explode('_',$value);
00756                   if (count($pp)>1) $label.=$GLOBALS['LANG']->moduleLabels['tabs'][$pp[0].'_tab'].'>';
00757                      // Add modules own label now:
00758                   $label.= $GLOBALS['LANG']->moduleLabels['tabs'][$value.'_tab'];
00759 
00760                   if (!strcmp($theModName,$value)) {
00761                      $dataAcc[$eKey]=rawurlencode($value).'|'.rawurlencode($label);
00762                   }
00763                }
00764             }
00765          break;
00766       }
00767 
00768       return $dataAcc;
00769    }

t3lib_transferData::sL in  ) 
 

Local wrapper function for LANG->sL (returning language labels).

Parameters:
string Language label key
Returns:
string Localized label value. private

Definition at line 959 of file class.t3lib_transferdata.php.

Referenced by selectAddForeign().

00959                      {
00960       return $GLOBALS['LANG']->sL($in);
00961    }


Member Data Documentation

t3lib_transferData::$addRawData = FALSE
 

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

t3lib_transferData::$defVals = array()
 

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

t3lib_transferData::$disableRTE = 0
 

Definition at line 101 of file class.t3lib_transferdata.php.

t3lib_transferData::$loadModules = ''
 

Definition at line 109 of file class.t3lib_transferdata.php.

t3lib_transferData::$lockRecords = 0
 

Definition at line 100 of file class.t3lib_transferdata.php.

t3lib_transferData::$prevPageID = ''
 

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

t3lib_transferData::$regTableItems = Array()
 

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

t3lib_transferData::$regTableItems_data = Array()
 

Definition at line 108 of file class.t3lib_transferdata.php.


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