ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 21 of file class.ilADTGroup.php.

Member Function Documentation

◆ __clone()

ilADTGroup::__clone ( )

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

References $id.

26  {
27  if (is_array($this->elements)) {
28  foreach ($this->elements as $id => $element) {
29  $this->elements[$id] = clone $element;
30  }
31  }
32  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ addElement()

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

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

References ilADTFactory\getInstance().

Referenced by setDefinition().

62  : void
63  {
64  $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
65  }
+ 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 123 of file class.ilADTGroup.php.

Referenced by isValid().

123  : void
124  {
125  $this->validation_errors[$a_error_code] = $a_element_id;
126  }
+ Here is the caller graph for this function:

◆ equals()

ilADTGroup::equals ( ilADT  $a_adt)

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

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

85  : ?bool
86  {
87  if ($this->getDefinition()->isComparableTo($a_adt)) {
88  return ($this->getCheckSum() == $a_adt->getCheckSum());
89  }
90  return null;
91  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTGroup::exportStdClass ( )

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

References $id, and getElements().

171  : ?stdClass
172  {
173  $obj = new stdClass();
174  foreach ($this->getElements() as $id => $element) {
175  $obj->$id = $element->exportStdClass();
176  }
177  return $obj;
178  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

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

References getElements(), isNull(), and null.

Referenced by equals().

159  : ?string
160  {
161  if (!$this->isNull()) {
162  $tmp = [];
163  foreach ($this->getElements() as $element) {
164  $tmp[] = $element->getCheckSum();
165  }
166  return md5(implode(",", $tmp));
167  }
168  return null;
169  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 72 of file class.ilADTGroup.php.

References hasElement(), and null.

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

72  : ?ilADT
73  {
74  if ($this->hasElement($a_name)) {
75  return $this->elements[$a_name];
76  }
77  return null;
78  }
hasElement(string $a_name)
ADT base class.
Definition: class.ilADT.php:25
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElements()

ilADTGroup::getElements ( )

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

References $elements.

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

80  : array
81  {
82  return $this->elements;
83  }
+ Here is the caller graph for this function:

◆ getValidationErrors()

ilADTGroup::getValidationErrors ( )

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

118  : array
119  {
120  return array_keys($this->validation_errors);
121  }

◆ getValidationErrorsByElements()

ilADTGroup::getValidationErrorsByElements ( )

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

References ilADT\$validation_errors.

110  : array
111  {
113  }
array $validation_errors
Definition: class.ilADT.php:31

◆ hasElement()

ilADTGroup::hasElement ( string  $a_name)

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

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

67  : bool
68  {
69  return array_key_exists($a_name, $this->elements);
70  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTGroup::importStdClass ( ?stdClass  $a_std)

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

References $id, and getElements().

180  : void
181  {
182  if (is_object($a_std)) {
183  foreach ($this->getElements() as $id => $element) {
184  $element->importStdClass($a_std->$id);
185  }
186  }
187  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ isLarger()

ilADTGroup::isLarger ( ilADT  $a_adt)

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

References null.

93  : ?bool
94  {
95  return null;
96  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isNull()

ilADTGroup::isNull ( )

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

References getElements().

Referenced by getCheckSum(), and isValid().

105  : bool
106  {
107  return !count($this->getElements());
108  }
+ 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 98 of file class.ilADTGroup.php.

References null.

98  : ?bool
99  {
100  return null;
101  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isValid()

ilADTGroup::isValid ( )

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

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

128  : bool
129  {
130  $valid = parent::isValid();
131  if (!$this->isNull()) {
132  foreach ($this->getElements() as $element_id => $element) {
133  if (!$element->isValid()) {
134  foreach ($element->getValidationErrors() as $error) {
135  $this->addElementValidationError((string) $element_id, $error);
136  }
137  $valid = false;
138  }
139  }
140  }
141  return $valid;
142  }
$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 34 of file class.ilADTGroup.php.

34  : bool
35  {
36  return ($a_def instanceof ilADTGroupDefinition);
37  }

◆ reset()

ilADTGroup::reset ( )

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

References getElements().

50  : void
51  {
52  parent::reset();
53 
54  $elements = $this->getElements();
55  if (is_array($elements)) {
56  foreach ($elements as $element) {
57  $element->reset();
58  }
59  }
60  }
+ Here is the call graph for this function:

◆ setDefinition()

ilADTGroup::setDefinition ( ilADTDefinition  $a_def)
protected

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

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

39  : void
40  {
41  parent::setDefinition($a_def);
42 
43  $this->elements = array();
44 
45  foreach ($this->getDefinition()->getElements() as $name => $def) {
46  $this->addElement((string) $name, $def);
47  }
48  }
addElement(string $a_name, ilADTDefinition $a_def)
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ translateErrorCode()

ilADTGroup::translateErrorCode ( string  $a_code)

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

References getElement().

147  : string
148  {
149  if (isset($this->validation_errors[$a_code])) {
150  $element_id = $this->validation_errors[$a_code];
151  $element = $this->getElement($element_id);
152  if ($element) {
153  return $element->translateErrorCode($a_code);
154  }
155  }
156  return parent::translateErrorCode($a_code);
157  }
getElement(string $a_name)
+ Here is the call graph for this function:

Field Documentation

◆ $elements

array ilADTGroup::$elements = []
protected

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

Referenced by getElements().


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