ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
◀ ilDoc Overview
class.ilADTText.php
Go to the documentation of this file.
1
<?
php
2
3
class
ilADTText
extends
ilADT
4
{
5
protected
$value
;
// [string]
6
7
8
// definition
9
10
protected
function
isValidDefinition
(
ilADTDefinition
$a_def)
11
{
12
return
($a_def instanceof
ilADTTextDefinition
);
13
}
14
15
public
function
reset
()
16
{
17
parent::reset();
18
19
$this->value = null;
20
}
21
22
23
// properties
24
25
public
function
setText
($a_value = null)
26
{
27
if
($a_value !== null)
28
{
29
$a_value = trim($a_value);
30
}
31
$this->value = $a_value;
32
}
33
34
public
function
getText
()
35
{
36
return
$this->value
;
37
}
38
39
public
function
getLength
()
40
{
41
// see ilStr::strLen();
42
// not using ilStr to reduce dependencies in this low-level code
43
44
if
(function_exists(
"mb_strlen"
))
45
{
46
return
mb_strlen($this->
getText
(),
"UTF-8"
);
47
}
48
else
49
{
50
return
strlen($this->
getText
());
51
}
52
}
53
54
55
// comparison
56
57
public
function
equals
(
ilADT
$a_adt)
58
{
59
if
($this->
getDefinition
()->isComparableTo($a_adt))
60
{
61
return
!strcmp($this->
getText
(), $a_adt->getText());
62
}
63
}
64
65
public
function
isLarger
(
ilADT
$a_adt)
66
{
67
// return null?
68
}
69
70
public
function
isSmaller
(
ilADT
$a_adt)
71
{
72
// return null?
73
}
74
75
76
// null
77
78
public
function
isNull
()
79
{
80
return
!(bool)$this->
getLength
();
81
}
82
83
84
// validation
85
86
public
function
isValid
()
87
{
88
$valid
= parent::isValid();
89
90
if
(!$this->
isNull
())
91
{
92
$max = $this->
getDefinition
()->getMaxLength();
93
if
($max && $max < $this->
getLength
())
94
{
95
$valid
=
false
;
96
$this->
addValidationError
(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
97
}
98
}
99
100
return
$valid
;
101
}
102
103
104
// check
105
106
public
function
getCheckSum
()
107
{
108
if
(!$this->
isNull
())
109
{
110
return
md5($this->
getText
());
111
}
112
}
113
}
114
115
?>
ilADTTextDefinition
Definition:
class.ilADTTextDefinition.php:3
ilADTText\equals
equals(ilADT $a_adt)
Definition:
class.ilADTText.php:57
ilADTText\isNull
isNull()
Definition:
class.ilADTText.php:78
$valid
$valid
Definition:
dummy_client.php:53
ilADT\addValidationError
addValidationError($a_error_code)
Add validation error code.
Definition:
class.ilADT.php:233
ilADTText\$value
$value
Definition:
class.ilADTText.php:5
ilADT
ADT base class.
Definition:
class.ilADT.php:11
ilADTText\isSmaller
isSmaller(ilADT $a_adt)
Definition:
class.ilADTText.php:70
ilADTText\isValidDefinition
isValidDefinition(ilADTDefinition $a_def)
Definition:
class.ilADTText.php:10
ilADTText\getCheckSum
getCheckSum()
Definition:
class.ilADTText.php:106
ilADTText\getText
getText()
Definition:
class.ilADTText.php:34
ilADTText\setText
setText($a_value=null)
Definition:
class.ilADTText.php:25
ilADTText\isValid
isValid()
Definition:
class.ilADTText.php:86
ilADTText\reset
reset()
Definition:
class.ilADTText.php:15
ilADTText\isLarger
isLarger(ilADT $a_adt)
Definition:
class.ilADTText.php:65
php
ilADTText
Definition:
class.ilADTText.php:3
ilADTDefinition
ADT definition base class.
Definition:
class.ilADTDefinition.php:11
ilADTText\getLength
getLength()
Definition:
class.ilADTText.php:39
ilADT\getDefinition
getDefinition()
Get definition.
Definition:
class.ilADT.php:99
Services
ADT
classes
Types
Text
class.ilADTText.php
Generated on Fri Feb 21 2025 19:01:08 for ILIAS by
1.8.13 (using
Doxyfile
)