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

Class ilADTLocalizedTextDBBridge. More...

+ Inheritance diagram for ilADTLocalizedTextFormBridge:
+ Collaboration diagram for ilADTLocalizedTextFormBridge:

Public Member Functions

 addToForm ()
 
 importFromPost ()
 
- Public Member Functions inherited from ilADTTextFormBridge
 __construct (ilADT $a_adt)
 
 setMulti (bool $a_value, ?int $a_cols=null, ?int $a_rows=null)
 
 isMulti ()
 
 addToForm ()
 
 importFromPost ()
 
- Public Member Functions inherited from ilADTFormBridge
 __construct (ilADT $a_adt)
 
 getADT ()
 
 setForm (ilPropertyFormGUI $a_form)
 
 getForm ()
 
 setElementId (string $a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 setInfo (string $a_value)
 
 getInfo ()
 
 setParentElement ($a_value)
 
 getParentElement ()
 Get parent element. More...
 
 setDisabled (bool $a_value)
 
 isDisabled ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 addJS (ilGlobalTemplateInterface $a_tpl)
 Add ADT-specific JS-files to template. More...
 
 shouldBeImportedFromPost (?ilADTFormBridge $a_parent_adt=null)
 Check if incoming values should be imported at all. More...
 
 importFromPost ()
 Import values from form request POST data. More...
 
 validate ()
 
 setExternalErrors (array $a_errors)
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 
- Protected Member Functions inherited from ilADTTextFormBridge
 isValidADT (ilADT $a_adt)
 
 addElementToForm (string $title, string $element_id, string $value, bool $is_translation=false, string $language='')
 
- Protected Member Functions inherited from ilADTFormBridge
 isValidADT (ilADT $a_adt)
 
 setADT (ilADT $a_adt)
 
 addBasicFieldProperties (ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
 Helper method to handle generic properties like setRequired(), setInfo() More...
 
 findParentElementInForm ()
 
 addToParentElement (ilFormPropertyGUI $a_field)
 
 isActiveForSubItems ($a_parent_option=null)
 Check if element is currently active for subitem(s) More...
 

Additional Inherited Members

- Protected Attributes inherited from ilADTTextFormBridge
bool $multi = false
 
int $multi_rows
 
int $multi_cols
 
- Protected Attributes inherited from ilADTFormBridge
ilADT $adt
 
ilPropertyFormGUI $form
 
 $parent
 
string $id = null
 
string $title = ''
 
string $info = ''
 
 $parent_element
 
bool $required = false
 
bool $disabled = false
 
ilLanguage $lng
 

Detailed Description

Member Function Documentation

◆ addToForm()

ilADTLocalizedTextFormBridge::addToForm ( )

Definition at line 38 of file class.ilADTLocalizedTextFormBridge.php.

References ilADTTextFormBridge\addElementToForm(), ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), ilADTFormBridge\getTitle(), and null.

38  : void
39  {
40  $active_languages = $this->getADT()->getCopyOfDefinition()->getActiveLanguages();
41  $multilingual_value_support = $this->getADT()->getCopyOfDefinition()->getMultilingualValueSupport();
42 
43  if (
44  !count($active_languages) ||
45  !$multilingual_value_support
46  ) {
47 
48  $languages = $this->getADT()->getTranslations();
49  $text = $languages[$this->getADT()->getCopyOfDefinition()->getDefaultLanguage()] ?? '';
50  $this->addElementToForm(
51  $this->getTitle(),
52  $this->getElementId() . '_' . $this->getADT()->getCopyOfDefinition()->getDefaultLanguage(),
53  $text,
54  false,
55  ''
56  );
57  return;
58  }
59  $is_translation = null;
60  foreach ($active_languages as $active_language) {
61  if (strcmp($active_language, $this->getADT()->getCopyOfDefinition()->getDefaultLanguage()) === 0) {
62  $is_translation = false;
63  } else {
64  $is_translation = true;
65  }
66 
67  $languages = $this->getADT()->getTranslations();
68 
69  $text = '';
70 
71  if (array_key_exists($active_language, $languages)) {
72  $text = $languages[$active_language];
73  }
74 
75  $this->addElementToForm(
76  $this->getTitle(),
77  $this->getElementId() . '_' . $active_language,
78  $text,
79  $is_translation,
80  $active_language
81  );
82  }
83  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addElementToForm(string $title, string $element_id, string $value, bool $is_translation=false, string $language='')
+ Here is the call graph for this function:

◆ importFromPost()

ilADTLocalizedTextFormBridge::importFromPost ( )

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

References ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), and ilADTFormBridge\getForm().

88  : void
89  {
90  $multilingual_value_support = $this->getADT()->getCopyOfDefinition()->getMultilingualValueSupport();
91  if (
92  !$this->getADT()->getCopyOfDefinition()->supportsTranslations() ||
93  !$multilingual_value_support
94  ) {
95  $language = $this->getADT()->getCopyOfDefinition()->getDefaultLanguage();
96  $this->getADT()->setTranslation(
97  $language,
98  $this->getForm()->getInput($this->getElementId() . '_' . $language)
99  );
100  $this->getADT()->setText($this->getForm()->getInput($this->getElementId() . '_' . $language));
101  $input_item = $this->getForm()->getItemByPostVar($this->getElementId() . '_' . $language);
102  $input_item->setValue($this->getADT()->getTextForLanguage($language));
103  return;
104  }
105  $active_languages = $this->getADT()->getCopyOfDefinition()->getActiveLanguages();
106  foreach ($active_languages as $language) {
107  $this->getADT()->setTranslation(
108  $language,
109  $this->getForm()->getInput($this->getElementId() . '_' . $language)
110  );
111  $this->getADT()->setText($this->getForm()->getInput($this->getElementId() . '_' . $language));
112  $input_item = $this->getForm()->getItemByPostVar($this->getElementId() . '_' . $language);
113  $input_item->setValue((string) $this->getADT()->getTranslations()[$language]);
114  }
115  }
+ Here is the call graph for this function:

◆ isValidADT()

ilADTLocalizedTextFormBridge::isValidADT ( ilADT  $a_adt)
protected

Definition at line 30 of file class.ilADTLocalizedTextFormBridge.php.

30  : bool
31  {
32  return $a_adt instanceof ilADTLocalizedText;
33  }
Class ilADTLocalizedText.

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