ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 
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 26 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 69 of file class.ilMultipleImagesInputGUI.php.

70 {
71 parent::__construct($a_title, $a_postvar);
72
73 global $DIC;
74 $this->lng = $DIC->language();
75 $this->tpl = $DIC->ui()->mainTemplate();
76 $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
77 $this->renderer = $DIC->ui()->renderer();
78 $this->upload_limit = $DIC['ui.upload_limit_resolver'];
79
80 $this->setSuffixes(["jpg", "jpeg", "png", "gif"]);
81 $this->setSize(25);
82 $this->validationRegexp = "";
83
85 $manipulator->setPostVar($this->getPostVar());
86 $this->addFormValuesManipulator($manipulator);
87
88 $this->dodging_files = new stdClass();
89
90 $manipulator = new ilMultipleImagesFileSubmissionDataCompletion($this->dodging_files);
91 $this->addFormValuesManipulator($manipulator);
92
94 $manipulator->setPostVar($this->getPostVar());
95 $this->addFormValuesManipulator($manipulator);
96
98 $manipulator->setPostVar($this->getPostVar());
99 $this->addFormValuesManipulator($manipulator);
100 }
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 435 of file class.ilMultipleImagesInputGUI.php.

435 : ?string
436 {
438 return $value['src'];
439 }
440
441 return null;
442 }

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 453 of file class.ilMultipleImagesInputGUI.php.

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

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 125 of file class.ilMultipleImagesInputGUI.php.

125 : string
126 {
128 }

References $imageRemovalCommand.

Referenced by render().

+ Here is the caller graph for this function:

◆ getImageUploadCommand()

ilMultipleImagesInputGUI::getImageUploadCommand ( )
Returns
string

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

141 : string
142 {
144 }

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 117 of file class.ilMultipleImagesInputGUI.php.

117 : array
118 {
119 return $this->suffixes;
120 }

References $suffixes.

Referenced by onCheckInput(), and render().

+ Here is the caller graph for this function:

◆ getTemplate()

ilMultipleImagesInputGUI::getTemplate ( )
protected
Returns
ilTemplate

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

465 : ilTemplate
466 {
467 return new ilTemplate(self::RENDERING_TEMPLATE, true, true, "components/ILIAS/TestQuestionPool");
468 }
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 157 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 173 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 197 of file class.ilMultipleImagesInputGUI.php.

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

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

165 : void
166 {
167 $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
168 }

References $editElementOccuranceEnabled.

◆ setEditElementOrderEnabled()

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

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

181 : void
182 {
183 $this->editElementOrderEnabled = $editElementOrderEnabled;
184 }

References $editElementOrderEnabled.

◆ setImageRemovalCommand()

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

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

133 : void
134 {
135 $this->imageRemovalCommand = $imageRemovalCommand;
136 }

References $imageRemovalCommand.

◆ setImageUploadCommand()

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

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

149 : void
150 {
151 $this->imageUploadCommand = $imageUploadCommand;
152 }

References $imageUploadCommand.

◆ setSuffixes()

ilMultipleImagesInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

107 : void
108 {
109 $this->suffixes = $a_suffixes;
110 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ valueHasContentImageSource()

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

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

424 : bool
425 {
426 return is_array($value)
427 && array_key_exists('src', $value)
428 && $value['src'] !== '';
429 }

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 448 of file class.ilMultipleImagesInputGUI.php.

448 : bool
449 {
450 return isset($value['title']) && strlen($value['title']);
451 }

References ilTextInputGUI\$value.

Referenced by fetchContentImageTitleFromValue().

+ Here is the caller graph for this function:

Field Documentation

◆ $dodging_files

stdClass ilMultipleImagesInputGUI::$dodging_files
protected

Definition at line 46 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 59 of file class.ilMultipleImagesInputGUI.php.

◆ $imageRemovalCommand

ilMultipleImagesInputGUI::$imageRemovalCommand = 'removeImage'
protected

◆ $imageUploadCommand

ilMultipleImagesInputGUI::$imageUploadCommand = 'uploadImage'
protected

◆ $lng

ilLanguage ilMultipleImagesInputGUI::$lng
protected

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

Referenced by render().

◆ $renderer

Renderer ilMultipleImagesInputGUI::$renderer
protected

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

◆ $suffixes

ilMultipleImagesInputGUI::$suffixes = []
protected

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

Referenced by getSuffixes().

◆ $tpl

ilGlobalTemplateInterface ilMultipleImagesInputGUI::$tpl
protected

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

Referenced by render().

◆ $upload_limit

UploadLimitResolver ilMultipleImagesInputGUI::$upload_limit
protected

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

◆ FILE_DATA_INDEX_DODGING_FILE

const ilMultipleImagesInputGUI::FILE_DATA_INDEX_DODGING_FILE = 'dodging_file'

Definition at line 34 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 28 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: