ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
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 ()
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- 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)
 
- 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)

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

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

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.
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTMultiText::exportStdClass ( )

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

References getTextElements(), and isNull().

115  : ?stdClass
116  {
117  if (!$this->isNull()) {
118  $obj = new stdClass();
119  $obj->value = $this->getTextElements();
120  return $obj;
121  }
122  return null;
123  }
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

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

References getTextElements(), and isNull().

Referenced by equals().

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

References $values.

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

41  : ?array
42  {
43  return $this->values;
44  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTMultiText::importStdClass ( ?stdClass  $a_std)

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

References setTextElements().

125  : void
126  {
127  if (is_object($a_std)) {
128  $this->setTextElements($a_std->value);
129  }
130  }
setTextElements(?array $a_values=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTMultiText::isLarger ( ilADT  $a_adt)

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

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

◆ isNull()

ilADTMultiText::isNull ( )
Returns
bool

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

References getTextElements().

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

72  : bool
73  {
74  $all = $this->getTextElements();
75  return (!is_array($all) || !count($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 61 of file class.ilADTMultiText.php.

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

◆ isValid()

ilADTMultiText::isValid ( )

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

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

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
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTMultiText::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

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

◆ reset()

ilADTMultiText::reset ( )

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.

Referenced by importStdClass().

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  }
+ 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: