ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTText Class Reference
+ Inheritance diagram for ilADTText:
+ Collaboration diagram for ilADTText:

Public Member Functions

 reset ()
 
 setText (?string $a_value=null)
 
 getText ()
 
 getLength ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 isValid ()
 
 getCheckSum ()
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- 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)
 
- 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)

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

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

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
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTText::exportStdClass ( )

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

References getText(), and isNull().

96  : ?stdClass
97  {
98  if (!$this->isNull()) {
99  $obj = new stdClass();
100  $obj->value = $this->getText();
101  return $obj;
102  }
103  return null;
104  }
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTText::getCheckSum ( )

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

References getText(), and isNull().

88  : ?string
89  {
90  if (!$this->isNull()) {
91  return md5($this->getText());
92  }
93  return null;
94  }
+ Here is the call graph for this function:

◆ getLength()

ilADTText::getLength ( )

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

References getText().

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

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  }
+ 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.

References $value.

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

32  : ?string
33  {
34  return $this->value;
35  }
string $value
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTText::importStdClass ( ?stdClass  $a_std)

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

References setText().

106  : void
107  {
108  if (is_object($a_std)) {
109  $this->setText($a_std->value);
110  }
111  }
setText(?string $a_value=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTText::isLarger ( ilADT  $a_adt)

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

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

◆ isNull()

ilADTText::isNull ( )

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

References getLength().

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

68  : bool
69  {
70  return !$this->getLength();
71  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTText::isSmaller ( ilADT  $a_adt)

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

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

◆ isValid()

ilADTText::isValid ( )

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

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

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
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTText::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

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

◆ reset()

ilADTText::reset ( )

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.

Referenced by importStdClass().

24  : void
25  {
26  if ($a_value !== null) {
27  $a_value = trim($a_value);
28  }
29  $this->value = $a_value;
30  }
+ 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: