ILIAS  release_8 Revision v8.24
ilADTText Class Reference
+ Inheritance diagram for ilADTText:
+ Collaboration diagram for ilADTText:

Public Member Functions

 reset ()
 Init property defaults. More...
 
 setText (?string $a_value=null)
 
 getText ()
 
 getLength ()
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode (string $a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
- Protected Member Functions inherited from ilADT
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError (string $a_error_code)
 

Protected Attributes

string $value
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $validation_errors = []
 

Additional Inherited Members

- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

Detailed Description

Definition at line 5 of file class.ilADTText.php.

Member Function Documentation

◆ equals()

ilADTText::equals ( ilADT  $a_adt)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool|null

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 48 of file class.ilADTText.php.

48 : ?bool
49 {
50 if ($this->getDefinition()->isComparableTo($a_adt)) {
51 return !strcmp($this->getText(), $a_adt->getText());
52 }
53 return null;
54 }
getDefinition()
Get definition.
Definition: class.ilADT.php:92

References ilADT\getDefinition(), and getText().

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTText::exportStdClass ( )

Export value as stdClass.

Returns
stdClass | null

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 96 of file class.ilADTText.php.

96 : ?stdClass
97 {
98 if (!$this->isNull()) {
99 $obj = new stdClass();
100 $obj->value = $this->getText();
101 return $obj;
102 }
103 return null;
104 }
isNull()
Is currently null.

References getText(), and isNull().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTText::getCheckSum ( )

Get unique checksum.

Returns
string | null

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 88 of file class.ilADTText.php.

88 : ?string
89 {
90 if (!$this->isNull()) {
91 return md5($this->getText());
92 }
93 return null;
94 }

References getText(), and isNull().

+ Here is the call graph for this function:

◆ getLength()

ilADTText::getLength ( )

Definition at line 37 of file class.ilADTText.php.

37 : int
38 {
39 if (function_exists("mb_strlen")) {
40 return mb_strlen((string) $this->getText(), "UTF-8");
41 } else {
42 return strlen((string) $this->getText());
43 }
44 }

References getText().

Referenced by ilADTLocalizedText\isNull(), isNull(), and isValid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getText()

ilADTText::getText ( )

Definition at line 32 of file class.ilADTText.php.

32 : ?string
33 {
34 return $this->value;
35 }
string $value

References $value.

Referenced by equals(), exportStdClass(), getCheckSum(), getLength(), and ilADTLocalizedText\getTextForLanguage().

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTText::importStdClass ( ?stdClass  $a_std)

Import value from stdClass.

Parameters
stdClass  |  null$a_std

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 106 of file class.ilADTText.php.

106 : void
107 {
108 if (is_object($a_std)) {
109 $this->setText($a_std->value);
110 }
111 }
setText(?string $a_value=null)

References setText().

+ Here is the call graph for this function:

◆ isLarger()

ilADTText::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 56 of file class.ilADTText.php.

56 : ?bool
57 {
58 return null;
59 }

◆ isNull()

ilADTText::isNull ( )

Is currently null.

Returns
bool | null

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 68 of file class.ilADTText.php.

68 : bool
69 {
70 return !$this->getLength();
71 }

References getLength().

Referenced by exportStdClass(), getCheckSum(), and isValid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTText::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool | null

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 61 of file class.ilADTText.php.

61 : ?bool
62 {
63 return null;
64 }

◆ isValid()

ilADTText::isValid ( )

Reimplemented from ilADT.

Definition at line 75 of file class.ilADTText.php.

75 : bool
76 {
77 $valid = parent::isValid();
78 if (!$this->isNull()) {
79 $max = $this->getDefinition()->getMaxLength();
80 if ($max && $max < $this->getLength()) {
81 $valid = false;
82 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
83 }
84 }
85 return $valid;
86 }
addValidationError(string $a_error_code)
$valid

References $valid, ilADT\addValidationError(), ilADT\getDefinition(), getLength(), and isNull().

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTText::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Parameters
ilADTDefinition$a_def
Returns
bool

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

Definition at line 11 of file class.ilADTText.php.

11 : bool
12 {
13 return $a_def instanceof ilADTTextDefinition;
14 }

◆ reset()

ilADTText::reset ( )

Init property defaults.

Reimplemented from ilADT.

Definition at line 16 of file class.ilADTText.php.

16 : void
17 {
18 parent::reset();
19 $this->value = null;
20 }

◆ setText()

ilADTText::setText ( ?string  $a_value = null)

Definition at line 24 of file class.ilADTText.php.

24 : void
25 {
26 if ($a_value !== null) {
27 $a_value = trim($a_value);
28 }
29 $this->value = $a_value;
30 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

Field Documentation

◆ $value

string ilADTText::$value
protected

Definition at line 7 of file class.ilADTText.php.

Referenced by ilADTLocalizedText\equals(), and getText().


The documentation for this class was generated from the following file: