ILIAS  release_8 Revision v8.24
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 5 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 48 of file class.ilADTMultiText.php.

48 : ?bool
49 {
50 if ($this->getDefinition()->isComparableTo($a_adt)) {
51 return ($this->getCheckSum() == $a_adt->getCheckSum());
52 }
53 return null;
54 }
getCheckSum()
Get unique checksum.
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:92

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

115 : ?stdClass
116 {
117 if (!$this->isNull()) {
118 $obj = new stdClass();
119 $obj->value = $this->getTextElements();
120 return $obj;
121 }
122 return null;
123 }

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

103 : ?string
104 {
105 if (!$this->isNull()) {
106 $elements = $this->getTextElements();
107 sort($elements);
108 return md5(implode("", $elements));
109 }
110 return null;
111 }

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

41 : ?array
42 {
43 return $this->values;
44 }

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

125 : void
126 {
127 if (is_object($a_std)) {
128 $this->setTextElements($a_std->value);
129 }
130 }
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 56 of file class.ilADTMultiText.php.

56 : ?bool
57 {
58 return null;
59 }

◆ isNull()

ilADTMultiText::isNull ( )
Returns
bool

Reimplemented from ilADT.

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

72 : bool
73 {
74 $all = $this->getTextElements();
75 return (!is_array($all) || !count($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 | null

Reimplemented from ilADT.

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

61 : ?bool
62 {
63 return null;
64 }

◆ isValid()

ilADTMultiText::isValid ( )

Reimplemented from ilADT.

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

80 : bool
81 {
82 $valid = parent::isValid();
83 if (!$this->isNull()) {
84 $max_size = $this->getDefinition()->getMaxSize();
85 if ($max_size && $max_size < count((array) $this->getTextElements())) {
86 $valid = false;
87 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_SIZE);
88 }
89
90 $max_len = $this->getDefinition()->getMaxLength();
91 if ($max_len) {
92 foreach ((array) $this->getTextElements() as $element) {
93 if ($max_len < strlen($element)) {
94 $valid = false;
95 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
96 }
97 }
98 }
99 }
100 return $valid;
101 }
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 9 of file class.ilADTMultiText.php.

9 : bool
10 {
11 return $a_def instanceof ilADTMultiTextDefinition;
12 }

◆ reset()

ilADTMultiText::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

14 : void
15 {
16 parent::reset();
17 $this->values = null;
18 }

◆ setTextElements()

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

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

22 : void
23 {
24 if (is_array($a_values)) {
25 if (count($a_values)) {
26 foreach ($a_values as $idx => $element) {
27 $a_values[$idx] = trim($element);
28 if (!$a_values[$idx]) {
29 unset($a_values[$idx]);
30 }
31 }
32 $a_values = array_unique($a_values);
33 }
34 if (!count($a_values)) {
35 $a_values = null;
36 }
37 }
38 $this->values = $a_values;
39 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

Field Documentation

◆ $values

array ilADTMultiText::$values
protected

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

Referenced by getTextElements().


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