ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 21 of file class.ilADTText.php.

Member Function Documentation

◆ equals()

ilADTText::equals ( ilADT  $a_adt)

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

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

64  : ?bool
65  {
66  if ($this->getDefinition()->isComparableTo($a_adt)) {
67  return !strcmp($this->getText(), $a_adt->getText());
68  }
69  return null;
70  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTText::exportStdClass ( )

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

References getText(), isNull(), and null.

112  : ?stdClass
113  {
114  if (!$this->isNull()) {
115  $obj = new stdClass();
116  $obj->value = $this->getText();
117  return $obj;
118  }
119  return null;
120  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTText::getCheckSum ( )

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

References getText(), isNull(), and null.

104  : ?string
105  {
106  if (!$this->isNull()) {
107  return md5($this->getText());
108  }
109  return null;
110  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getLength()

ilADTText::getLength ( )

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

References getText().

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

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

References $value.

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

48  : ?string
49  {
50  return $this->value;
51  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTText::importStdClass ( ?stdClass  $a_std)

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

References setText().

122  : void
123  {
124  if (is_object($a_std)) {
125  $this->setText($a_std->value);
126  }
127  }
setText(?string $a_value=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTText::isLarger ( ilADT  $a_adt)

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

References null.

72  : ?bool
73  {
74  return null;
75  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isNull()

ilADTText::isNull ( )

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

References getLength().

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

84  : bool
85  {
86  return !$this->getLength();
87  }
+ 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 77 of file class.ilADTText.php.

References null.

77  : ?bool
78  {
79  return null;
80  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isValid()

ilADTText::isValid ( )

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

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

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

◆ isValidDefinition()

ilADTText::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

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

◆ reset()

ilADTText::reset ( )

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

References null.

32  : void
33  {
34  parent::reset();
35  $this->value = null;
36  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ setText()

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

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

References null.

Referenced by importStdClass().

40  : void
41  {
42  if ($a_value !== null) {
43  $a_value = trim($a_value);
44  }
45  $this->value = $a_value;
46  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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: