ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 isValid ()
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. 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)
 
 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 ()
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode (string $a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $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
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError (string $a_error_code)
 

Protected Attributes

array $values
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $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 21 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|null

Reimplemented from ilADT.

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

64 : ?bool
65 {
66 if ($this->getDefinition()->isComparableTo($a_adt)) {
67 return ($this->getCheckSum() == $a_adt->getCheckSum());
68 }
69 return null;
70 }
getCheckSum()
Get unique checksum.
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTMultiText::exportStdClass ( )

Export value as stdClass.

Returns
stdClass | null

Reimplemented from ilADT.

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

131 : ?stdClass
132 {
133 if (!$this->isNull()) {
134 $obj = new stdClass();
135 $obj->value = $this->getTextElements();
136 return $obj;
137 }
138 return null;
139 }

References getTextElements(), and isNull().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

Get unique checksum.

Returns
string | null

Reimplemented from ilADT.

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

119 : ?string
120 {
121 if (!$this->isNull()) {
122 $elements = $this->getTextElements();
123 sort($elements);
124 return md5(implode("", $elements));
125 }
126 return null;
127 }

References getTextElements(), isNull(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

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 57 of file class.ilADTMultiText.php.

57 : ?array
58 {
59 return $this->values;
60 }

References $values.

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

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTMultiText::importStdClass ( ?stdClass  $a_std)

Import value from stdClass.

Parameters
stdClass  |  null$a_std

Reimplemented from ilADT.

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

141 : void
142 {
143 if (is_object($a_std)) {
144 $this->setTextElements($a_std->value);
145 }
146 }
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 72 of file class.ilADTMultiText.php.

72 : ?bool
73 {
74 return null;
75 }

◆ isNull()

ilADTMultiText::isNull ( )
Returns
bool

Reimplemented from ilADT.

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

88 : bool
89 {
90 $all = $this->getTextElements();
91 return (!is_array($all) || !count($all));
92 }

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 | null

Reimplemented from ilADT.

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

77 : ?bool
78 {
79 return null;
80 }

◆ isValid()

ilADTMultiText::isValid ( )

Reimplemented from ilADT.

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

96 : bool
97 {
98 $valid = parent::isValid();
99 if (!$this->isNull()) {
100 $max_size = $this->getDefinition()->getMaxSize();
101 if ($max_size && $max_size < count((array) $this->getTextElements())) {
102 $valid = false;
103 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_SIZE);
104 }
105
106 $max_len = $this->getDefinition()->getMaxLength();
107 if ($max_len) {
108 foreach ((array) $this->getTextElements() as $element) {
109 if ($max_len < strlen($element)) {
110 $valid = false;
111 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
112 }
113 }
114 }
115 }
116 return $valid;
117 }
addValidationError(string $a_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.

Parameters
ilADTDefinition$a_def
Returns
bool

Reimplemented from ilADT.

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

25 : bool
26 {
27 return $a_def instanceof ilADTMultiTextDefinition;
28 }

◆ reset()

ilADTMultiText::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

30 : void
31 {
32 parent::reset();
33 $this->values = null;
34 }

◆ setTextElements()

ilADTMultiText::setTextElements ( ?array  $a_values = null)

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

38 : void
39 {
40 if (is_array($a_values)) {
41 if (count($a_values)) {
42 foreach ($a_values as $idx => $element) {
43 $a_values[$idx] = trim($element);
44 if (!$a_values[$idx]) {
45 unset($a_values[$idx]);
46 }
47 }
48 $a_values = array_unique($a_values);
49 }
50 if (!count($a_values)) {
51 $a_values = null;
52 }
53 }
54 $this->values = $a_values;
55 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

Field Documentation

◆ $values

array ilADTMultiText::$values
protected

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

Referenced by getTextElements().


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