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

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 getImageRemovalCommand ()
 
 setImageRemovalCommand ($imageRemovalCommand)
 
 getImageUploadCommand ()
 
 setImageUploadCommand ($imageUploadCommand)
 
 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 (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...
 

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

 isValidFilenameInput ($filenameInput)
 
 valueHasContentImageSource ($value)
 
 fetchContentImageSourceFromValue ($value)
 
 valueHasContentImageTitle ($value)
 
 fetchContentImageTitleFromValue ($value)
 
 getTemplate ()
 
- 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
 
stdClass $dodging_files
 
 $suffixes = []
 
 $imageRemovalCommand = 'removeImage'
 
 $imageUploadCommand = 'uploadImage'
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
GlyphFactory $glyph_factory
 
ButtonFactory $button_factory
 
Renderer $renderer
 
UploadLimitResolver $upload_limit
 
- 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...
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilIdentifiedMultiValuesInputGUI.

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

72 {
73 parent::__construct($a_title, $a_postvar);
74
75 global $DIC;
76 $this->lng = $DIC->language();
77 $this->tpl = $DIC->ui()->mainTemplate();
78 $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
79 $this->button_factory = $DIC->ui()->factory()->button();
80 $this->renderer = $DIC->ui()->renderer();
81 $this->upload_limit = $DIC['ui.upload_limit_resolver'];
82
83 $this->setSuffixes(["jpg", "jpeg", "png", "gif"]);
84 $this->setSize(25);
85 $this->validationRegexp = "";
86
88 $manipulator->setPostVar($this->getPostVar());
89 $this->addFormValuesManipulator($manipulator);
90
91 $this->dodging_files = new stdClass();
92
93 $manipulator = new ilMultipleImagesFileSubmissionDataCompletion($this->dodging_files);
94 $this->addFormValuesManipulator($manipulator);
95
97 $manipulator->setPostVar($this->getPostVar());
98 $this->addFormValuesManipulator($manipulator);
99
101 $manipulator->setPostVar($this->getPostVar());
102 $this->addFormValuesManipulator($manipulator);
103 }
renderer()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addFormValuesManipulator(ilFormValuesManipulator $manipulator)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSuffixes($a_suffixes)
Set Accepted Suffixes.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilIdentifiedMultiValuesInputGUI\addFormValuesManipulator(), ilFormPropertyGUI\getPostVar(), ILIAS\Repository\lng(), renderer(), ilTextInputGUI\setSize(), and setSuffixes().

+ Here is the call graph for this function:

Member Function Documentation

◆ fetchContentImageSourceFromValue()

ilMultipleImagesInputGUI::fetchContentImageSourceFromValue (   $value)
protected
Parameters
$value
Returns
string

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

438 : ?string
439 {
441 return $value['src'];
442 }
443
444 return null;
445 }

References ilTextInputGUI\$value, and valueHasContentImageSource().

Referenced by fetchContentImageTitleFromValue(), and render().

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

◆ fetchContentImageTitleFromValue()

ilMultipleImagesInputGUI::fetchContentImageTitleFromValue (   $value)
protected

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

456 : ?string
457 {
458 if ($this->valueHasContentImageTitle($value)) {
459 return $value['title'];
460 }
461
463 }

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

Referenced by render().

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

◆ getImageRemovalCommand()

ilMultipleImagesInputGUI::getImageRemovalCommand ( )
Returns
string

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

128 : string
129 {
131 }

References $imageRemovalCommand.

Referenced by render().

+ Here is the caller graph for this function:

◆ getImageUploadCommand()

ilMultipleImagesInputGUI::getImageUploadCommand ( )
Returns
string

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

144 : string
145 {
147 }

References $imageUploadCommand.

Referenced by render().

+ Here is the caller graph for this function:

◆ getSuffixes()

ilMultipleImagesInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

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

120 : array
121 {
122 return $this->suffixes;
123 }

References $suffixes.

Referenced by onCheckInput(), and render().

+ Here is the caller graph for this function:

◆ getTemplate()

ilMultipleImagesInputGUI::getTemplate ( )
protected
Returns
ilTemplate

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

468 : ilTemplate
469 {
470 return new ilTemplate(self::RENDERING_TEMPLATE, true, true, "components/ILIAS/TestQuestionPool");
471 }
special template class to simplify handling of ITX/PEAR

Referenced by render().

+ Here is the caller graph for this function:

◆ isEditElementOccuranceEnabled()

ilMultipleImagesInputGUI::isEditElementOccuranceEnabled ( )
Returns
boolean $editElementOccuranceEnabled

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

References $editElementOccuranceEnabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ isEditElementOrderEnabled()

ilMultipleImagesInputGUI::isEditElementOrderEnabled ( )
Returns
boolean

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

References $editElementOrderEnabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ isValidFilenameInput()

ilMultipleImagesInputGUI::isValidFilenameInput (   $filenameInput)
abstractprotected
Parameters
mixed$value
Returns
bool

Reimplemented in ilAssOrderingImagesInputGUI.

◆ onCheckInput()

ilMultipleImagesInputGUI::onCheckInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean $validationSuccess

Reimplemented from ilIdentifiedMultiValuesInputGUI.

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

200 : bool
201 {
202 $F = $_FILES[$this->getPostVar()];
203
204 $submittedElements = $this->getInput();
205
206 if ($F && ((array) $this->dodging_files) !== []) {
207 $F = array_merge([self::FILE_DATA_INDEX_DODGING_FILE => (array) $this->dodging_files], $F);
208 }
209
210 if ($this->getRequired() && !is_array($F['error'])) {
211 $this->setAlert($this->lng->txt("form_msg_file_no_upload"));
212 return false;
213 } else {
214 foreach ($F['error'] as $index => $error) {
215 // error handling
216 if ($error > 0) {
217 switch ($error) {
218 case UPLOAD_ERR_FORM_SIZE:
219 case UPLOAD_ERR_INI_SIZE:
220 $this->setAlert($this->lng->txt("form_msg_file_size_exceeds"));
221 return false;
222 break;
223
224 case UPLOAD_ERR_PARTIAL:
225 $this->setAlert($this->lng->txt("form_msg_file_partially_uploaded"));
226 return false;
227 break;
228
229 case UPLOAD_ERR_NO_FILE:
230 if (!$this->getRequired()) {
231 break;
232 } elseif (isset($F[self::FILE_DATA_INDEX_DODGING_FILE][$index]) && $F[self::FILE_DATA_INDEX_DODGING_FILE][$index] !== '') {
233 break;
234 }
235 $this->setAlert($this->lng->txt("form_msg_file_no_upload"));
236 return false;
237 break;
238
239 case UPLOAD_ERR_NO_TMP_DIR:
240 $this->setAlert($this->lng->txt("form_msg_file_missing_tmp_dir"));
241 return false;
242 break;
243
244 case UPLOAD_ERR_CANT_WRITE:
245 $this->setAlert($this->lng->txt("form_msg_file_cannot_write_to_disk"));
246 return false;
247 break;
248
249 case UPLOAD_ERR_EXTENSION:
250 $this->setAlert($this->lng->txt("form_msg_file_upload_stopped_ext"));
251 return false;
252 break;
253 }
254 }
255 }
256 }
257
258 if (is_array($F['tmp_name'])) {
259 foreach ($F['tmp_name'] as $index => $tmpname) {
260 $filename = $F['name'][$index];
261 if (is_array($filename)) {
262 $filename = array_shift($filename);
263 $tmpname = array_shift($tmpname);
264 }
265 $filename_arr = pathinfo($filename);
266 $suffix = $filename_arr["extension"] ?? '';
267 $mimetype = $F['type'][$index];
268 $size_bytes = $F['size'][$index];
269 // check suffixes
270 if (strlen($tmpname) && is_array($this->getSuffixes())) {
271 if (!in_array(strtolower($suffix), $this->getSuffixes())) {
272 $this->setAlert($this->lng->txt("form_msg_file_wrong_file_type"));
273 return false;
274 }
275 }
276 }
277 }
278
279 foreach ($F['tmp_name'] as $index => $tmpname) {
280 $filename = $F['name'][$index];
281 if (is_array($filename)) {
282 $filename = array_shift($filename);
283 $tmpname = array_shift($tmpname);
284 }
285 $filename_arr = pathinfo($filename);
286 $suffix = $filename_arr["extension"] ?? '';
287 $mimetype = $F['type'][$index];
288 $size_bytes = $F['size'][$index];
289 // virus handling
290 if (strlen($tmpname)) {
292 if ($vir[0] == false) {
293 $this->setAlert($this->lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
294 return false;
295 }
296 }
297 }
298
299 return $this->checkSubItemsInput();
300 }
$filename
Definition: buildRTE.php:78
static virusHandling(string $a_file, string $a_orig_name='', bool $a_clean=true)

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

+ Here is the call graph for this function:

◆ render()

ilMultipleImagesInputGUI::render ( string  $a_mode = "")
Parameters
string$mode
Returns
string

Reimplemented from ilTextInputGUI.

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

306 : string
307 {
309
310 $tpl = $this->getTemplate();
311 $i = 0;
312
314 foreach ($identified_multi_values as $identifier => $value) {
316 $tpl->setCurrentBlock('image');
317
318 $tpl->setVariable('STORED_IMAGE_SRC', $this->fetchContentImageSourceFromValue($value));
320 'STORED_IMAGE_ALT',
322 );
323 $tpl->setVariable('STORED_IMAGE_FILENAME', $this->fetchContentImageTitleFromValue($value));
324 $tpl->setVariable('STORED_IMAGE_POST_VAR', $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::STORED_IMAGE_SUBFIELD_NAME, $i));
325
326 $tpl->setVariable('TXT_DELETE_EXISTING', $lng->txt('delete_existing_file'));
327 $tpl->setVariable('IMAGE_CMD_REMOVE', $this->buildMultiValueSubmitVar($identifier, $i, $this->getImageRemovalCommand()));
328
330 }
331
332 $tpl->setCurrentBlock('addimage');
333
334 $tpl->setVariable('IMAGE_BROWSE', $lng->txt('select_file'));
335 $tpl->setVariable('IMAGE_ID', $this->getMultiValuePosIndexedSubFieldId($identifier, self::IMAGE_UPLOAD_SUBFIELD_NAME, $i));
336 $tpl->setVariable('MAX_SIZE_WARNING', $this->lng->txt('form_msg_file_size_exceeds'));
337 $tpl->setVariable('MAX_SIZE', $this->upload_limit->getPhpUploadLimitInBytes());
338 $tpl->setVariable('TXT_IMAGE_SUBMIT', $lng->txt('upload'));
339 $tpl->setVariable('IMAGE_CMD_UPLOAD', $this->buildMultiValueSubmitVar($identifier, $i, $this->getImageUploadCommand()));
340 $tpl->setVariable('UPLOAD_IMAGE_POST_VAR', $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::IMAGE_UPLOAD_SUBFIELD_NAME, $i));
341 $tpl->setVariable('COUNT_POST_VAR', $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::ITERATOR_SUBFIELD_NAME, $i));
342
344
345 if ($this->isEditElementOrderEnabled()) {
346 $tpl->setCurrentBlock('move');
347 $tpl->setVariable('UP_BUTTON', $this->renderer->render(
348 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->up())
349 ));
350 $tpl->setVariable('DOWN_BUTTON', $this->renderer->render(
351 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->down())
352 ));
354 }
355
356 if ($this->isEditElementOccuranceEnabled()) {
357 $tpl->setCurrentBlock('row');
358 $tpl->setVariable('ID_ADD', $this->getMultiValuePosIndexedSubFieldId($identifier, 'add', $i));
359 $tpl->setVariable('ID_REMOVE', $this->getMultiValuePosIndexedSubFieldId($identifier, 'remove', $i));
360 $tpl->setVariable('ADD_BUTTON', $this->renderer->render(
361 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->add())
362 ));
363 $tpl->setVariable('REMOVE_BUTTON', $this->renderer->render(
364 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->remove())
365 ));
367 }
368
369 $i++;
370 }
371
372 if (is_array($this->getSuffixes())) {
373 $suff_str = $delim = '';
374 foreach ($this->getSuffixes() as $suffix) {
375 $suff_str .= $delim . '.' . $suffix;
376 $delim = ', ';
377 }
378 $tpl->setCurrentBlock('allowed_image_suffixes');
379 $tpl->setVariable('TXT_ALLOWED_SUFFIXES', $lng->txt('file_allowed_suffixes') . ' ' . $suff_str);
381 }
382
384 $tpl->setVariable('ELEMENT_ID', $this->getPostVar());
385 $tpl->setVariable('TEXT_YES', $lng->txt('yes'));
386 $tpl->setVariable('TEXT_NO', $lng->txt('no'));
387 $tpl->setVariable('DELETE_IMAGE_HEADER', $lng->txt('delete_image_header'));
388 $tpl->setVariable('DELETE_IMAGE_QUESTION', $lng->txt('delete_image_question'));
389 $tpl->setVariable('ANSWER_TEXT', $lng->txt('answer_text'));
390 $tpl->setVariable('COMMANDS_TEXT', $lng->txt('actions'));
391
392 if (!$this->getDisabled()) {
393 $iterator_subfield_name = self::ITERATOR_SUBFIELD_NAME;
394 $image_upload_subfield_name = self::IMAGE_UPLOAD_SUBFIELD_NAME;
395
396 $init_code = <<<JS
397$.extend({}, AnswerWizardInput, IdentifiedWizardInput).init(
398 {
399 'fieldContainerSelector': '.ilWzdContainerImage',
400 'reindexingRequiredElementsSelectors': [
401 'input:hidden[name*="[{$iterator_subfield_name}]"]',
402 'input:file[id*="__{$image_upload_subfield_name}__"]',
403 'input:submit[name*="[{$this->getImageUploadCommand()}]"]',
404 'input:submit[name*="[{$this->getImageRemovalCommand()}]"]',
405 'button'
406 ],
407 'handleRowCleanUpCallback': function(rowElem) {
408 $(rowElem).find('div.imagepresentation').remove();
409 $(rowElem).find('input[type=text]').val('');
410 }
411 }
412);
413JS;
414
415 $this->tpl->addJavascript("assets/js/answerwizardinput.js");
416 $this->tpl->addJavascript("assets/js/identifiedwizardinput.js");
417 $this->tpl->addOnLoadCode($init_code);
418 }
419
420 return $tpl->get();
421 }
static getFileSizeInfo()
getMultiValuePostVarSubFieldPosIndexed($identifier, $sub_field_index, $position_index)
getMultiValuePosIndexedSubFieldId($identifier, $sub_field_index, $position_index)
buildMultiValueSubmitVar($identifier, $position_index, $submit_cmd)
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 prepareFormOutput($a_str, bool $a_strip=false)
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 ilIdentifiedMultiValuesInputGUI\$identified_multi_values, $lng, ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, ilIdentifiedMultiValuesInputGUI\buildMultiValueSubmitVar(), fetchContentImageSourceFromValue(), fetchContentImageTitleFromValue(), ILIAS\UICore\GlobalTemplate\get(), ilFormPropertyGUI\getDisabled(), ilFileUtils\getFileSizeInfo(), ilIdentifiedMultiValuesInputGUI\getIdentifiedMultiValues(), getImageRemovalCommand(), getImageUploadCommand(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedSubFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePostVarSubFieldPosIndexed(), ilFormPropertyGUI\getPostVar(), getSuffixes(), getTemplate(), IMAGE_UPLOAD_SUBFIELD_NAME, init(), isEditElementOccuranceEnabled(), isEditElementOrderEnabled(), ITERATOR_SUBFIELD_NAME, ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilIdentifiedMultiValuesInputGUI\prepareMultiValuesInput(), renderer(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setVariable(), ilLanguage\txt(), and valueHasContentImageSource().

+ Here is the call graph for this function:

◆ setEditElementOccuranceEnabled()

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

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

168 : void
169 {
170 $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
171 }

References $editElementOccuranceEnabled.

◆ setEditElementOrderEnabled()

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

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

184 : void
185 {
186 $this->editElementOrderEnabled = $editElementOrderEnabled;
187 }

References $editElementOrderEnabled.

◆ setImageRemovalCommand()

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

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

136 : void
137 {
138 $this->imageRemovalCommand = $imageRemovalCommand;
139 }

References $imageRemovalCommand.

◆ setImageUploadCommand()

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

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

152 : void
153 {
154 $this->imageUploadCommand = $imageUploadCommand;
155 }

References $imageUploadCommand.

◆ setSuffixes()

ilMultipleImagesInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

110 : void
111 {
112 $this->suffixes = $a_suffixes;
113 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ valueHasContentImageSource()

ilMultipleImagesInputGUI::valueHasContentImageSource (   $value)
protected
Parameters
$value
Returns
bool

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

427 : bool
428 {
429 return is_array($value)
430 && array_key_exists('src', $value)
431 && $value['src'] !== '';
432 }

References ilTextInputGUI\$value.

Referenced by fetchContentImageSourceFromValue(), and render().

+ Here is the caller graph for this function:

◆ valueHasContentImageTitle()

ilMultipleImagesInputGUI::valueHasContentImageTitle (   $value)
protected
Parameters
$value
Returns
bool

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

451 : bool
452 {
453 return isset($value['title']) && strlen($value['title']);
454 }

References ilTextInputGUI\$value.

Referenced by fetchContentImageTitleFromValue().

+ Here is the caller graph for this function:

Field Documentation

◆ $button_factory

ButtonFactory ilMultipleImagesInputGUI::$button_factory
protected

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

◆ $dodging_files

stdClass ilMultipleImagesInputGUI::$dodging_files
protected

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

◆ $editElementOccuranceEnabled

ilMultipleImagesInputGUI::$editElementOccuranceEnabled = false
protected

◆ $editElementOrderEnabled

ilMultipleImagesInputGUI::$editElementOrderEnabled = false
protected

◆ $glyph_factory

GlyphFactory ilMultipleImagesInputGUI::$glyph_factory
protected

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

◆ $imageRemovalCommand

ilMultipleImagesInputGUI::$imageRemovalCommand = 'removeImage'
protected

◆ $imageUploadCommand

ilMultipleImagesInputGUI::$imageUploadCommand = 'uploadImage'
protected

◆ $lng

ilLanguage ilMultipleImagesInputGUI::$lng
protected

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

Referenced by render().

◆ $renderer

Renderer ilMultipleImagesInputGUI::$renderer
protected

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

◆ $suffixes

ilMultipleImagesInputGUI::$suffixes = []
protected

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

Referenced by getSuffixes().

◆ $tpl

ilGlobalTemplateInterface ilMultipleImagesInputGUI::$tpl
protected

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

Referenced by render().

◆ $upload_limit

UploadLimitResolver ilMultipleImagesInputGUI::$upload_limit
protected

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

◆ FILE_DATA_INDEX_DODGING_FILE

const ilMultipleImagesInputGUI::FILE_DATA_INDEX_DODGING_FILE = 'dodging_file'

Definition at line 35 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 29 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: