ILIAS  release_8 Revision v8.23
ilMultipleImagesInputGUI 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 ilMultipleImagesInputGUI:
+ Collaboration diagram for ilMultipleImagesInputGUI:

Public Member Functions

 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 getSuffixes ()
 
 getImageRemovalCommand ()
 
 setImageRemovalCommand ($imageRemovalCommand)
 
 getImageUploadCommand ()
 
 setImageUploadCommand ($imageUploadCommand)
 
 isEditElementOccuranceEnabled ()
 
 setEditElementOccuranceEnabled ($editElementOccuranceEnabled)
 
 isEditElementOrderEnabled ()
 
 setEditElementOrderEnabled ($editElementOrderEnabled)
 
 onCheckInput ()
 
 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 ()
 
 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...
 

Data Fields

const RENDERING_TEMPLATE = 'tpl.prop_multi_image_inp.html'
 
const ITERATOR_SUBFIELD_NAME = 'iteratorfield'
 
const STORED_IMAGE_SUBFIELD_NAME = 'storedimage'
 
const IMAGE_UPLOAD_SUBFIELD_NAME = 'imageupload'
 
const FILE_DATA_INDEX_DODGING_FILE = 'dodging_file'
 
- 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'
 

Protected Member Functions

 valueHasContentImageSource ($value)
 
 fetchContentImageSourceFromValue ($value)
 
 valueHasContentImageTitle ($value)
 
 fetchContentImageTitleFromValue ($value)
 
 getTemplate ()
 
- 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
 
stdClass $dodging_files
 
 $suffixes = array()
 
 $imageRemovalCommand = 'removeImage'
 
 $imageUploadCommand = 'uploadImage'
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
- 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...
 

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.ilMultipleImagesInputGUI.php.

Member Function Documentation

◆ fetchContentImageSourceFromValue()

ilMultipleImagesInputGUI::fetchContentImageSourceFromValue (   $value)
protected
Parameters
array$value

Definition at line 386 of file class.ilMultipleImagesInputGUI.php.

References ilTextInputGUI\$value, and valueHasContentImageSource().

Referenced by fetchContentImageTitleFromValue(), and render().

386  : ?string
387  {
388  if ($this->valueHasContentImageSource($value)) {
389  return $value['src'];
390  }
391 
392  return null;
393  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchContentImageTitleFromValue()

ilMultipleImagesInputGUI::fetchContentImageTitleFromValue (   $value)
protected

Definition at line 403 of file class.ilMultipleImagesInputGUI.php.

References ilTextInputGUI\$value, fetchContentImageSourceFromValue(), and valueHasContentImageTitle().

Referenced by render().

403  : ?string
404  {
405  if ($this->valueHasContentImageTitle($value)) {
406  return $value['title'];
407  }
408 
410  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageRemovalCommand()

ilMultipleImagesInputGUI::getImageRemovalCommand ( )

Definition at line 106 of file class.ilMultipleImagesInputGUI.php.

References $imageRemovalCommand.

Referenced by render().

106  : string
107  {
109  }
+ Here is the caller graph for this function:

◆ getImageUploadCommand()

ilMultipleImagesInputGUI::getImageUploadCommand ( )

Definition at line 119 of file class.ilMultipleImagesInputGUI.php.

References $imageUploadCommand.

Referenced by render().

119  : string
120  {
122  }
+ Here is the caller graph for this function:

◆ getSuffixes()

ilMultipleImagesInputGUI::getSuffixes ( )

Definition at line 101 of file class.ilMultipleImagesInputGUI.php.

References $suffixes.

Referenced by onCheckInput(), and render().

101  : array
102  {
103  return $this->suffixes;
104  }
+ Here is the caller graph for this function:

◆ getTemplate()

ilMultipleImagesInputGUI::getTemplate ( )
protected

Definition at line 412 of file class.ilMultipleImagesInputGUI.php.

Referenced by render().

412  : ilTemplate
413  {
414  return new ilTemplate(self::RENDERING_TEMPLATE, true, true, "Modules/TestQuestionPool");
415  }
+ Here is the caller graph for this function:

◆ isEditElementOccuranceEnabled()

ilMultipleImagesInputGUI::isEditElementOccuranceEnabled ( )

Definition at line 132 of file class.ilMultipleImagesInputGUI.php.

References $editElementOccuranceEnabled.

Referenced by render().

132  : bool
133  {
135  }
+ Here is the caller graph for this function:

◆ isEditElementOrderEnabled()

ilMultipleImagesInputGUI::isEditElementOrderEnabled ( )

Definition at line 145 of file class.ilMultipleImagesInputGUI.php.

References $editElementOrderEnabled.

Referenced by render().

145  : bool
146  {
148  }
+ Here is the caller graph for this function:

◆ onCheckInput()

ilMultipleImagesInputGUI::onCheckInput ( )

Definition at line 158 of file class.ilMultipleImagesInputGUI.php.

References $filename, $index, ilTextInputGUI\$suffix, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilIdentifiedMultiValuesInputGUI\getInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSuffixes(), ILIAS\Repository\lng(), ilFormPropertyGUI\setAlert(), and ilVirusScanner\virusHandling().

158  : bool
159  {
160  $F = $_FILES[$this->getPostVar()];
161 
162  $submittedElements = $this->getInput();
163 
164  if ($F && ((array) $this->dodging_files) !== []) {
165  $F = array_merge([self::FILE_DATA_INDEX_DODGING_FILE => (array) $this->dodging_files], $F);
166  }
167 
168  if ($this->getRequired() && !is_array($F['error'])) {
169  $this->setAlert($this->lng->txt("form_msg_file_no_upload"));
170  return false;
171  } else {
172  foreach ($F['error'] as $index => $error) {
173  // error handling
174  if ($error > 0) {
175  switch ($error) {
176  case UPLOAD_ERR_FORM_SIZE:
177  case UPLOAD_ERR_INI_SIZE:
178  $this->setAlert($this->lng->txt("form_msg_file_size_exceeds"));
179  return false;
180  break;
181 
182  case UPLOAD_ERR_PARTIAL:
183  $this->setAlert($this->lng->txt("form_msg_file_partially_uploaded"));
184  return false;
185  break;
186 
187  case UPLOAD_ERR_NO_FILE:
188  if (!$this->getRequired()) {
189  break;
190  } elseif (isset($F[self::FILE_DATA_INDEX_DODGING_FILE][$index]) && $F[self::FILE_DATA_INDEX_DODGING_FILE][$index] !== '') {
191  break;
192  }
193  $this->setAlert($this->lng->txt("form_msg_file_no_upload"));
194  return false;
195  break;
196 
197  case UPLOAD_ERR_NO_TMP_DIR:
198  $this->setAlert($this->lng->txt("form_msg_file_missing_tmp_dir"));
199  return false;
200  break;
201 
202  case UPLOAD_ERR_CANT_WRITE:
203  $this->setAlert($this->lng->txt("form_msg_file_cannot_write_to_disk"));
204  return false;
205  break;
206 
207  case UPLOAD_ERR_EXTENSION:
208  $this->setAlert($this->lng->txt("form_msg_file_upload_stopped_ext"));
209  return false;
210  break;
211  }
212  }
213  }
214  }
215 
216  if (is_array($F['tmp_name'])) {
217  foreach ($F['tmp_name'] as $index => $tmpname) {
218  $filename = $F['name'][$index];
219  if (is_array($filename)) {
220  $filename = array_shift($filename);
221  $tmpname = array_shift($tmpname);
222  }
223  $filename_arr = pathinfo($filename);
224  $suffix = $filename_arr["extension"] ?? '';
225  $mimetype = $F['type'][$index];
226  $size_bytes = $F['size'][$index];
227  // check suffixes
228  if (strlen($tmpname) && is_array($this->getSuffixes())) {
229  if (!in_array(strtolower($suffix), $this->getSuffixes())) {
230  $this->setAlert($this->lng->txt("form_msg_file_wrong_file_type"));
231  return false;
232  }
233  }
234  }
235  }
236 
237  foreach ($F['tmp_name'] as $index => $tmpname) {
238  $filename = $F['name'][$index];
239  if (is_array($filename)) {
240  $filename = array_shift($filename);
241  $tmpname = array_shift($tmpname);
242  }
243  $filename_arr = pathinfo($filename);
244  $suffix = $filename_arr["extension"] ?? '';
245  $mimetype = $F['type'][$index];
246  $size_bytes = $F['size'][$index];
247  // virus handling
248  if (strlen($tmpname)) {
249  $vir = ilVirusScanner::virusHandling($tmpname, $filename);
250  if ($vir[0] == false) {
251  $this->setAlert($this->lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
252  return false;
253  }
254  }
255  }
256 
257  return $this->checkSubItemsInput();
258  }
static virusHandling(string $a_file, string $a_orig_name='', bool $a_clean=true)
$index
Definition: metadata.php:145
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ render()

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

Definition at line 260 of file class.ilMultipleImagesInputGUI.php.

References $i, ilIdentifiedMultiValuesInputGUI\$identified_multi_values, $lng, ilTextInputGUI\$suffix, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilIdentifiedMultiValuesInputGUI\buildMultiValueSubmitVar(), ilGlyphGUI\DOWN, fetchContentImageSourceFromValue(), fetchContentImageTitleFromValue(), ilGlyphGUI\get(), ilGlobalTemplateInterface\get(), ilFormPropertyGUI\getDisabled(), ilFileUtils\getFileSizeInfo(), ilIdentifiedMultiValuesInputGUI\getIdentifiedMultiValues(), getImageRemovalCommand(), getImageUploadCommand(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedSubFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePostVarSubFieldPosIndexed(), ilFormPropertyGUI\getPostVar(), getSuffixes(), getTemplate(), isEditElementOccuranceEnabled(), isEditElementOrderEnabled(), ilGlobalTemplateInterface\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilIdentifiedMultiValuesInputGUI\prepareMultiValuesInput(), ilGlyphGUI\REMOVE, ilGlobalTemplateInterface\setCurrentBlock(), ilGlobalTemplateInterface\setVariable(), ilLanguage\txt(), ilGlyphGUI\UP, and valueHasContentImageSource().

260  : string
261  {
262  $lng = $this->lng;
263 
264  $tpl = $this->getTemplate();
265  $i = 0;
266 
268  foreach ($identified_multi_values as $identifier => $value) {
269  if ($this->valueHasContentImageSource($value)) {
270  $tpl->setCurrentBlock('image');
271 
272  $tpl->setVariable('STORED_IMAGE_SRC', $this->fetchContentImageSourceFromValue($value));
273  $tpl->setVariable(
274  'STORED_IMAGE_ALT',
276  );
277  $tpl->setVariable('STORED_IMAGE_FILENAME', $this->fetchContentImageTitleFromValue($value));
278  $tpl->setVariable("STORED_IMAGE_POST_VAR", $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::STORED_IMAGE_SUBFIELD_NAME, $i));
279 
280  $tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
281  $tpl->setVariable("IMAGE_CMD_REMOVE", $this->buildMultiValueSubmitVar($identifier, $i, $this->getImageRemovalCommand()));
282 
284  }
285 
286  $tpl->setCurrentBlock('addimage');
287 
288  $tpl->setVariable("IMAGE_BROWSE", $lng->txt('select_file'));
289  $tpl->setVariable("IMAGE_ID", $this->getMultiValuePosIndexedSubFieldId($identifier, self::IMAGE_UPLOAD_SUBFIELD_NAME, $i));
290  $tpl->setVariable("TXT_IMAGE_SUBMIT", $lng->txt("upload"));
291  $tpl->setVariable("IMAGE_CMD_UPLOAD", $this->buildMultiValueSubmitVar($identifier, $i, $this->getImageUploadCommand()));
292  $tpl->setVariable("UPLOAD_IMAGE_POST_VAR", $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::IMAGE_UPLOAD_SUBFIELD_NAME, $i));
293  $tpl->setVariable("COUNT_POST_VAR", $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::ITERATOR_SUBFIELD_NAME, $i));
294 
296 
297  if ($this->isEditElementOrderEnabled()) {
298  $tpl->setCurrentBlock("move");
299  $tpl->setVariable("ID_UP", $this->getMultiValuePosIndexedSubFieldId($identifier, 'up', $i));
300  $tpl->setVariable("ID_DOWN", $this->getMultiValuePosIndexedSubFieldId($identifier, 'down', $i));
301  $tpl->setVariable("CMD_UP", $this->buildMultiValueSubmitVar($identifier, $i, 'up'));
302  $tpl->setVariable("CMD_DOWN", $this->buildMultiValueSubmitVar($identifier, $i, 'down'));
306  }
307 
308  if ($this->isEditElementOccuranceEnabled()) {
309  $tpl->setCurrentBlock("row");
310  $tpl->setVariable("ID_ADD", $this->getMultiValuePosIndexedSubFieldId($identifier, 'add', $i));
311  $tpl->setVariable("ID_REMOVE", $this->getMultiValuePosIndexedSubFieldId($identifier, 'remove', $i));
312  $tpl->setVariable("CMD_ADD", $this->buildMultiValueSubmitVar($identifier, $i, 'add'));
313  $tpl->setVariable("CMD_REMOVE", $this->buildMultiValueSubmitVar($identifier, $i, 'remove'));
317  }
318 
319  $i++;
320  }
321 
322  if (is_array($this->getSuffixes())) {
323  $suff_str = $delim = "";
324  foreach ($this->getSuffixes() as $suffix) {
325  $suff_str .= $delim . "." . $suffix;
326  $delim = ", ";
327  }
328  $tpl->setCurrentBlock('allowed_image_suffixes');
329  $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str);
331  }
332 
333  $tpl->setVariable("TXT_MAX_SIZE", ilFileUtils::getFileSizeInfo());
334  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
335  $tpl->setVariable("TEXT_YES", $lng->txt('yes'));
336  $tpl->setVariable("TEXT_NO", $lng->txt('no'));
337  $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
338  $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
339  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
340  $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
341 
342  if (!$this->getDisabled()) {
343  $iterator_subfield_name = self::ITERATOR_SUBFIELD_NAME;
344  $image_upload_subfield_name = self::IMAGE_UPLOAD_SUBFIELD_NAME;
345 
346  $init_code = <<<JS
347 $.extend({}, ilWizardInput, ilIdentifiedWizardInputExtend).init(
348  {
349  'fieldContainerSelector': '.ilWzdContainerImage',
350  'reindexingRequiredElementsSelectors': [
351  'input:hidden[name*="[{$iterator_subfield_name}]"]',
352  'input:file[id*="__{$image_upload_subfield_name}__"]',
353  'input:submit[name*="[{$this->getImageUploadCommand()}]"]',
354  'input:submit[name*="[{$this->getImageRemovalCommand()}]"]',
355  'button'
356  ],
357  'handleRowCleanUpCallback': function(rowElem) {
358  $(rowElem).find('div.imagepresentation').remove();
359  $(rowElem).find('input[type=text]').val('');
360  }
361  }
362 );
363 JS;
364 
365  $this->tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
366  $this->tpl->addJavascript("./Services/Form/js/ServiceFormIdentifiedWizardInputExtend.js");
367  $this->tpl->addOnLoadCode($init_code);
368  }
369 
370  return $tpl->get();
371  }
getMultiValuePostVarSubFieldPosIndexed($identifier, $subFieldIndex, $positionIndex)
getMultiValuePosIndexedSubFieldId($identifier, $subFieldIndex, $positionIndex)
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...
static get(string $a_glyph, string $a_text="")
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static prepareFormOutput($a_str, bool $a_strip=false)
buildMultiValueSubmitVar($identifier, $positionIndex, $submitCommand)
static getFileSizeInfo()
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setEditElementOccuranceEnabled()

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

Definition at line 140 of file class.ilMultipleImagesInputGUI.php.

References $editElementOccuranceEnabled.

140  : void
141  {
142  $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
143  }

◆ setEditElementOrderEnabled()

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

Definition at line 153 of file class.ilMultipleImagesInputGUI.php.

References $editElementOrderEnabled.

153  : void
154  {
155  $this->editElementOrderEnabled = $editElementOrderEnabled;
156  }

◆ setImageRemovalCommand()

ilMultipleImagesInputGUI::setImageRemovalCommand (   $imageRemovalCommand)
Parameters
string$imageRemovalCommand

Definition at line 114 of file class.ilMultipleImagesInputGUI.php.

References $imageRemovalCommand.

114  : void
115  {
116  $this->imageRemovalCommand = $imageRemovalCommand;
117  }

◆ setImageUploadCommand()

ilMultipleImagesInputGUI::setImageUploadCommand (   $imageUploadCommand)
Parameters
string$imageUploadCommand

Definition at line 127 of file class.ilMultipleImagesInputGUI.php.

References $imageUploadCommand.

127  : void
128  {
129  $this->imageUploadCommand = $imageUploadCommand;
130  }

◆ setSuffixes()

ilMultipleImagesInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

96  : void
97  {
98  $this->suffixes = $a_suffixes;
99  }

◆ valueHasContentImageSource()

ilMultipleImagesInputGUI::valueHasContentImageSource (   $value)
protected
Parameters
array | string$value

Definition at line 376 of file class.ilMultipleImagesInputGUI.php.

References ilTextInputGUI\$value.

Referenced by fetchContentImageSourceFromValue(), and render().

376  : bool
377  {
378  return is_array($value)
379  && array_key_exists('src', $value)
380  && $value['src'] !== '';
381  }
+ Here is the caller graph for this function:

◆ valueHasContentImageTitle()

ilMultipleImagesInputGUI::valueHasContentImageTitle (   $value)
protected
Parameters
array$value

Definition at line 398 of file class.ilMultipleImagesInputGUI.php.

References ilTextInputGUI\$value.

Referenced by fetchContentImageTitleFromValue().

398  : bool
399  {
400  return isset($value['title']) && strlen($value['title']);
401  }
+ Here is the caller graph for this function:

Field Documentation

◆ $dodging_files

stdClass ilMultipleImagesInputGUI::$dodging_files
protected

Definition at line 42 of file class.ilMultipleImagesInputGUI.php.

◆ $editElementOccuranceEnabled

ilMultipleImagesInputGUI::$editElementOccuranceEnabled = false
protected

◆ $editElementOrderEnabled

