ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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"
 

Detailed Description

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

Member Function Documentation

◆ equals()

ilADTMultiText::equals ( ilADT  $a_adt)

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

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

58  {
59  if($this->getDefinition()->isComparableTo($a_adt))
60  {
61  return ($this->getCheckSum() == $a_adt->getCheckSum());
62  }
63  }
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:99
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

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

References getTextElements(), and isNull().

Referenced by equals().

121  {
122  if(!$this->isNull())
123  {
124  $elements = $this->getTextElements();
125  sort($elements);
126  return md5(implode("", $elements));
127  }
128  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextElements()

ilADTMultiText::getTextElements ( )

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

References $values.

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

50  {
51  return $this->values;
52  }
+ Here is the caller graph for this function:

◆ isLarger()

ilADTMultiText::isLarger ( ilADT  $a_adt)

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

66  {
67  // return null?
68  }

◆ isNull()

ilADTMultiText::isNull ( )

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

References getTextElements().

Referenced by getCheckSum(), and isValid().

79  {
80  $all = $this->getTextElements();
81  return (!is_array($all) || !sizeof($all));
82  }
+ 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 70 of file class.ilADTMultiText.php.

71  {
72  // return null?
73  }

◆ isValid()

ilADTMultiText::isValid ( )

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

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

88  {
89  $valid = parent::isValid();
90 
91  if(!$this->isNull())
92  {
93  $max_size = $this->getDefinition()->getMaxSize();
94  if($max_size && $max_size < sizeof($this->getTextElements()))
95  {
96  $valid = false;
97  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_SIZE);
98  }
99 
100  $max_len = $this->getDefinition()->getMaxLength();
101  if($max_len)
102  {
103  foreach($this->getTextElements() as $element)
104  {
105  if($max_len < strlen($element))
106  {
107  $valid = false;
108  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
109  }
110  }
111  }
112  }
113 
114  return $valid;
115  }
$valid
addValidationError($a_error_code)
Add validation error code.
getDefinition()
Get definition.
Definition: class.ilADT.php:99
+ 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  {
29  if(sizeof($a_values))
30  {
31  foreach($a_values as $idx => $element)
32  {
33  $a_values[$idx]= trim($element);
34  if(!$a_values[$idx])
35  {
36  unset($a_values[$idx]);
37  }
38  }
39  $a_values = array_unique($a_values);
40  }
41  if(!sizeof($a_values))
42  {
43  $a_values = null;
44  }
45  }
46  $this->values = $a_values;
47  }

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: