ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 21 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 64 of file class.ilADTText.php.

64 : ?bool
65 {
66 if ($this->getDefinition()->isComparableTo($a_adt)) {
67 return !strcmp($this->getText(), $a_adt->getText());
68 }
69 return null;
70 }
getDefinition()
Get definition.

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 112 of file class.ilADTText.php.

112 : ?stdClass
113 {
114 if (!$this->isNull()) {
115 $obj = new stdClass();
116 $obj->value = $this->getText();
117 return $obj;
118 }
119 return null;
120 }
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 104 of file class.ilADTText.php.

104 : ?string
105 {
106 if (!$this->isNull()) {
107 return md5($this->getText());
108 }
109 return null;
110 }

References getText(), and isNull().

+ Here is the call graph for this function:

◆ getLength()

ilADTText::getLength ( )

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

53 : 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 }

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 48 of file class.ilADTText.php.

48 : ?string
49 {
50 return $this->value;
51 }

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 122 of file class.ilADTText.php.

122 : void
123 {
124 if (is_object($a_std)) {
125 $this->setText($a_std->value);
126 }
127 }
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 72 of file class.ilADTText.php.

72 : ?bool
73 {
74 return null;
75 }

◆ isNull()

ilADTText::isNull ( )

Is currently null.

Returns
bool | null

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

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

84 : bool
85 {
86 return !$this->getLength();
87 }

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 77 of file class.ilADTText.php.

77 : ?bool
78 {
79 return null;
80 }

◆ isValid()

ilADTText::isValid ( )

Reimplemented from ilADT.

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

91 : 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 }
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 27 of file class.ilADTText.php.

27 : bool
28 {
29 return $a_def instanceof ilADTTextDefinition;
30 }

◆ reset()

ilADTText::reset ( )

Init property defaults.

Reimplemented from ilADT.

Reimplemented in ilADTLocalizedText.

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

32 : void
33 {
34 parent::reset();
35 $this->value = null;
36 }

◆ setText()

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

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

40 : void
41 {
42 if ($a_value !== null) {
43 $a_value = trim($a_value);
44 }
45 $this->value = $a_value;
46 }

Referenced by importStdClass().

+ Here is the caller graph for this function:

Field Documentation

◆ $value

string ilADTText::$value
protected

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

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


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