ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilADTGroup Class Reference
+ Inheritance diagram for ilADTGroup:
+ Collaboration diagram for ilADTGroup:

Public Member Functions

 __clone ()
 
 reset ()
 
 hasElement (string $a_name)
 
 getElement (string $a_name)
 
 getElements ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 getValidationErrorsByElements ()
 
 getValidationErrors ()
 
 isValid ()
 
 translateErrorCode (string $a_code)
 
 getCheckSum ()
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode (string $a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 
 setDefinition (ilADTDefinition $a_def)
 
 addElement (string $a_name, ilADTDefinition $a_def)
 
 addElementValidationError (string $a_element_id, string $a_error_code)
 
- Protected Member Functions inherited from ilADT
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError (string $a_error_code)
 

Protected Attributes

array $elements = []
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $validation_errors = []
 

Additional Inherited Members

- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

Detailed Description

Definition at line 5 of file class.ilADTGroup.php.

Member Function Documentation

◆ __clone()

ilADTGroup::__clone ( )

Definition at line 9 of file class.ilADTGroup.php.

References $id.

10  {
11  if (is_array($this->elements)) {
12  foreach ($this->elements as $id => $element) {
13  $this->elements[$id] = clone $element;
14  }
15  }
16  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24

◆ addElement()

ilADTGroup::addElement ( string  $a_name,
ilADTDefinition  $a_def 
)
protected

Definition at line 46 of file class.ilADTGroup.php.

References ilADTFactory\getInstance().

Referenced by setDefinition().

46  : void
47  {
48  $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
49  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addElementValidationError()

ilADTGroup::addElementValidationError ( string  $a_element_id,
string  $a_error_code 
)
protected

Definition at line 107 of file class.ilADTGroup.php.

Referenced by isValid().

107  : void
108  {
109  $this->validation_errors[$a_error_code] = $a_element_id;
110  }
+ Here is the caller graph for this function:

◆ equals()

ilADTGroup::equals ( ilADT  $a_adt)

Definition at line 69 of file class.ilADTGroup.php.

References getCheckSum(), ilADT\getCheckSum(), and ilADT\getDefinition().

69  : ?bool
70  {
71  if ($this->getDefinition()->isComparableTo($a_adt)) {
72  return ($this->getCheckSum() == $a_adt->getCheckSum());
73  }
74  return null;
75  }
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTGroup::exportStdClass ( )

Definition at line 155 of file class.ilADTGroup.php.

References $id, and getElements().

155  : ?stdClass
156  {
157  $obj = new stdClass();
158  foreach ($this->getElements() as $id => $element) {
159  $obj->$id = $element->exportStdClass();
160  }
161  return $obj;
162  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

Definition at line 143 of file class.ilADTGroup.php.

References getElements(), and isNull().

Referenced by equals().

143  : ?string
144  {
145  if (!$this->isNull()) {
146  $tmp = [];
147  foreach ($this->getElements() as $element) {
148  $tmp[] = $element->getCheckSum();
149  }
150  return md5(implode(",", $tmp));
151  }
152  return null;
153  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElement()

ilADTGroup::getElement ( string  $a_name)

Definition at line 56 of file class.ilADTGroup.php.

References hasElement().

Referenced by ilAdvancedMDValues\queryForRecords(), and translateErrorCode().

56  : ?ilADT
57  {
58  if ($this->hasElement($a_name)) {
59  return $this->elements[$a_name];
60  }
61  return null;
62  }
hasElement(string $a_name)
ADT base class.
Definition: class.ilADT.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElements()

ilADTGroup::getElements ( )

Definition at line 64 of file class.ilADTGroup.php.

References $elements.

Referenced by exportStdClass(), getCheckSum(), importStdClass(), isNull(), isValid(), ilAdvancedMDValues\queryForRecords(), reset(), and setDefinition().

64  : array
65  {
66  return $this->elements;
67  }
+ Here is the caller graph for this function:

◆ getValidationErrors()

ilADTGroup::getValidationErrors ( )

Definition at line 102 of file class.ilADTGroup.php.

102  : array
103  {
104  return array_keys($this->validation_errors);
105  }

◆ getValidationErrorsByElements()

ilADTGroup::getValidationErrorsByElements ( )

Definition at line 94 of file class.ilADTGroup.php.

References ilADT\$validation_errors.

94  : array
95  {
97  }
array $validation_errors
Definition: class.ilADT.php:17

◆ hasElement()

ilADTGroup::hasElement ( string  $a_name)

Definition at line 51 of file class.ilADTGroup.php.

Referenced by getElement(), and ilAdvancedMDValues\queryForRecords().

51  : bool
52  {
53  return array_key_exists($a_name, $this->elements);
54  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTGroup::importStdClass ( ?stdClass  $a_std)

Definition at line 164 of file class.ilADTGroup.php.

References $id, and getElements().

164  : void
165  {
166  if (is_object($a_std)) {
167  foreach ($this->getElements() as $id => $element) {
168  $element->importStdClass($a_std->$id);
169  }
170  }
171  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ Here is the call graph for this function:

◆ isLarger()

ilADTGroup::isLarger ( ilADT  $a_adt)

Definition at line 77 of file class.ilADTGroup.php.

77  : ?bool
78  {
79  return null;
80  }

◆ isNull()

ilADTGroup::isNull ( )

Definition at line 89 of file class.ilADTGroup.php.

References getElements().

Referenced by getCheckSum(), and isValid().

89  : bool
90  {
91  return !count($this->getElements());
92  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTGroup::isSmaller ( ilADT  $a_adt)

Definition at line 82 of file class.ilADTGroup.php.

82  : ?bool
83  {
84  return null;
85  }

◆ isValid()

ilADTGroup::isValid ( )

Definition at line 112 of file class.ilADTGroup.php.

References $valid, addElementValidationError(), getElements(), and isNull().

112  : bool
113  {
114  $valid = parent::isValid();
115  if (!$this->isNull()) {
116  foreach ($this->getElements() as $element_id => $element) {
117  if (!$element->isValid()) {
118  foreach ($element->getValidationErrors() as $error) {
119  $this->addElementValidationError((string) $element_id, $error);
120  }
121  $valid = false;
122  }
123  }
124  }
125  return $valid;
126  }
$valid
addElementValidationError(string $a_element_id, string $a_error_code)
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTGroup::isValidDefinition ( ilADTDefinition  $a_def)
protected

Definition at line 18 of file class.ilADTGroup.php.

18  : bool
19  {
20  return ($a_def instanceof ilADTGroupDefinition);
21  }

◆ reset()

ilADTGroup::reset ( )

Definition at line 34 of file class.ilADTGroup.php.

References getElements().

34  : void
35  {
36  parent::reset();
37 
38  $elements = $this->getElements();
39  if (is_array($elements)) {
40  foreach ($elements as $element) {
41  $element->reset();
42  }
43  }
44  }
+ Here is the call graph for this function:

◆ setDefinition()

ilADTGroup::setDefinition ( ilADTDefinition  $a_def)
protected

Definition at line 23 of file class.ilADTGroup.php.

References addElement(), ilADT\getDefinition(), and getElements().

23  : void
24  {
25  parent::setDefinition($a_def);
26 
27  $this->elements = array();
28 
29  foreach ($this->getDefinition()->getElements() as $name => $def) {
30  $this->addElement((string) $name, $def);
31  }
32  }
addElement(string $a_name, ilADTDefinition $a_def)
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ translateErrorCode()

ilADTGroup::translateErrorCode ( string  $a_code)

Definition at line 131 of file class.ilADTGroup.php.

References getElement().

131  : string
132  {
133  if (isset($this->validation_errors[$a_code])) {
134  $element_id = $this->validation_errors[$a_code];
135  $element = $this->getElement($element_id);
136  if ($element) {
137  return $element->translateErrorCode($a_code);
138  }
139  }
140  return parent::translateErrorCode($a_code);
141  }
getElement(string $a_name)
+ Here is the call graph for this function:

Field Documentation

◆ $elements

array ilADTGroup::$elements = []
protected

Definition at line 7 of file class.ilADTGroup.php.

Referenced by getElements().


The documentation for this class was generated from the following file: