TYPO3 CMS  TYPO3_6-2
ResponseSection.php
Go to the documentation of this file.
1 <?php
3 
21 
25  protected $identifier;
26 
30  protected $structure;
31 
35  protected $structurePaths;
36 
40  protected $records;
41 
45  protected $queries;
46 
51  public function __construct($identifier, array $data) {
52  $this->identifier = (string)$identifier;
53  $this->structure = $data['structure'];
54  $this->structurePaths = $data['structurePaths'];
55  $this->records = $data['records'];
56 
57  if (!empty($data['queries'])) {
58  $this->queries = $data['queries'];
59  }
60  }
61 
65  public function getIdentifier() {
66  return $this->identifier;
67  }
68 
72  public function getStructure() {
73  return $this->structure;
74  }
75 
79  public function getStructurePaths() {
80  return $this->structurePaths;
81  }
82 
86  public function getRecords() {
87  return $this->records;
88  }
89 
93  public function getQueries() {
94  return $this->queries;
95  }
96 
102  public function findStructures($recordIdentifier, $fieldName = '') {
103  $structures = array();
104 
105  if (empty($this->structurePaths[$recordIdentifier])) {
106  return $structures;
107  }
108 
109  foreach ($this->structurePaths[$recordIdentifier] as $steps) {
111  $steps[] = $recordIdentifier;
112 
113  if (!empty($fieldName)) {
114  $steps[] = $fieldName;
115  }
116 
117  foreach ($steps as $step) {
118  if (!isset($structure[$step])) {
119  $structure = NULL;
120  break;
121  }
122  $structure = $structure[$step];
123  }
124 
125  if (!empty($structure)) {
126  $structures[implode('/', $steps)] = $structure;
127  }
128  }
129 
130  return $structures;
131  }
132 
133 }