ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilADTMultiText Class Reference
+ Inheritance diagram for ilADTMultiText:
+ Collaboration diagram for ilADTMultiText:

Public Member Functions

 reset ()
 Init property defaults. More...
 
 setTextElements (array $a_values=null)
 
 getTextElements ()
 
 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...
 
 isValid ()
 Is currently valid. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass ($a_std)
 Import value from stdClass. 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...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass ($a_std)
 Import value from stdClass. More...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
- 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)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

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

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTMultiText::exportStdClass ( )

Export value as stdClass.

Returns
stdClass

Reimplemented from ilADT.

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

122 {
123 if (!$this->isNull()) {
124 $obj = new stdClass();
125 $obj->value = $this->getTextElements();
126 return $obj;
127 }
128 }
isNull()
Is currently null.

References getTextElements(), and isNull().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

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

110 {
111 if (!$this->isNull()) {
112 $elements = $this->getTextElements();
113 sort($elements);
114 return md5(implode("", $elements));
115 }
116 }

References getTextElements(), and isNull().

Referenced by equals().

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

45 {
46 return $this->values;
47 }

References $values.

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

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTMultiText::importStdClass (   $a_std)

Import value from stdClass.

Parameters
stdClass$a_std

Reimplemented from ilADT.

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

131 {
132 if (is_object($a_std)) {
133 $this->setTextElements($a_std->value);
134 }
135 }
setTextElements(array $a_values=null)

References setTextElements().

+ Here is the call graph for this function:

◆ isLarger()

ilADTMultiText::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

60 {
61 // return null?
62 }

◆ isNull()

ilADTMultiText::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

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

73 {
74 $all = $this->getTextElements();
75 return (!is_array($all) || !sizeof($all));
76 }

References getTextElements().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTMultiText::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

65 {
66 // return null?
67 }

◆ isValid()

ilADTMultiText::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

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

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 }
addValidationError($a_error_code)
Add validation error code.
$valid

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

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTMultiText::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Returns
bool;

Reimplemented from ilADT.

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

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

◆ reset()

ilADTMultiText::reset ( )

Init property defaults.

Reimplemented from ilADT.

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 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

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: