ILIAS
Release_5_0_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
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
?>
Services
ADT
classes
Types
Text
class.ilADTText.php
Generated on Wed Apr 27 2016 21:01:28 for ILIAS by
1.8.1.2 (using
Doxyfile
)