ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ilMultipleTextsInputGUI Class Reference
+ Inheritance diagram for ilMultipleTextsInputGUI:
+ Collaboration diagram for ilMultipleTextsInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 isEditElementOccuranceEnabled ()
 
 setEditElementOccuranceEnabled ($editElementOccuranceEnabled)
 
 isEditElementOrderEnabled ()
 
 setEditElementOrderEnabled ($editElementOrderEnabled)
 
 onCheckInput ()
 
 render (string $a_mode="")
 
- Public Member Functions inherited from ilIdentifiedMultiValuesInputGUI
 __construct ($a_title="", $a_postvar="")
 
 getElementAddCmd ()
 
 setElementAddCmd (string $element_add_cmd)
 
 getElementRemoveCmd ()
 
 setElementRemoveCmd (string $element_remove_cmd)
 
 getElementMoveUpCommand ()
 
 setElementMoveUpCommand (string $element_move_up_cmd)
 
 getElementMoveDownCommand ()
 
 setElementMoveDownCommand (string $element_move_down_cmd)
 
 setValues ($values)
 
 getValues ()
 
 setValue ($value)
 
 getValue ()
 
 setMultiValues (array $values)
 
 getMultiValues ()
 
 setIdentifiedMultiValues ($values)
 
 getIdentifiedMultiValues ()
 
 setValueByArray (array $a_values)
 
 getInput ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 onCheckInput ()
 
 prepareReprintable (assQuestion $question)
 
