ILIAS
trunk Revision v11.0_alpha-2645-g16283d3b3f8
◀ ilDoc Overview
class.ilADTText.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
class
ilADTText
extends
ilADT
22
{
23
protected
?
string
$value
;
24
25
// definition
26
27
protected
function
isValidDefinition
(
ilADTDefinition
$a_def): bool
28
{
29
return
$a_def instanceof
ilADTTextDefinition
;
30
}
31
32
public
function
reset
(): void
33
{
34
parent::reset();
35
$this->value =
null
;
36
}
37
38
// properties
39
40
public
function
setText
(?
string
$a_value =
null
): void
41
{
42
if
($a_value !==
null
) {
43
$a_value = trim($a_value);
44
}
45
$this->value = $a_value;
46
}
47
48
public
function
getText
(): ?string
49
{
50
return
$this->value
;
51
}
52
53
public
function
getLength
():
int
54
{
55
if
(function_exists(
"mb_strlen"
)) {
56
return
mb_strlen((
string
) $this->
getText
(),
"UTF-8"
);
57
}
else
{
58
return
strlen((
string
) $this->
getText
());
59
}
60
}
61
62
// comparison
63
64
public
function
equals
(
ilADT
$a_adt): ?bool
65
{
66
if
($this->
getDefinition
()->isComparableTo($a_adt)) {
67
return
!strcmp($this->
getText
(), $a_adt->getText());
68
}
69
return
null
;
70
}
71
72
public
function
isLarger
(
ilADT
$a_adt): ?bool
73
{
74
return
null
;
75
}
76
77
public
function
isSmaller
(
ilADT
$a_adt): ?bool
78
{
79
return
null
;
80
}
81
82
// null
83
84
public
function
isNull
(): bool
85
{
86
return
!$this->
getLength
();
87
}
88
89
// validation
90
91
public
function
isValid
(): bool
92
{
93
$valid
= parent::isValid();
94
if
(!$this->
isNull
()) {
95
$max = $this->
getDefinition
()->getMaxLength();
96
if
($max && $max < $this->
getLength
()) {
97
$valid
=
false
;
98
$this->
addValidationError
(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
99
}
100
}
101
return
$valid
;
102
}
103
104
public
function
getCheckSum
(): ?string
105
{
106
if
(!$this->
isNull
()) {
107
return
md5($this->
getText
());
108
}
109
return
null
;
110
}
111
112
public
function
exportStdClass
(): ?
stdClass
113
{
114
if
(!$this->
isNull
()) {
115
$obj =
new
stdClass
();
116
$obj->value = $this->
getText
();
117
return
$obj;
118
}
119
return
null
;
120
}
121
122
public
function
importStdClass
(?
stdClass
$a_std): void
123
{
124
if
(is_object($a_std)) {
125
$this->
setText
($a_std->value);
126
}
127
}
128
}
ilADTTextDefinition
Definition:
class.ilADTTextDefinition.php:21
ilADTText\equals
equals(ilADT $a_adt)
Definition:
class.ilADTText.php:64
ilADT\addValidationError
addValidationError(string $a_error_code)
Definition:
class.ilADT.php:237
ilADTText\isNull
isNull()
Definition:
class.ilADTText.php:84
ilADTText\$value
string $value
Definition:
class.ilADTText.php:23
stdClass
$valid
$valid
Definition:
dummy_client.php:59
ilADT
ADT base class.
Definition:
class.ilADT.php:25
ilADTText\isSmaller
isSmaller(ilADT $a_adt)
Definition:
class.ilADTText.php:77
ilADTText\setText
setText(?string $a_value=null)
Definition:
class.ilADTText.php:40
null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Definition:
shib_logout.php:144
ilADTText\isValidDefinition
isValidDefinition(ilADTDefinition $a_def)
Definition:
class.ilADTText.php:27
ilADTText\importStdClass
importStdClass(?stdClass $a_std)
Definition:
class.ilADTText.php:122
ilADTText\getCheckSum
getCheckSum()
Definition:
class.ilADTText.php:104
ilADTText\getText
getText()
Definition:
class.ilADTText.php:48
ilADTText\exportStdClass
exportStdClass()
Definition:
class.ilADTText.php:112
ilADTText\isValid
isValid()
Definition:
class.ilADTText.php:91
ilADTText\reset
reset()
Definition:
class.ilADTText.php:32
ilADTText\isLarger
isLarger(ilADT $a_adt)
Definition:
class.ilADTText.php:72
ilADTText
Definition:
class.ilADTText.php:21
ilADTDefinition
ADT definition base class.
Definition:
class.ilADTDefinition.php:25
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
ilADTText\getLength
getLength()
Definition:
class.ilADTText.php:53
ilADT\getDefinition
getDefinition()
Get definition.
Definition:
class.ilADT.php:106
components
ILIAS
ADT
classes
Types
Text
class.ilADTText.php
Generated on Mon Sep 1 2025 23:01:54 for ILIAS by
1.8.13 (using
Doxyfile
)