ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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)
 
 addValidationError ($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"
 

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  {
11  foreach($this->elements as $id => $element)
12  {
13  $this->elements[$id] = clone $element;
14  }
15  }
16  }

◆ addElement()

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

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

References ilADTFactory\getInstance().

Referenced by setDefinition().

59  {
60  $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
61  }
static getInstance()
Get singleton.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addValidationError()

ilADTGroup::addValidationError (   $a_element_id,
  $a_error_code 
)
protected

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

Referenced by isValid().

125  {
126  $this->validation_errors[(string)$a_error_code] = $a_element_id;
127  }
+ 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(), and ilADT\getDefinition().

86  {
87  if($this->getDefinition()->isComparableTo($a_adt))
88  {
89  return ($this->getCheckSum() == $a_adt->getCheckSum());
90  }
91  }
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:99
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

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

References getElements(), and isNull().

Referenced by equals().

168  {
169  if(!$this->isNull())
170  {
171  $tmp = array();
172  foreach($this->getElements() as $element)
173  {
174  $tmp[] = $element->getCheckSum();
175  }
176  return md5(implode(",", $tmp));
177  }
178  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElement()

ilADTGroup::getElement (   $a_name)

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

References hasElement().

Referenced by translateErrorCode().

69  {
70  if($this->hasElement($a_name))
71  {
72  return $this->elements[$a_name];
73  }
74  }
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 76 of file class.ilADTGroup.php.

References $elements.

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

77  {
78  return $this->elements;
79  }
+ Here is the caller graph for this function:

◆ getValidationErrors()

ilADTGroup::getValidationErrors ( )

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

120  {
121  return array_keys((array)$this->validation_errors);
122  }

◆ getValidationErrorsByElements()

ilADTGroup::getValidationErrorsByElements ( )

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

References ilADT\$validation_errors.

115  {
116  return (array)$this->validation_errors;
117  }
$validation_errors
Definition: class.ilADT.php:14

◆ hasElement()

ilADTGroup::hasElement (   $a_name)

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

Referenced by getElement().

64  {
65  return array_key_exists($a_name, $this->elements);
66  }
+ Here is the caller graph for this function:

◆ isLarger()

ilADTGroup::isLarger ( ilADT  $a_adt)

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

94  {
95  // return null?
96  }

◆ isNull()

ilADTGroup::isNull ( )

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

References getElements().

Referenced by getCheckSum(), and isValid().

107  {
108  return !sizeof($this->getElements());
109  }
+ 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.

99  {
100  // return null?
101  }

◆ isValid()

ilADTGroup::isValid ( )

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

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

130  {
131  $valid = parent::isValid();
132 
133  if(!$this->isNull())
134  {
135  foreach($this->getElements() as $element_id => $element)
136  {
137  if(!$element->isValid())
138  {
139  foreach($element->getValidationErrors() as $error)
140  {
141  $this->addValidationError($element_id, $error);
142  }
143  $valid = false;
144  }
145  }
146  }
147 
148  return $valid;
149  }
addValidationError($a_element_id, $a_error_code)
$valid
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTGroup::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

22  {
23  return ($a_def instanceof ilADTGroupDefinition);
24  }

◆ reset()

ilADTGroup::reset ( )

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

References $elements, and getElements().

42  {
43  parent::reset();
44 
45  $elements = $this->getElements();
46  if(is_array($elements))
47  {
48  foreach($elements as $element)
49  {
50  $element->reset();
51  }
52  }
53  }
+ Here is the call graph for this function:

◆ setDefinition()

ilADTGroup::setDefinition ( ilADTDefinition  $a_def)
protected

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

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

27  {
28  parent::setDefinition($a_def);
29 
30  $this->elements = array();
31 
32  foreach($this->getDefinition()->getElements() as $name => $def)
33  {
34  $this->addElement($name, $def);
35  }
36  }
addElement($a_name, ilADTDefinition $a_def)
getDefinition()
Get definition.
Definition: class.ilADT.php:99
+ Here is the call graph for this function:

◆ translateErrorCode()

ilADTGroup::translateErrorCode (   $a_code)

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

References getElement().

152  {
153  if(isset($this->validation_errors[$a_code]))
154  {
155  $element_id = $this->validation_errors[$a_code];
156  $element = $this->getElement($element_id);
157  if($element)
158  {
159  return $element->translateErrorCode($a_code);
160  }
161  }
162  }
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: