ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilADTGroupActiveRecordBridge.php
Go to the documentation of this file.
1 <?php
2 
3 require_once "Services/ADT/classes/Bridges/class.ilADTActiveRecordBridge.php";
4 
6 {
7  protected $elements = []; // [array]
8 
9  protected function isValidADT(ilADT $a_adt)
10  {
11  return ($a_adt instanceof ilADTGroup);
12  }
13 
14 
15  // elements
16 
17  protected function prepareElements()
18  {
19  if (sizeof($this->elements)) {
20  return;
21  }
22 
23  $this->elements = array();
25 
26  // convert ADTs to ActiveRecord bridges
27 
28  foreach ($this->getADT()->getElements() as $name => $element) {
29  $this->elements[$name] = $factory->getActiveRecordBridgeForInstance($element);
30  $this->elements[$name]->setElementId($name);
31  }
32  }
33 
34  public function getElements()
35  {
36  $this->prepareElements();
37  return $this->elements;
38  }
39 
40  public function getElement($a_element_id)
41  {
42  if (array_key_exists($a_element_id, $this->getElements())) {
43  return $this->elements[$a_element_id];
44  }
45  }
46 
47  //
48  // active record
49  //
50 
51  public function getActiveRecordFields()
52  {
53  $fields = array();
54  foreach ($this->getElements() as $element_id => $element) {
55  $element_fields = $element->getActiveRecordFields();
56  if ($element_fields) {
57  $fields[$element_id] = $element_fields;
58  }
59  }
60  return $fields;
61  }
62 }
$factory
Definition: metadata.php:43
static getInstance()
Get singleton.
ADT base class.
Definition: class.ilADT.php:11