ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilADTMultiText.php
Go to the documentation of this file.
1
<?
php
2
3
class
ilADTMultiText
extends
ilADT
4
{
5
protected
$values
;
// [array]
6
7
8
// definition
9
10
protected
function
isValidDefinition
(
ilADTDefinition
$a_def)
11
{
12
return
($a_def instanceof
ilADTMultiTextDefinition
);
13
}
14
15
public
function
reset
()
16
{
17
parent::reset();
18
19
$this->values = null;
20
}
21
22
23
// properties
24
25
public
function
setTextElements
(array $a_values = null)
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
}
43
44
public
function
getTextElements
()
45
{
46
return
$this->values
;
47
}
48
49
50
// comparison
51
52
public
function
equals
(
ilADT
$a_adt)
53
{
54
if
($this->
getDefinition
()->isComparableTo($a_adt)) {
55
return
($this->
getCheckSum
() == $a_adt->
getCheckSum
());
56
}
57
}
58
59
public
function
isLarger
(
ilADT
$a_adt)
60
{
61
// return null?
62
}
63
64
public
function
isSmaller
(
ilADT
$a_adt)
65
{
66
// return null?
67
}
68
69
70
// null
71
72
public
function
isNull
()
73
{
74
$all = $this->
getTextElements
();
75
return
(!is_array($all) || !
sizeof
($all));
76
}
77
78
79
// validation
80
81
public
function
isValid
()
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
}
105
106
107
// check
108
109
public
function
getCheckSum
()
110
{
111
if
(!$this->
isNull
()) {
112
$elements = $this->
getTextElements
();
113
sort($elements);
114
return
md5(implode(
""
, $elements));
115
}
116
}
117
}
ilADTMultiText\isValidDefinition
isValidDefinition(ilADTDefinition $a_def)
Definition:
class.ilADTMultiText.php:10
ilADTMultiText\isSmaller
isSmaller(ilADT $a_adt)
Definition:
class.ilADTMultiText.php:64
$valid
$valid
Definition:
dummy_client.php:52
ilADT\addValidationError
addValidationError($a_error_code)
Add validation error code.
Definition:
class.ilADT.php:230
ilADTMultiText\isNull
isNull()
Definition:
class.ilADTMultiText.php:72
ilADT
ADT base class.
Definition:
class.ilADT.php:11
ilADTMultiText
Definition:
class.ilADTMultiText.php:3
ilADTMultiText\getCheckSum
getCheckSum()
Definition:
class.ilADTMultiText.php:109
ilADTMultiText\getTextElements
getTextElements()
Definition:
class.ilADTMultiText.php:44
ilADTMultiText\reset
reset()
Definition:
class.ilADTMultiText.php:15
ilADTMultiText\$values
$values
Definition:
class.ilADTMultiText.php:5
ilADTMultiText\isValid
isValid()
Definition:
class.ilADTMultiText.php:81
ilADTMultiText\isLarger
isLarger(ilADT $a_adt)
Definition:
class.ilADTMultiText.php:59
ilADTMultiText\equals
equals(ilADT $a_adt)
Definition:
class.ilADTMultiText.php:52
ilADTMultiText\setTextElements
setTextElements(array $a_values=null)
Definition:
class.ilADTMultiText.php:25
ilADT\getCheckSum
getCheckSum()
Get unique checksum.
php
ilADTDefinition
ADT definition base class.
Definition:
class.ilADTDefinition.php:11
ilADTMultiTextDefinition
Definition:
class.ilADTMultiTextDefinition.php:3
ilADT\getDefinition
getDefinition()
Get definition.
Definition:
class.ilADT.php:97
Services
ADT
classes
Types
MultiText
class.ilADTMultiText.php
Generated on Thu Jan 30 2025 19:01:51 for ILIAS by
1.8.13 (using
Doxyfile
)