ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilADTGroup Class Reference
+ Inheritance diagram for ilADTGroup:
+ Collaboration diagram for ilADTGroup:

Public Member Functions

 __clone ()
 
 reset ()
 Init property defaults. More...
 
 hasElement ($a_name)
 
 getElement ($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 ()
 Get all validation error codes. More...
 
 isValid ()
 Is currently valid. More...
 
 translateErrorCode ($a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass ($a_std)
 Import value from stdClass. More...
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 Constructor. More...
 
 getType ()
 Get type (from class/instance) 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)
 Check if given ADT is larger or equal than self. More...
 
 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 ()
 Is currently valid. More...
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode ($a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass ($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 ($a_name, ilADTDefinition $a_def)
 
 addElementValidationError ($a_element_id, $a_error_code)
 
- Protected Member Functions inherited from ilADT
 reset ()
 Init property defaults. More...
 
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError ($a_error_code)
 Add validation error code. More...
 

Protected Attributes

 $elements
 
- Protected Attributes inherited from ilADT
 $definition
 
 $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 3 of file class.ilADTGroup.php.

Member Function Documentation

◆ __clone()

ilADTGroup::__clone ( )

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

8 {
9 if (is_array($this->elements)) {
10 foreach ($this->elements as $id => $element) {
11 $this->elements[$id] = clone $element;
12 }
13 }
14 }

◆ addElement()

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

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

54 {
55 $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
56 }
static getInstance()
Get singleton.

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 (   $a_element_id,
  $a_error_code 
)
protected

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

118 {
119 $this->validation_errors[(string) $a_error_code] = $a_element_id;
120 }

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

Reimplemented from ilADT.

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

80 {
81 if ($this->getDefinition()->isComparableTo($a_adt)) {
82 return ($this->getCheckSum() == $a_adt->getCheckSum());
83 }
84 }
getCheckSum()
Get unique checksum.
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:97

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTGroup::exportStdClass ( )

Export value as stdClass.

Returns
stdClass

Reimplemented from ilADT.

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

169 {
170 $obj = new stdClass();
171 foreach ($this->getElements() as $id => $element) {
172 $obj->$id = $element->exportStdClass();
173 }
174 return $obj;
175 }

References getElements().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

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

155 {
156 if (!$this->isNull()) {
157 $tmp = array();
158 foreach ($this->getElements() as $element) {
159 $tmp[] = $element->getCheckSum();
160 }
161 return md5(implode(",", $tmp));
162 }
163 }
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 (   $a_name)

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

64 {
65 if ($this->hasElement($a_name)) {
66 return $this->elements[$a_name];
67 }
68 }
hasElement($a_name)

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 70 of file class.ilADTGroup.php.

71 {
72 return $this->elements;
73 }

References $elements.

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

+ Here is the caller graph for this function:

◆ getValidationErrors()

ilADTGroup::getValidationErrors ( )

Get all validation error codes.

See also
isValid()
Returns
array

Reimplemented from ilADT.

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

113 {
114 return array_keys((array) $this->validation_errors);
115 }

◆ getValidationErrorsByElements()

ilADTGroup::getValidationErrorsByElements ( )

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

108 {
109 return (array) $this->validation_errors;
110 }
$validation_errors
Definition: class.ilADT.php:14

References ilADT\$validation_errors.

◆ hasElement()

ilADTGroup::hasElement (   $a_name)

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

59 {
60 return array_key_exists($a_name, $this->elements);
61 }

Referenced by getElement().

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTGroup::importStdClass (   $a_std)

Import value from stdClass.

Parameters
stdClass$a_std

Reimplemented from ilADT.

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

178 {
179 if (is_object($a_std)) {
180 foreach ($this->getElements() as $id => $element) {
181 $element->importStdClass($a_std->$id);
182 }
183 }
184 }

References 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 86 of file class.ilADTGroup.php.

87 {
88 // return null?
89 }

◆ isNull()

ilADTGroup::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

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

100 {
101 return !sizeof($this->getElements());
102 }

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

Reimplemented from ilADT.

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

92 {
93 // return null?
94 }

◆ isValid()

ilADTGroup::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

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

123 {
124 $valid = parent::isValid();
125
126 if (!$this->isNull()) {
127 foreach ($this->getElements() as $element_id => $element) {
128 if (!$element->isValid()) {
129 foreach ($element->getValidationErrors() as $error) {
130 $this->addElementValidationError($element_id, $error);
131 }
132 $valid = false;
133 }
134 }
135 }
136
137 return $valid;
138 }
addElementValidationError($a_element_id, $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.

Returns
bool;

Reimplemented from ilADT.

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

20 {
21 return ($a_def instanceof ilADTGroupDefinition);
22 }

◆ reset()

ilADTGroup::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

39 {
40 parent::reset();
41
42 $elements = $this->getElements();
43 if (is_array($elements)) {
44 foreach ($elements as $element) {
45 $element->reset();
46 }
47 }
48 }

References $elements, and getElements().

+ Here is the call graph for this function:

◆ setDefinition()

ilADTGroup::setDefinition ( ilADTDefinition  $a_def)
protected

Set definition.

Exceptions
ilException
Parameters
ilADTDefinition$a_def

Reimplemented from ilADT.

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

25 {
26 parent::setDefinition($a_def);
27
28 $this->elements = array();
29
30 foreach ($this->getDefinition()->getElements() as $name => $def) {
31 $this->addElement($name, $def);
32 }
33 }
addElement($a_name, ilADTDefinition $a_def)
if($format !==null) $name
Definition: metadata.php:230

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

+ Here is the call graph for this function:

◆ translateErrorCode()

ilADTGroup::translateErrorCode (   $a_code)

Translate error-code to human-readable message.

Exceptions
Exception
Parameters
int$a_code
Returns
string

Reimplemented from ilADT.

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

141 {
142 if (isset($this->validation_errors[$a_code])) {
143 $element_id = $this->validation_errors[$a_code];
144 $element = $this->getElement($element_id);
145 if ($element) {
146 return $element->translateErrorCode($a_code);
147 }
148 }
149 }
getElement($a_name)

References getElement().

+ Here is the call graph for this function:

Field Documentation

◆ $elements

ilADTGroup::$elements
protected

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

Referenced by getElements(), and reset().


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