ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
21  return;
22  }
23 
24  $this->elements = array();
25  $factory = ilADTFactory::getInstance();
26 
27  // convert ADTs to ActiveRecord bridges
28 
29  foreach($this->getADT()->getElements() as $name => $element)
30  {
31  $this->elements[$name] = $factory->getActiveRecordBridgeForInstance($element);
32  $this->elements[$name]->setElementId($name);
33  }
34  }
35 
36  public function getElements()
37  {
38  $this->prepareElements();
39  return $this->elements;
40  }
41 
42  public function getElement($a_element_id)
43  {
44  if(array_key_exists($a_element_id, $this->getElements()))
45  {
46  return $this->elements[$a_element_id];
47  }
48  }
49 
50  //
51  // active record
52  //
53 
54  public function getActiveRecordFields()
55  {
56  $fields = array();
57  foreach($this->getElements() as $element_id => $element)
58  {
59  $element_fields = $element->getActiveRecordFields();
60  if($element_fields)
61  {
62  $fields[$element_id] = $element_fields;
63  }
64  }
65  return $fields;
66  }
67 }
static getInstance()
Get singleton.
ADT base class.
Definition: class.ilADT.php:11
Create styles array
The data for the language used.