ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 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 ()
 
 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)
 
- 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
 getTableFilterLabelFor ()
 Get label "for" attribute value. 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
 
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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

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

48  {
49  parent::__construct($a_title, $a_postvar);
50 
51  global $DIC;
52  $this->lng = $DIC['lng'];
53  $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
54  $this->renderer = $DIC['ui.renderer'];
55  $this->tpl = $DIC['tpl'];
56 
57  $this->validationRegexp = "";
58  }
renderer()
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ 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 203 of file class.ilMultipleTextsInputGUI.php.

References ilTextInputGUI\$value, null, and valueHasContentText().

Referenced by onCheckInput().

204  {
205  if ($this->valueHasContentText($value)) {
206  return $value;
207  }
208 
209  return null;
210  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 63 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 79 of file class.ilMultipleTextsInputGUI.php.

References $editElementOrderEnabled.

Referenced by render().

79  : bool
80  {
82  }
+ Here is the caller graph for this function:

◆ onCheckInput()

ilMultipleTextsInputGUI::onCheckInput ( )

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

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

92  : bool
93  {
94  $lng = $this->lng;
95 
96  $submittedElements = $this->getInput();
97 
98  if ($submittedElements === [] && $this->getRequired()) {
99  $this->setAlert($lng->txt('msg_input_is_required'));
100  return false;
101  }
102 
103  foreach ($submittedElements as $submittedValue) {
104  $submittedContentText = $this->fetchContentTextFromValue($submittedValue);
105 
106  if ($this->getRequired() && trim((string) $submittedContentText) === "") {
107  $this->setAlert($lng->txt('msg_input_is_required'));
108  return false;
109  }
110 
111  if ($this->getValidationRegexp() !== '') {
112  if (!preg_match($this->getValidationRegexp(), (string) $submittedContentText)) {
113  $this->setAlert($lng->txt('msg_wrong_format'));
114  return false;
115  }
116  }
117  }
118 
119  return $this->checkSubItemsInput();
120  }
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...
+ Here is the call graph for this function:

◆ render()

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

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

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

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

◆ setEditElementOccuranceEnabled()

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

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

References $editElementOccuranceEnabled.

71  : void
72  {
73  $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
74  }

◆ setEditElementOrderEnabled()

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

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

References $editElementOrderEnabled.

87  : void
88  {
89  $this->editElementOrderEnabled = $editElementOrderEnabled;
90  }

◆ valueHasContentText()

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

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

References ilTextInputGUI\$value, and null.

Referenced by fetchContentTextFromValue().

190  : bool
191  {
192  if ($value === null || is_array($value) || is_object($value)) {
193  return false;
194  }
195 
196  return (bool) strlen($value);
197  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

Field Documentation

◆ $editElementOccuranceEnabled

ilMultipleTextsInputGUI::$editElementOccuranceEnabled = false
protected

◆ $editElementOrderEnabled

ilMultipleTextsInputGUI::$editElementOrderEnabled = false
protected

◆ $glyph_factory

GlyphFactory ilMultipleTextsInputGUI::$glyph_factory
protected

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

◆ $renderer

Renderer ilMultipleTextsInputGUI::$renderer
protected

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

◆ $tpl

ilGlobalTemplateInterface ilMultipleTextsInputGUI::$tpl
protected

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


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