ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilADTGroupActiveRecordBridge.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 {
10  protected array $elements = [];
11 
12  protected function isValidADT(ilADT $a_adt): bool
13  {
14  return ($a_adt instanceof ilADTGroup);
15  }
16 
20  public function getFieldValue(string $a_field_name)
21  {
22  return '';
23  }
24 
28  public function setFieldValue(string $a_field_name, $a_field_value): void
29  {
30  }
31 
32  // elements
33 
34  protected function prepareElements(): void
35  {
36  if (count($this->elements)) {
37  return;
38  }
39 
40  $this->elements = array();
42 
43  // convert ADTs to ActiveRecord bridges
44 
45  foreach ($this->getADT()->getElements() as $name => $element) {
46  $this->elements[$name] = $factory->getActiveRecordBridgeForInstance($element);
47  $this->elements[$name]->setElementId($name);
48  }
49  }
50 
51  public function getElements(): array
52  {
53  $this->prepareElements();
54  return $this->elements;
55  }
56 
57  public function getElement(string $a_element_id): ?ilADTActiveRecordBridge
58  {
59  if (array_key_exists($a_element_id, $this->getElements())) {
60  return $this->elements[$a_element_id];
61  }
62  return null;
63  }
64 
65  public function getActiveRecordFields(): array
66  {
67  $fields = array();
68  foreach ($this->getElements() as $element_id => $element) {
69  $element_fields = $element->getActiveRecordFields();
70  if ($element_fields) {
71  $fields[$element_id] = $element_fields;
72  }
73  }
74  return $fields;
75  }
76 }
ADT base class.
Definition: class.ilADT.php:11
if($format !==null) $name
Definition: metadata.php:247
setFieldValue(string $a_field_name, $a_field_value)
$factory
Definition: metadata.php:75