ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
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
118
119
// stdClass
120
121
public
function
exportStdClass
()
122
{
123
if
(!$this->
isNull
()) {
124
$obj =
new
stdClass();
125
$obj->value = $this->
getTextElements
();
126
return
$obj;
127
}
128
}
129
130
public
function
importStdClass
($a_std)
131
{
132
if
(is_object($a_std)) {
133
$this->
setTextElements
($a_std->value);
134
}
135
}
136
}
ilADTMultiText\exportStdClass
exportStdClass()
Definition:
class.ilADTMultiText.php:121
ilADTMultiText\isValidDefinition
isValidDefinition(ilADTDefinition $a_def)
Definition:
class.ilADTMultiText.php:10
ilADTMultiText\importStdClass
importStdClass($a_std)
Definition:
class.ilADTMultiText.php:130
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.
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 Apr 3 2025 20:01:01 for ILIAS by
1.8.13 (using
Doxyfile
)