ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ 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
$a_value = trim($a_value);
29
}
30
$this->value = $a_value;
31
}
32
33
public
function
getText
()
34
{
35
return
$this->value
;
36
}
37
38
public
function
getLength
()
39
{
40
// see ilStr::strLen();
41
// not using ilStr to reduce dependencies in this low-level code
42
43
if
(function_exists(
"mb_strlen"
)) {
44
return
mb_strlen($this->
getText
(),
"UTF-8"
);
45
}
else
{
46
return
strlen($this->
getText
());
47
}
48
}
49
50
51
// comparison
52
53
public
function
equals
(
ilADT
$a_adt)
54
{
55
if
($this->
getDefinition
()->isComparableTo($a_adt)) {
56
return
!strcmp($this->
getText
(), $a_adt->getText());
57
}
58
}
59
60
public
function
isLarger
(
ilADT
$a_adt)
61
{
62
// return null?
63
}
64
65
public
function
isSmaller
(
ilADT
$a_adt)
66
{
67
// return null?
68
}
69
70
71
// null
72
73
public
function
isNull
()
74
{
75
return
!(bool) $this->
getLength
();
76
}
77
78
79
// validation
80
81
public
function
isValid
()
82
{
83
$valid
= parent::isValid();
84
85
if
(!$this->
isNull
()) {
86
$max = $this->
getDefinition
()->getMaxLength();
87
if
($max && $max < $this->
getLength
()) {
88
$valid
=
false
;
89
$this->
addValidationError
(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
90
}
91
}
92
93
return
$valid
;
94
}
95
96
97
// check
98
99
public
function
getCheckSum
()
100
{
101
if
(!$this->
isNull
()) {
102
return
md5($this->
getText
());
103
}
104
}
105
}
ilADTTextDefinition
Definition:
class.ilADTTextDefinition.php:3
ilADTText\equals
equals(ilADT $a_adt)
Definition:
class.ilADTText.php:53
ilADTText\isNull
isNull()
Definition:
class.ilADTText.php:73
$valid
$valid
Definition:
dummy_client.php:52
ilADT\addValidationError
addValidationError($a_error_code)
Add validation error code.
Definition:
class.ilADT.php:230
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:65
ilADTText\isValidDefinition
isValidDefinition(ilADTDefinition $a_def)
Definition:
class.ilADTText.php:10
ilADTText\getCheckSum
getCheckSum()
Definition:
class.ilADTText.php:99
ilADTText\getText
getText()
Definition:
class.ilADTText.php:33
ilADTText\setText
setText($a_value=null)
Definition:
class.ilADTText.php:25
ilADTText\isValid
isValid()
Definition:
class.ilADTText.php:81
ilADTText\reset
reset()
Definition:
class.ilADTText.php:15
ilADTText\isLarger
isLarger(ilADT $a_adt)
Definition:
class.ilADTText.php:60
ilADTText
Definition:
class.ilADTText.php:3
ilADTDefinition
ADT definition base class.
Definition:
class.ilADTDefinition.php:11
ilADTText\getLength
getLength()
Definition:
class.ilADTText.php:38
ilADT\getDefinition
getDefinition()
Get definition.
Definition:
class.ilADT.php:97
Services
ADT
classes
Types
Text
class.ilADTText.php
Generated on Sat Jan 18 2025 19:01:26 for ILIAS by
1.8.13 (using
Doxyfile
)