ILIAS  release_8 Revision v8.24
ilMultipleTextsInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ 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 ()
 Check input, strip slashes etc. More...
 
 render (string $a_mode="")
 
- Public Member Functions inherited from ilIdentifiedMultiValuesInputGUI
 __construct ($a_title="", $a_postvar="")
 
 getElementAddCmd ()
 
 setElementAddCmd ($elementAddCmd)
 
 getElementRemoveCmd ()
 
 setElementRemoveCmd ($elementRemoveCmd)
 
 getElementMoveUpCommand ()
 
 setElementMoveUpCommand ($elementMoveUpCommand)
 
 getElementMoveDownCommand ()
 
 setElementMoveDownCommand ($elementMoveDownCommand)
 
 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, $subFieldIndex)
 
 getMultiValuePosIndexedFieldId ($identifier, $positionIndex)
 
 getMultiValuePosIndexedSubFieldId ($identifier, $subFieldIndex, $positionIndex)
 
 getFieldIdFromPostVar ($tempPostVar)
 
 getPostVarSubField ($subFieldIndex)
 
 getMultiValuePostVarSubField ($identifier, $subFieldIndex)
 
 getMultiValuePostVarSubFieldPosIndexed ($identifier, $subFieldIndex, $positionIndex)
 
 getMultiValuePostVarPosIndexed ($identifier, $positionIndex)
 
 getMultiValuePostVar ($identifier)
 
 buildMultiValueSubmitVar ($identifier, $positionIndex, $submitCommand)
 
 setIdentifiedMultiValuesByArray ($a_values)
 
 prepareMultiValuesInput ($values)
 
 prepareMultiValuesSubmit ($values)
 
 getFormValuesManipulators ()
 
 addFormValuesManipulator (ilFormValuesManipulator $manipulator)
 
 getSubFieldCompletedPostVar ($subFieldIndex, $elemPostVar)
 
- Protected Member Functions inherited from ilFormPropertyGUI
 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
 
- Protected Attributes inherited from ilIdentifiedMultiValuesInputGUI
 $elementAddCmd = self::ELEMENT_DEFAULT_ADD_CMD
 
 $elementRemoveCmd = self::ELEMENT_DEFAULT_REMOVE_CMD
 
 $elementMoveUpCommand = self::ELEMENT_DEFAULT_MOVE_UP_CMD
 
 $elementMoveDownCommand = self::ELEMENT_DEFAULT_MOVE_DOWN_CMD
 
 $identified_multi_values = array()
 
 $formValuesManipulationChain = array()
 
- 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

Definition at line 22 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 40 of file class.ilMultipleTextsInputGUI.php.

41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 parent::__construct($a_title, $a_postvar);
46 $this->validationRegexp = "";
47 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ 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 193 of file class.ilMultipleTextsInputGUI.php.

194 {
195 if ($this->valueHasContentText($value)) {
196 return $value;
197 }
198
199 return null;
200 }

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 52 of file class.ilMultipleTextsInputGUI.php.

References $editElementOccuranceEnabled.

Referenced by ilDclMultiTextInputGUI\render(), and render().

+ Here is the caller graph for this function:

◆ isEditElementOrderEnabled()

ilMultipleTextsInputGUI::isEditElementOrderEnabled ( )
Returns
boolean

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

References $editElementOrderEnabled.

Referenced by ilDclMultiTextInputGUI\render(), and render().

+ Here is the caller graph for this function:

◆ onCheckInput()

ilMultipleTextsInputGUI::onCheckInput ( )

Check input, strip slashes etc.

set alert, if input is not ok. fetchImageTitle

Returns
boolean Input ok, true/false

Reimplemented from ilIdentifiedMultiValuesInputGUI.

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

86 : bool
87 {
89
90 $submittedElements = $this->getInput();
91
92 if ($submittedElements === [] && $this->getRequired()) {
93 $this->setAlert($lng->txt("msg_input_is_required"));
94 return false;
95 }
96
97 foreach ($submittedElements as $submittedValue) {
98 $submittedContentText = $this->fetchContentTextFromValue($submittedValue);
99
100 if ($this->getRequired() && trim((string) $submittedContentText) === "") {
101 $this->setAlert($lng->txt('msg_input_is_required'));
102 return false;
103 }
104
105 if ($this->getValidationRegexp() !== '') {
106 if (!preg_match($this->getValidationRegexp(), (string) $submittedContentText)) {
107 $this->setAlert($lng->txt('msg_wrong_format'));
108 return false;
109 }
110 }
111 }
112
113 return $this->checkSubItemsInput();
114 }
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 = "")
Parameters
string$mode
Returns
string

Reimplemented from ilTextInputGUI.

Reimplemented in ilDclMultiTextInputGUI.

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

120 : string
121 {
122 $tpl = new ilTemplate("tpl.prop_multi_text_inp.html", true, true, "Services/Form");
123 $i = 0;
124 foreach ($this->getIdentifiedMultiValues() as $identifier => $value) {
125 if (strlen($value)) {
126 $tpl->setCurrentBlock("prop_text_propval");
127 $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value));
128 $tpl->parseCurrentBlock();
129 }
130 if ($this->isEditElementOrderEnabled()) {
131 $tpl->setCurrentBlock("move");
132 $tpl->setVariable("ID_UP", $this->getMultiValuePosIndexedSubFieldId($identifier, 'up', $i));
133 $tpl->setVariable("ID_DOWN", $this->getMultiValuePosIndexedSubFieldId($identifier, 'down', $i));
134 $tpl->setVariable("CMD_UP", $this->buildMultiValueSubmitVar($identifier, $i, 'up'));
135 $tpl->setVariable("CMD_DOWN", $this->buildMultiValueSubmitVar($identifier, $i, 'down'));
136 $tpl->setVariable("ID", $this->getMultiValuePosIndexedFieldId($identifier, $i));
137 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
138 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
139 $tpl->parseCurrentBlock();
140 }
141 $tpl->setCurrentBlock("row");
142 $tpl->setVariable("POST_VAR", $this->getMultiValuePostVarPosIndexed($identifier, $i));
143 $tpl->setVariable("ID", $this->getMultiValuePosIndexedFieldId($identifier, $i));
144 $tpl->setVariable("SIZE", $this->getSize());
145 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
146
147 if ($this->getDisabled()) {
148 $tpl->setVariable(
149 "DISABLED",
150 " disabled=\"disabled\""
151 );
152 } elseif ($this->isEditElementOccuranceEnabled()) {
153 $tpl->setVariable("ID_ADD", $this->getMultiValuePosIndexedSubFieldId($identifier, 'add', $i));
154 $tpl->setVariable("ID_REMOVE", $this->getMultiValuePosIndexedSubFieldId($identifier, 'remove', $i));
155 $tpl->setVariable("CMD_ADD", $this->buildMultiValueSubmitVar($identifier, $i, 'add'));
156 $tpl->setVariable("CMD_REMOVE", $this->buildMultiValueSubmitVar($identifier, $i, 'remove'));
157 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
158 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
159 }
160
161 $tpl->parseCurrentBlock();
162 $i++;
163 }
164 $tpl->setVariable("ELEMENT_ID", $this->getFieldId());
165
166 if (!$this->getDisabled()) {
167 $globalTpl = $GLOBALS['DIC'] ? $GLOBALS['DIC']['tpl'] : $GLOBALS['tpl'];
168 $globalTpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
169 $globalTpl->addJavascript("./Services/Form/js/ServiceFormIdentifiedWizardInputExtend.js");
170 $globalTpl->addJavascript("./Services/Form/js/ServiceFormMultiTextInputInit.js");
171 }
172
173 return $tpl->get();
174 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static get(string $a_glyph, string $a_text="")
getMultiValuePosIndexedSubFieldId($identifier, $subFieldIndex, $positionIndex)
buildMultiValueSubmitVar($identifier, $positionIndex, $submitCommand)
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:41

References $GLOBALS, $i, $tpl, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilIdentifiedMultiValuesInputGUI\buildMultiValueSubmitVar(), ilGlyphGUI\DOWN, ilGlyphGUI\get(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilIdentifiedMultiValuesInputGUI\getIdentifiedMultiValues(), ilTextInputGUI\getMaxLength(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedSubFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePostVarPosIndexed(), ilTextInputGUI\getSize(), isEditElementOccuranceEnabled(), isEditElementOrderEnabled(), ilLegacyFormElementsUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, and ilGlyphGUI\UP.

+ Here is the call graph for this function:

◆ setEditElementOccuranceEnabled()

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

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

60 : void
61 {
62 $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
63 }

References $editElementOccuranceEnabled.

◆ setEditElementOrderEnabled()

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

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

76 : void
77 {
78 $this->editElementOrderEnabled = $editElementOrderEnabled;
79 }

References $editElementOrderEnabled.

◆ valueHasContentText()

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

Reimplemented in ilAssOrderingTextsInputGUI.

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

180 : bool
181 {
182 if ($value === null || is_array($value) || is_object($value)) {
183 return false;
184 }
185
186 return (bool) strlen($value);
187 }

References ilTextInputGUI\$value.

Referenced by fetchContentTextFromValue().

+ Here is the caller graph for this function:

Field Documentation

◆ $editElementOccuranceEnabled

ilMultipleTextsInputGUI::$editElementOccuranceEnabled = false
protected

◆ $editElementOrderEnabled

ilMultipleTextsInputGUI::$editElementOrderEnabled = false
protected

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