ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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 21 of file class.ilADTMultiText.php.

Member Function Documentation

◆ equals()

ilADTMultiText::equals ( ilADT  $a_adt)

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

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

64  : ?bool
65  {
66  if ($this->getDefinition()->isComparableTo($a_adt)) {
67  return ($this->getCheckSum() == $a_adt->getCheckSum());
68  }
69  return null;
70  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTMultiText::exportStdClass ( )

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

References getTextElements(), isNull(), and null.

131  : ?stdClass
132  {
133  if (!$this->isNull()) {
134  $obj = new stdClass();
135  $obj->value = $this->getTextElements();
136  return $obj;
137  }
138  return null;
139  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

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

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

Referenced by equals().

119  : ?string
120  {
121  if (!$this->isNull()) {
122  $elements = $this->getTextElements();
123  sort($elements);
124  return md5(implode("", $elements));
125  }
126  return null;
127  }
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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.

References $values.

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

57  : ?array
58  {
59  return $this->values;
60  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTMultiText::importStdClass ( ?stdClass  $a_std)

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

References setTextElements().

141  : void
142  {
143  if (is_object($a_std)) {
144  $this->setTextElements($a_std->value);
145  }
146  }
setTextElements(?array $a_values=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTMultiText::isLarger ( ilADT  $a_adt)

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

References null.

72  : ?bool
73  {
74  return null;
75  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isNull()

ilADTMultiText::isNull ( )
Returns
bool

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

References getTextElements().

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

88  : bool
89  {
90  $all = $this->getTextElements();
91  return (!is_array($all) || !count($all));
92  }
+ 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 77 of file class.ilADTMultiText.php.

References null.

77  : ?bool
78  {
79  return null;
80  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isValid()

ilADTMultiText::isValid ( )

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

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

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

◆ isValidDefinition()

ilADTMultiText::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

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

◆ reset()

ilADTMultiText::reset ( )

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

References null.

30  : void
31  {
32  parent::reset();
33  $this->values = null;
34  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ setTextElements()

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

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

References null.

Referenced by importStdClass().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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: