ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilADTGroup Class Reference
+ Inheritance diagram for ilADTGroup:
+ Collaboration diagram for ilADTGroup:

Public Member Functions

 __clone ()
 
 reset ()
 Init property defaults. More...
 
 hasElement (string $a_name)
 
 getElement (string $a_name)
 
 getElements ()
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isNull ()
 Is currently null. More...
 
 getValidationErrorsByElements ()
 
 getValidationErrors ()
 @inheritcoc More...
 
 isValid ()
 
 translateErrorCode (string $a_code)
 @inheritcoc More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 
- 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)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 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.

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

References $id.

◆ addElement()

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

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

62 : void
63 {
64 $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
65 }

References ilADTFactory\getInstance().

Referenced by setDefinition().

+ 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.

123 : void
124 {
125 $this->validation_errors[$a_error_code] = $a_element_id;
126 }

Referenced by isValid().

+ Here is the caller graph for this function:

◆ equals()

ilADTGroup::equals ( ilADT  $a_adt)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool|null

Reimplemented from ilADT.

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

85 : ?bool
86 {
87 if ($this->getDefinition()->isComparableTo($a_adt)) {
88 return ($this->getCheckSum() == $a_adt->getCheckSum());
89 }
90 return null;
91 }
getCheckSum()
Get unique checksum.
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTGroup::exportStdClass ( )

Export value as stdClass.

Returns
stdClass | null

Reimplemented from ilADT.

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

171 : ?stdClass
172 {
173 $obj = new stdClass();
174 foreach ($this->getElements() as $id => $element) {
175 $obj->$id = $element->exportStdClass();
176 }
177 return $obj;
178 }

References $id, and getElements().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

Get unique checksum.

Returns
string | null

Reimplemented from ilADT.

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

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 }
isNull()
Is currently null.

References getElements(), and isNull().

Referenced by equals().

+ 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.

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:26

References hasElement().

Referenced by translateErrorCode().

+ 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.

80 : array
81 {
82 return $this->elements;
83 }

References $elements.

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

+ Here is the caller graph for this function:

◆ getValidationErrors()

ilADTGroup::getValidationErrors ( )

@inheritcoc

Reimplemented from ilADT.

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.

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

References ilADT\$validation_errors.

◆ hasElement()

ilADTGroup::hasElement ( string  $a_name)

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

67 : bool
68 {
69 return array_key_exists($a_name, $this->elements);
70 }

Referenced by getElement().

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTGroup::importStdClass ( ?stdClass  $a_std)

Import value from stdClass.

Parameters
stdClass  |  null$a_std

Reimplemented from ilADT.

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

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 }

References $id, and getElements().

+ Here is the call graph for this function:

◆ isLarger()

ilADTGroup::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

93 : ?bool
94 {
95 return null;
96 }

◆ isNull()

ilADTGroup::isNull ( )

Is currently null.

Returns
bool | null

Reimplemented from ilADT.

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

105 : bool
106 {
107 return !count($this->getElements());
108 }

References getElements().

Referenced by getCheckSum(), and isValid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTGroup::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool | null

Reimplemented from ilADT.

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

98 : ?bool
99 {
100 return null;
101 }

◆ isValid()

ilADTGroup::isValid ( )

Reimplemented from ilADT.

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

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 }
addElementValidationError(string $a_element_id, string $a_error_code)
$valid

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

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTGroup::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Parameters
ilADTDefinition$a_def
Returns
bool

Reimplemented from ilADT.

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

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

◆ reset()

ilADTGroup::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

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 }

References $elements, and getElements().

+ Here is the call graph for this function:

◆ setDefinition()

ilADTGroup::setDefinition ( ilADTDefinition  $a_def)
protected

Set definition.

Parameters
ilADTDefinition$a_def
Exceptions
ilException

Reimplemented from ilADT.

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

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)

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

+ Here is the call graph for this function:

◆ translateErrorCode()

ilADTGroup::translateErrorCode ( string  $a_code)

@inheritcoc

Reimplemented from ilADT.

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

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)

References getElement().

+ 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(), and reset().


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