- Public Member Functions inherited from ilTextInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setValue ($a_value)
 
 getValue ()
 
 setValidationFailureMessage (string $a_msg)
 
 getValidationFailureMessage ()
 
 setValidationRegexp (string $a_value)
 
 getValidationRegexp ()
 
 setMaxLength (?int $a_maxlength)
 
 getMaxLength ()
 
 setSize (int $a_size)
 
 setInlineStyle (string $a_style)
 
 getInlineStyle ()
 
 setCssClass (string $a_class)
 
 getCssClass ()
 
 setValueByArray (array $a_values)
 
 getSize ()
 
 setSuffix (string $a_value)
 
 getSuffix ()
 
 setInputType (string $a_type)
 set input type More...
 
 getInputType ()
 
 setSubmitFormOnEnter (bool $a_val)
 
 getSubmitFormOnEnter ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 getDataSource ()
 
 setDataSource (string $href, ?string $a_delimiter=null)
 
 setDataSourceSubmitOnSelection (bool $a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl (string $a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 
 render (string $a_mode="")
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
 setDisableHtmlAutoComplete (bool $autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
 getPostValueForComparison ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Member Functions

 valueHasContentText ($value)
 
 fetchContentTextFromValue ($value)
 
- Protected Member Functions inherited from ilIdentifiedMultiValuesInputGUI
 getMultiValueSubFieldId ($identifier, $sub_field_index)
 
 getMultiValuePosIndexedFieldId ($identifier, $position_index)
 
 getMultiValuePosIndexedSubFieldId ($identifier, $sub_field_index, $position_index)
 
 getFieldIdFromPostVar ($temp_post_var)
 
 getPostVarSubField ($sub_field_index)
 
 getMultiValuePostVarSubField ($identifier, $sub_field_index)
 
 getMultiValuePostVarSubFieldPosIndexed ($identifier, $sub_field_index, $position_index)
 
 getMultiValuePostVarPosIndexed ($identifier, $positionIndex)
 
 getMultiValuePostVar ($identifier)
 
 buildMultiValueSubmitVar ($identifier, $position_index, $submit_cmd)
 
 setIdentifiedMultiValuesByArray ($a_values)
 
 prepareMultiValuesInput ($values)
 
 prepareMultiValuesSubmit ($values)
 
 getFormValuesManipulators ()
 
 addFormValuesManipulator (ilFormValuesManipulator $manipulator)
 
 getSubFieldCompletedPostVar ($subFieldIndex, $elem_post_var)
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Protected Attributes

 $editElementOccuranceEnabled = false
 
 $editElementOrderEnabled = false
 
GlyphFactory $glyph_factory
 
ButtonFactory $button_factory
 
Renderer $renderer
 
ilGlobalTemplateInterface $tpl
 
- Protected Attributes inherited from ilIdentifiedMultiValuesInputGUI
string $element_add_cmd = self::ELEMENT_DEFAULT_ADD_CMD
 
string $element_remove_cmd = self::ELEMENT_DEFAULT_REMOVE_CMD
 
string $element_move_up_cmd = self::ELEMENT_DEFAULT_MOVE_UP_CMD
 
string $element_move_down_cmd = self::ELEMENT_DEFAULT_MOVE_DOWN_CMD
 
 $identified_multi_values = []
 
 $formValuesManipulationChain = []
 
- Protected Attributes inherited from ilTextInputGUI
 $value = null
 
int $maxlength = 200
 
int $size = 40
 
string $validationRegexp = ""
 
string $validationFailureMessage = ''
 
string $suffix = ""
 
string $style_css = ""
 
string $css_class = ""
 
string $ajax_datasource = ""
 
string $ajax_datasource_delimiter = null
 
bool $ajax_datasource_commit = false
 
string $ajax_datasource_commit_url = ""
 
bool $submit_form_on_enter = false
 
bool $autocomplete_disabled = false
 
string $input_type = ""
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Data Fields inherited from ilIdentifiedMultiValuesInputGUI
const ELEMENT_DEFAULT_ADD_CMD = 'addElement'
 
const ELEMENT_DEFAULT_REMOVE_CMD = 'removeElement'
 
const ELEMENT_DEFAULT_MOVE_UP_CMD = 'moveUpElement'
 
const ELEMENT_DEFAULT_MOVE_DOWN_CMD = 'moveDownElement'
 

Detailed Description

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

Definition at line 26 of file class.ilMultipleTextsInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMultipleTextsInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilIdentifiedMultiValuesInputGUI.

Definition at line 49 of file class.ilMultipleTextsInputGUI.php.

50 {
51 parent::__construct($a_title, $a_postvar);
52
53 global $DIC;
54 $this->lng = $DIC['lng'];
55 $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
56 $this->button_factory = $DIC->ui()->factory()->button();
57 $this->renderer = $DIC['ui.renderer'];
58 $this->tpl = $DIC['tpl'];
59
60 $this->validationRegexp = "";
61 }
renderer()
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ fetchContentTextFromValue()

ilMultipleTextsInputGUI::fetchContentTextFromValue (   $value)
protected
Parameters
mixed$value
Returns
string|ilAssOrderingElement|null

Definition at line 206 of file class.ilMultipleTextsInputGUI.php.

207 {
208 if ($this->valueHasContentText($value)) {
209 return $value;
210 }
211
212 return null;
213 }

References ilTextInputGUI\$value, and valueHasContentText().

Referenced by onCheckInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEditElementOccuranceEnabled()

ilMultipleTextsInputGUI::isEditElementOccuranceEnabled ( )
Returns
boolean $editElementOccuranceEnabled

Definition at line 66 of file class.ilMultipleTextsInputGUI.php.

References $editElementOccuranceEnabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ isEditElementOrderEnabled()

ilMultipleTextsInputGUI::isEditElementOrderEnabled ( )
Returns
boolean

Definition at line 82 of file class.ilMultipleTextsInputGUI.php.

References $editElementOrderEnabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ onCheckInput()

ilMultipleTextsInputGUI::onCheckInput ( )

Reimplemented from ilIdentifiedMultiValuesInputGUI.

Definition at line 95 of file class.ilMultipleTextsInputGUI.php.

95 : bool
96 {
98
99 $submittedElements = $this->getInput();
100
101 if ($submittedElements === [] && $this->getRequired()) {
102 $this->setAlert($lng->txt('msg_input_is_required'));
103 return false;
104 }
105
106 foreach ($submittedElements as $submittedValue) {
107 $submittedContentText = $this->fetchContentTextFromValue($submittedValue);
108
109 if ($this->getRequired() && trim((string) $submittedContentText) === "") {
110 $this->setAlert($lng->txt('msg_input_is_required'));
111 return false;
112 }
113
114 if ($this->getValidationRegexp() !== '') {
115 if (!preg_match($this->getValidationRegexp(), (string) $submittedContentText)) {
116 $this->setAlert($lng->txt('msg_wrong_format'));
117 return false;
118 }
119 }
120 }
121
122 return $this->checkSubItemsInput();
123 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), fetchContentTextFromValue(), ilIdentifiedMultiValuesInputGUI\getInput(), ilFormPropertyGUI\getRequired(), ilTextInputGUI\getValidationRegexp(), ilFormPropertyGUI\setAlert(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ render()

ilMultipleTextsInputGUI::render ( string  $a_mode = "")

Reimplemented from ilTextInputGUI.

Definition at line 125 of file class.ilMultipleTextsInputGUI.php.

125 : string
126 {
127 $tpl = new ilTemplate("tpl.prop_multi_text_inp.html", true, true, "components/ILIAS/TestQuestionPool");
128 $i = 0;
129 foreach ($this->getIdentifiedMultiValues() as $identifier => $value) {
130 if ($value !== null) {
131 $tpl->setCurrentBlock("prop_text_propval");
134 }
135 if ($this->isEditElementOrderEnabled()) {
136 $tpl->setCurrentBlock("move");
137 $tpl->setVariable("ID_UP", $this->getMultiValuePosIndexedSubFieldId($identifier, 'up', $i));
138 $tpl->setVariable("ID_DOWN", $this->getMultiValuePosIndexedSubFieldId($identifier, 'down', $i));
139 $tpl->setVariable("ID", $this->getMultiValuePosIndexedFieldId($identifier, $i));
140 $tpl->setVariable("UP_BUTTON", $this->renderer->render(
141 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->up())
142 ));
143 $tpl->setVariable("DOWN_BUTTON", $this->renderer->render(
144 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->down())
145 ));
147 }
148 $tpl->setCurrentBlock("row");
149 $tpl->setVariable("POST_VAR", $this->getMultiValuePostVarPosIndexed($identifier, $i));
150 $tpl->setVariable("ID", $this->getMultiValuePosIndexedFieldId($identifier, $i));
151 $tpl->setVariable("SIZE", $this->getSize());
152 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
153
154 if ($this->getDisabled()) {
156 "DISABLED",
157 " disabled=\"disabled\""
158 );
159 } elseif ($this->isEditElementOccuranceEnabled()) {
160 $tpl->setVariable("ID_ADD", $this->getMultiValuePosIndexedSubFieldId($identifier, 'add', $i));
161 $tpl->setVariable("ID_REMOVE", $this->getMultiValuePosIndexedSubFieldId($identifier, 'remove', $i));
162 $tpl->setVariable("ADD_BUTTON", $this->renderer->render(
163 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->add())
164 ));
165 $tpl->setVariable("REMOVE_BUTTON", $this->renderer->render(
166 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->remove())
167 ));
168 }
169
171 $i++;
172 }
173 $tpl->setVariable("ELEMENT_ID", $this->getFieldId());
174
175 if (!$this->getDisabled()) {
176 $config = '{'
177 . '"fieldContainerSelector": ".ilWzdContainerText", '
178 . '"reindexingRequiredElementsSelectors": ["input:text", "button"], '
179 . '"handleRowCleanUpCallback": function(rowElem) {$(rowElem).find("input:text").val("")}'
180 . '}';
181 $this->tpl->addJavascript("assets/js/answerwizardinput.js");
182 $this->tpl->addJavascript("assets/js/identifiedwizardinput.js");
183 $this->tpl->addOnLoadCode("$.extend({}, AnswerWizardInput, IdentifiedWizardInput).init({$config});");
184 }
185
186 return $tpl->get();
187 }
getMultiValuePosIndexedFieldId($identifier, $position_index)
getMultiValuePosIndexedSubFieldId($identifier, $sub_field_index, $position_index)
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $tpl, ilTextInputGUI\$value, ILIAS\UICore\GlobalTemplate\get(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilIdentifiedMultiValuesInputGUI\getIdentifiedMultiValues(), ilTextInputGUI\getMaxLength(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedSubFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePostVarPosIndexed(), ilTextInputGUI\getSize(), isEditElementOccuranceEnabled(), isEditElementOrderEnabled(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), renderer(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), and ILIAS\UICore\GlobalTemplate\setVariable().

+ Here is the call graph for this function:

◆ setEditElementOccuranceEnabled()

ilMultipleTextsInputGUI::setEditElementOccuranceEnabled (   $editElementOccuranceEnabled)
Parameters
boolean$editElementOccuranceEnabled

Definition at line 74 of file class.ilMultipleTextsInputGUI.php.

74 : void
75 {
76 $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
77 }

References $editElementOccuranceEnabled.

◆ setEditElementOrderEnabled()

ilMultipleTextsInputGUI::setEditElementOrderEnabled (   $editElementOrderEnabled)
Parameters
boolean$editElementOrderEnabled

Definition at line 90 of file class.ilMultipleTextsInputGUI.php.

90 : void
91 {
92 $this->editElementOrderEnabled = $editElementOrderEnabled;
93 }

References $editElementOrderEnabled.

◆ valueHasContentText()

ilMultipleTextsInputGUI::valueHasContentText (   $value)
protected
Parameters
$value
Returns
bool

Reimplemented in ilAssOrderingTextsInputGUI.

Definition at line 193 of file class.ilMultipleTextsInputGUI.php.

193 : bool
194 {
195 if ($value === null || is_array($value) || is_object($value)) {
196 return false;
197 }
198
199 return (bool) strlen($value);
200 }

References ilTextInputGUI\$value.

Referenced by fetchContentTextFromValue().

+ Here is the caller graph for this function:

Field Documentation

◆ $button_factory

ButtonFactory ilMultipleTextsInputGUI::$button_factory
protected

Definition at line 39 of file class.ilMultipleTextsInputGUI.php.

◆ $editElementOccuranceEnabled

ilMultipleTextsInputGUI::$editElementOccuranceEnabled = false
protected

◆ $editElementOrderEnabled

ilMultipleTextsInputGUI::$editElementOrderEnabled = false
protected

◆ $glyph_factory

GlyphFactory ilMultipleTextsInputGUI::$glyph_factory
protected

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

◆ $renderer

Renderer ilMultipleTextsInputGUI::$renderer
protected

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

◆ $tpl

ilGlobalTemplateInterface ilMultipleTextsInputGUI::$tpl
protected

Definition at line 41 of file class.ilMultipleTextsInputGUI.php.

Referenced by render().


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