ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilADTGroup Class Reference
+ Inheritance diagram for ilADTGroup:
+ Collaboration diagram for ilADTGroup:

Public Member Functions

 __clone ()
 
 reset ()
 
 hasElement ($a_name)
 
 getElement ($a_name)
 
 getElements ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 getValidationErrorsByElements ()
 
 getValidationErrors ()
 
 isValid ()
 
 translateErrorCode ($a_code)
 
 getCheckSum ()
 
- 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...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 
 setDefinition (ilADTDefinition $a_def)
 
 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.

References $id.

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

◆ addElement()

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

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

References ilADTFactory\getInstance().

Referenced by setDefinition().

54  {
55  $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
56  }
static getInstance()
Get singleton.
+ 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.

Referenced by isValid().

118  {
119  $this->validation_errors[(string) $a_error_code] = $a_element_id;
120  }
+ Here is the caller graph for this function:

◆ equals()

ilADTGroup::equals ( ilADT  $a_adt)

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

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

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

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

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

References getElements(), and isNull().

Referenced by equals().

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

References hasElement().

Referenced by translateErrorCode().

64  {
65  if ($this->hasElement($a_name)) {
66  return $this->elements[$a_name];
67  }
68  }
hasElement($a_name)
+ 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.

References $elements.

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

71  {
72  return $this->elements;
73  }
+ Here is the caller graph for this function:

◆ getValidationErrors()

ilADTGroup::getValidationErrors ( )

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.

References ilADT\$validation_errors.

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

◆ hasElement()

ilADTGroup::hasElement (   $a_name)

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

Referenced by getElement().

59  {
60  return array_key_exists($a_name, $this->elements);
61  }
+ Here is the caller graph for this function:

◆ isLarger()

ilADTGroup::isLarger ( ilADT  $a_adt)

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

87  {
88  // return null?
89  }

◆ isNull()

ilADTGroup::isNull ( )

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

References getElements().

Referenced by getCheckSum(), and isValid().

100  {
101  return !sizeof($this->getElements());
102  }
+ 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 91 of file class.ilADTGroup.php.

92  {
93  // return null?
94  }

◆ isValid()

ilADTGroup::isValid ( )

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

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

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  }
$valid
addElementValidationError($a_element_id, $a_error_code)
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTGroup::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

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

◆ reset()

ilADTGroup::reset ( )

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

References $elements, and getElements().

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  }
+ Here is the call graph for this function:

◆ setDefinition()

ilADTGroup::setDefinition ( ilADTDefinition  $a_def)
protected

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

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

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)
$def
Definition: croninfo.php:21
getDefinition()
Get definition.
Definition: class.ilADT.php:97
+ Here is the call graph for this function:

◆ translateErrorCode()

ilADTGroup::translateErrorCode (   $a_code)

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

References getElement().

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)
+ 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: