ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADTLocalizedText Class Reference

Class ilADTLocalizedText. More...

+ Inheritance diagram for ilADTLocalizedText:
+ Collaboration diagram for ilADTLocalizedText:

Public Member Functions

 getTextForLanguage (string $language)
 
 getTranslations ()
 
 setTranslation (string $language, string $translation)
 
 reset ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 getCheckSum ()
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- Public Member Functions inherited from ilADTText
 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 ilADTText
 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)
 

Private Attributes

array $translations = []
 

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'
 
- Protected Attributes inherited from ilADTText
string $value
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $validation_errors = []
 

Detailed Description

Member Function Documentation

◆ equals()

ilADTLocalizedText::equals ( ilADT  $a_adt)

Definition at line 67 of file class.ilADTLocalizedText.php.

References ilADTText\$value, ilADT\getDefinition(), getTranslations(), and null.

67  : ?bool
68  {
69  if (!$this->getDefinition()->isComparableTo($a_adt)) {
70  return null;
71  }
72  if ($this->getTranslations() != count($a_adt->getTranslations())) {
73  return false;
74  }
75  foreach ($a_adt->getTranslations() as $key => $value) {
76  if (!isset($this->getTranslations()[$key])) {
77  return false;
78  }
79  if (!strcmp($this->getTranslations()[$key], $value)) {
80  return false;
81  }
82  }
83  return true;
84  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTLocalizedText::exportStdClass ( )

Definition at line 131 of file class.ilADTLocalizedText.php.

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

131  : ?stdClass
132  {
133  if (!$this->isNull()) {
134  $obj = new stdClass();
135  $obj->translations = $this->getTranslations();
136  return $obj;
137  }
138  return null;
139  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTLocalizedText::getCheckSum ( )

Definition at line 120 of file class.ilADTLocalizedText.php.

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

120  : ?string
121  {
122  if (!$this->isNull()) {
123  return md5(serialize($this->getTranslations()));
124  }
125  return null;
126  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getTextForLanguage()

ilADTLocalizedText::getTextForLanguage ( string  $language)

Definition at line 29 of file class.ilADTLocalizedText.php.

References ilADTText\getText(), and getTranslations().

29  : string
30  {
31  if (array_key_exists($language, $this->getTranslations()) && strlen($this->getTranslations()[$language])) {
32  return $this->getTranslations()[$language];
33  }
34  return (string) $this->getText();
35  }
+ Here is the call graph for this function:

◆ getTranslations()

ilADTLocalizedText::getTranslations ( )
Returns
array

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

References $translations.

Referenced by equals(), exportStdClass(), getCheckSum(), getTextForLanguage(), and isNull().

40  : array
41  {
42  return $this->translations;
43  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTLocalizedText::importStdClass ( ?stdClass  $a_std)

Definition at line 144 of file class.ilADTLocalizedText.php.

144  : void
145  {
146  if (is_object($a_std)) {
147  $this->translations = $a_std->translations;
148  }
149  }

◆ isLarger()

ilADTLocalizedText::isLarger ( ilADT  $a_adt)

Definition at line 89 of file class.ilADTLocalizedText.php.

References null.

89  : ?bool
90  {
91  return null;
92  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isNull()

ilADTLocalizedText::isNull ( )

Definition at line 105 of file class.ilADTLocalizedText.php.

References ilADTText\getLength(), and getTranslations().

Referenced by exportStdClass(), and getCheckSum().

105  : bool
106  {
107  $has_translation = false;
108  foreach ($this->getTranslations() as $translation) {
109  if ($translation !== '') {
110  $has_translation = true;
111  break;
112  }
113  }
114  return !$this->getLength() && !$has_translation;
115  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTLocalizedText::isSmaller ( ilADT  $a_adt)

Definition at line 97 of file class.ilADTLocalizedText.php.

References null.

97  : ?bool
98  {
99  return null;
100  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ isValidDefinition()

ilADTLocalizedText::isValidDefinition ( ilADTDefinition  $a_def)
protected

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

53  : bool
54  {
55  return $a_def instanceof ilADTLocalizedTextDefinition;
56  }

◆ reset()

ilADTLocalizedText::reset ( )

Definition at line 58 of file class.ilADTLocalizedText.php.

58  : void
59  {
60  parent::reset();
61  $this->translations = [];
62  }

◆ setTranslation()

ilADTLocalizedText::setTranslation ( string  $language,
string  $translation 
)

Definition at line 45 of file class.ilADTLocalizedText.php.

45  : void
46  {
47  $this->translations[$language] = $translation;
48  }

Field Documentation

◆ $translations

array ilADTLocalizedText::$translations = []
private

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

Referenced by getTranslations().


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