ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
- 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)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 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.

59 {
60 $this->elements[$a_name] = ilADTFactory::getInstance()->getInstanceByDefinition($a_def);
61 }
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:

◆ addValidationError()

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

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

125 {
126 $this->validation_errors[(string)$a_error_code] = $a_element_id;
127 }

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

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

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

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTGroup::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

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

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

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

77 {
78 return $this->elements;
79 }

References $elements.

Referenced by getCheckSum(), 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 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.

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

References ilADT\$validation_errors.

◆ hasElement()

ilADTGroup::hasElement (   $a_name)

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

64 {
65 return array_key_exists($a_name, $this->elements);
66 }

Referenced by getElement().

+ Here is the caller 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.

94 {
95 // return null?
96 }

◆ isNull()

ilADTGroup::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

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

107 {
108 return !sizeof($this->getElements());
109 }

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

99 {
100 // return null?
101 }

◆ isValid()

ilADTGroup::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

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

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

References $valid, addValidationError(), 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 21 of file class.ilADTGroup.php.

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

◆ reset()

ilADTGroup::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

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 }

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

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)

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

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)

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: