class.ux_t3lib_transferdata.php

Administrator Admin, 2007-11-05 00:27

Download (2.12 KB)

 
1
<?php
2

    
3
/**
4
 * Class for getting and transforming data for display in backend forms (TCEforms)
5
 *
6
 * @author        Kasper Skaarhoj <kasperYYYY@typo3.com>
7
 * @package TYPO3
8
 * @subpackage t3lib
9
 */
10
class ux_t3lib_transferData extends t3lib_transferData {
11

    
12
        /**
13
         * Traverse data array / structure
14
         *
15
         * @param        array                Data array passed by reference.
16
         * @param        array                Data structure
17
         * @param        array                Various parameters pass-through.
18
         * @return        void
19
         * @see renderRecord_flexProc_procInData(), t3lib_TCEmain::checkValue_flex_procInData_travDS()
20
         */
21
        function renderRecord_flexProc_procInData_travDS(&$dataValues,$DSelements,$pParams)                {
22
                if (is_array($DSelements))        {
23

    
24
                                // For each DS element:
25
                        foreach($DSelements as $key => $dsConf)        {
26

    
27
                                                // Array/Section:
28
                                if ($DSelements[$key]['type']=='array')        {
29
                                        if (is_array($dataValues[$key]['el']))        {
30
                                                if ($DSelements[$key]['section'])        {
31
                                                        foreach($dataValues[$key]['el'] as $ik => $el)        {
32
                                                                $theKey = key($el);
33
                                                                if (is_array($dataValues[$key]['el'][$ik][$theKey]['el']))        {
34
                                                                        $this->renderRecord_flexProc_procInData_travDS(
35
                                                                                        $dataValues[$key]['el'][$ik][$theKey]['el'],
36
                                                                                        $DSelements[$key]['el'][$theKey]['el'],
37
                                                                                        $pParams
38
                                                                                );
39
                                                                }
40
                                                        }
41
                                                } else {
42
                                                        if (!isset($dataValues[$key]['el']))        $dataValues[$key]['el']=array();
43
                                                        $this->renderRecord_flexProc_procInData_travDS(
44
                                                                        $dataValues[$key]['el'],
45
                                                                        $DSelements[$key]['el'],
46
                                                                        $pParams
47
                                                                );
48
                                                }
49
                                        }
50
                                } else {
51
                                        if (is_array($dsConf['TCEforms']['config']) && is_array($dataValues[$key]))        {
52
                                                foreach($dataValues[$key] as $vKey => $data)        {
53

    
54
                                                                // $data,$fieldConfig,$TSconfig,$table,$row,$field
55
                                                        list(,,$CVTSconfig,$CVtable,$CVrow,$CVfield) = $pParams;
56

    
57
                                                                // Set default value:
58
                                                        if (!isset($dataValues[$key][$vKey]))        {
59
                                                                $dataValues[$key][$vKey] = $dsConf['TCEforms']['config']['default'];
60
                                                        }
61

    
62
                                                                // Process value:
63
                                                        $dataValues[$key][$vKey] = $this->renderRecord_SW($dataValues[$key][$vKey],$dsConf['TCEforms'],$CVTSconfig,$CVtable,$CVrow,'pi_flexform');
64
                                                }
65
                                        }
66
                                }
67
                        }
68
                }
69
        }
70

    
71
}
72

    
73
?>