ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilADTMultiText Class Reference
+ Inheritance diagram for ilADTMultiText:
+ Collaboration diagram for ilADTMultiText:

Public Member Functions

 reset ()
 
 setTextElements (array $a_values=null)
 
 getTextElements ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 isValid ()
 
 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)
 
- 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

 $values
 
- 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.ilADTMultiText.php.

Member Function Documentation

◆ equals()

ilADTMultiText::equals ( ilADT  $a_adt)

Definition at line 52 of file class.ilADTMultiText.php.

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

53  {
54  if ($this->getDefinition()->isComparableTo($a_adt)) {
55  return ($this->getCheckSum() == $a_adt->getCheckSum());
56  }
57  }
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:97
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

Definition at line 109 of file class.ilADTMultiText.php.

References getTextElements(), and isNull().

Referenced by equals().

110  {
111  if (!$this->isNull()) {
112  $elements = $this->getTextElements();
113  sort($elements);
114  return md5(implode("", $elements));
115  }
116  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextElements()

ilADTMultiText::getTextElements ( )

Definition at line 44 of file class.ilADTMultiText.php.

References $values.

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

45  {
46  return $this->values;
47  }
+ Here is the caller graph for this function:

◆ isLarger()

ilADTMultiText::isLarger ( ilADT  $a_adt)

Definition at line 59 of file class.ilADTMultiText.php.

60  {
61  // return null?
62  }

◆ isNull()

ilADTMultiText::isNull ( )

Definition at line 72 of file class.ilADTMultiText.php.

References getTextElements().

Referenced by getCheckSum(), and isValid().

73  {
74  $all = $this->getTextElements();
75  return (!is_array($all) || !sizeof($all));
76  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTMultiText::isSmaller ( ilADT  $a_adt)

Definition at line 64 of file class.ilADTMultiText.php.

65  {
66  // return null?
67  }

◆ isValid()

ilADTMultiText::isValid ( )

Definition at line 81 of file class.ilADTMultiText.php.

References $valid, ilADT\addValidationError(), ilADT\getDefinition(), getTextElements(), and isNull().

82  {
83  $valid = parent::isValid();
84 
85  if (!$this->isNull()) {
86  $max_size = $this->getDefinition()->getMaxSize();
87  if ($max_size && $max_size < sizeof($this->getTextElements())) {
88  $valid = false;
89  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_SIZE);
90  }
91 
92  $max_len = $this->getDefinition()->getMaxLength();
93  if ($max_len) {
94  foreach ($this->getTextElements() as $element) {
95  if ($max_len < strlen($element)) {
96  $valid = false;
97  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
98  }
99  }
100  }
101  }
102 
103  return $valid;
104  }
$valid
addValidationError($a_error_code)
Add validation error code.
getDefinition()
Get definition.
Definition: class.ilADT.php:97
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTMultiText::isValidDefinition ( ilADTDefinition  $a_def)
protected

Definition at line 10 of file class.ilADTMultiText.php.

11  {
12  return ($a_def instanceof ilADTMultiTextDefinition);
13  }

◆ reset()

ilADTMultiText::reset ( )

Definition at line 15 of file class.ilADTMultiText.php.

16  {
17  parent::reset();
18 
19  $this->values = null;
20  }

◆ setTextElements()

ilADTMultiText::setTextElements ( array  $a_values = null)

Definition at line 25 of file class.ilADTMultiText.php.

26  {
27  if (is_array($a_values)) {
28  if (sizeof($a_values)) {
29  foreach ($a_values as $idx => $element) {
30  $a_values[$idx]= trim($element);
31  if (!$a_values[$idx]) {
32  unset($a_values[$idx]);
33  }
34  }
35  $a_values = array_unique($a_values);
36  }
37  if (!sizeof($a_values)) {
38  $a_values = null;
39  }
40  }
41  $this->values = $a_values;
42  }

Field Documentation

◆ $values

ilADTMultiText::$values
protected

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

Referenced by getTextElements().


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