ilMultipleImagesInputGUI::$editElementOrderEnabled = false
protected

◆ $imageRemovalCommand

ilMultipleImagesInputGUI::$imageRemovalCommand = 'removeImage'
protected

◆ $imageUploadCommand

ilMultipleImagesInputGUI::$imageUploadCommand = 'uploadImage'
protected

◆ $lng

ilLanguage ilMultipleImagesInputGUI::$lng
protected

Definition at line 53 of file class.ilMultipleImagesInputGUI.php.

Referenced by render().

◆ $suffixes

ilMultipleImagesInputGUI::$suffixes = array()
protected

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

Referenced by getSuffixes().

◆ $tpl

ilGlobalTemplateInterface ilMultipleImagesInputGUI::$tpl
protected

Definition at line 54 of file class.ilMultipleImagesInputGUI.php.

◆ FILE_DATA_INDEX_DODGING_FILE

const ilMultipleImagesInputGUI::FILE_DATA_INDEX_DODGING_FILE = 'dodging_file'

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

◆ IMAGE_UPLOAD_SUBFIELD_NAME

const ilMultipleImagesInputGUI::IMAGE_UPLOAD_SUBFIELD_NAME = 'imageupload'

◆ ITERATOR_SUBFIELD_NAME

◆ RENDERING_TEMPLATE

const ilMultipleImagesInputGUI::RENDERING_TEMPLATE = 'tpl.prop_multi_image_inp.html'

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

◆ STORED_IMAGE_SUBFIELD_NAME

const ilMultipleImagesInputGUI::STORED_IMAGE_SUBFIELD_NAME = 'storedimage'

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