ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADTTextFormBridge Class Reference
+ Inheritance diagram for ilADTTextFormBridge:
+ Collaboration diagram for ilADTTextFormBridge:

Public Member Functions

 __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)
 
 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...
 

Protected Attributes

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

Definition at line 21 of file class.ilADTTextFormBridge.php.

Constructor & Destructor Documentation

◆ __construct()

ilADTTextFormBridge::__construct ( ilADT  $a_adt)

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

References ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

28  {
29  parent::__construct($a_adt);
30  $this->lng->loadLanguageModule('meta');
31  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addElementToForm()

ilADTTextFormBridge::addElementToForm ( string  $title,
string  $element_id,
string  $value,
bool  $is_translation = false,
string  $language = '' 
)
protected

Definition at line 50 of file class.ilADTTextFormBridge.php.

References ilADTFormBridge\addBasicFieldProperties(), ilADTFormBridge\addToParentElement(), ilADTFormBridge\getADT(), isMulti(), and ILIAS\Repository\lng().

Referenced by ilADTLocalizedTextFormBridge\addToForm(), and addToForm().

56  : void {
57  $def = $this->getADT()->getCopyOfDefinition();
58 
59  if (!$this->isMulti()) {
60  $text = new ilTextInputGUI($title, $element_id);
61 
62  if ($def->getMaxLength()) {
63  $max = $def->getMaxLength();
64  $size = $text->getSize();
65 
66  $text->setMaxLength($max);
67 
68  if ($size && $max < $size) {
69  $text->setSize($max);
70  }
71  }
72  } else {
73  $text = new ilTextAreaInputGUI($title, $element_id);
74  if ($this->multi_rows) {
75  $text->setRows($this->multi_rows);
76  }
77  if ($this->multi_cols) {
78  $text->setCols($this->multi_cols);
79  }
80 
81  if ($def->getMaxLength()) {
82  $max = $def->getMaxLength();
83  $text->setMaxNumOfChars($max);
84  }
85  }
86  $this->addBasicFieldProperties($text, $def);
87 
88  if ($is_translation) {
89  $text->setInfo($this->lng->txt('md_adv_int_translation_info') . ' ' . $this->lng->txt('meta_l_' . $language));
90  $text->setRequired(false);
91  }
92  $text->setValue($value);
93  $this->addToParentElement($text);
94  }
addToParentElement(ilFormPropertyGUI $a_field)
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToForm()

ilADTTextFormBridge::addToForm ( )

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

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

96  : void
97  {
98  $this->addElementToForm(
99  (string) $this->getTitle(),
100  (string) $this->getElementId(),
101  (string) $this->getADT()->getText()
102  );
103  }
addElementToForm(string $title, string $element_id, string $value, bool $is_translation=false, string $language='')
+ Here is the call graph for this function:

◆ importFromPost()

ilADTTextFormBridge::importFromPost ( )

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

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

105  : void
106  {
107  // ilPropertyFormGUI::checkInput() is pre-requisite
108  $this->getADT()->setText($this->getForm()->getInput($this->getElementId()));
109  $field = $this->getForm()->getItemByPostVar($this->getElementId());
110  $field->setValue($this->getADT()->getText());
111  }
+ Here is the call graph for this function:

◆ isMulti()

ilADTTextFormBridge::isMulti ( )

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

References $multi.

Referenced by addElementToForm().

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

◆ isValidADT()

ilADTTextFormBridge::isValidADT ( ilADT  $a_adt)
protected

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

45  : bool
46  {
47  return ($a_adt instanceof ilADTText);
48  }

◆ setMulti()

ilADTTextFormBridge::setMulti ( bool  $a_value,
?int  $a_cols = null,
?int  $a_rows = null 
)

Definition at line 33 of file class.ilADTTextFormBridge.php.

References null.

33  : void
34  {
35  $this->multi = $a_value;
36  $this->multi_rows = ($a_rows === null) ? null : $a_rows;
37  $this->multi_cols = ($a_cols === null) ? null : $a_cols;
38  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Field Documentation

◆ $multi

bool ilADTTextFormBridge::$multi = false
protected

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

Referenced by isMulti().

◆ $multi_cols

int ilADTTextFormBridge::$multi_cols
protected

Definition at line 25 of file class.ilADTTextFormBridge.php.

◆ $multi_rows

int ilADTTextFormBridge::$multi_rows
protected

Definition at line 24 of file class.ilADTTextFormBridge.php.


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