ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ($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 ($a_values)
 
 checkInput ()
 
 onCheckInput ()
 
 prepareReprintable (assQuestion $question)
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setDataSourceSubmitOnSelection ($a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl ($a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. 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, $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 ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Protected Attributes

 $editElementOccuranceEnabled = false
 
 $editElementOrderEnabled = false
 
 $suffixes = array()
 
 $imageRemovalCommand = 'removeImage'
 
 $imageUploadCommand = 'uploadImage'
 
- 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
 
 $maxlength = 200
 
 $size = 40
 
 $validationRegexp
 
 $validationFailureMessage = ''
 
 $suffix
 
 $style_css
 
 $css_class
 
 $ajax_datasource
 
 $ajax_datasource_delimiter
 
 $ajax_datasource_commit = false
 
 $ajax_datasource_commit_url
 
 $submit_form_on_enter = false
 
 $autocomplete_disabled = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References $DIC, ilIdentifiedMultiValuesInputGUI\addFormValuesManipulator(), array, ilFormPropertyGUI\getPostVar(), ilTextInputGUI\setSize(), and setSuffixes().

48  {
49  global $DIC;
50 
51  $this->lng = $DIC->language();
52  parent::__construct($a_title, $a_postvar);
53 
54  $this->setSuffixes(array("jpg", "jpeg", "png", "gif"));
55  $this->setSize('25');
56  $this->validationRegexp = "";
57 
58  require_once 'Services/Form/classes/class.ilMultipleImagesAdditionalIndexLevelRemover.php';
60  $manipulator->setPostVar($this->getPostVar());
61  $this->addFormValuesManipulator($manipulator);
62 
63  require_once 'Services/Form/classes/class.ilMultipleImagesFileSubmissionDataCompletion.php';
65  $manipulator->setPostVar($this->getPostVar());
66  $this->addFormValuesManipulator($manipulator);
67 
68  require_once 'Services/Form/classes/class.ilIdentifiedMultiFilesJsPositionIndexRemover.php';
70  $manipulator->setPostVar($this->getPostVar());
71  $this->addFormValuesManipulator($manipulator);
72 
73  require_once 'Services/Form/classes/class.ilMultiFilesSubmitRecursiveSlashesStripper.php';
74  $manipulator = new ilMultiFilesSubmitRecursiveSlashesStripper();
75  $manipulator->setPostVar($this->getPostVar());
76  $this->addFormValuesManipulator($manipulator);
77  }
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setSize($a_size)
Set Size.
Create styles array
The data for the language used.
addFormValuesManipulator(ilFormValuesManipulator $manipulator)
+ Here is the call graph for this function:

Member Function Documentation

◆ fetchContentImageSourceFromValue()

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

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

References ilTextInputGUI\$value, and valueHasContentImageSource().

Referenced by fetchContentImageTitleFromValue(), and render().

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

◆ fetchContentImageTitleFromValue()

ilMultipleImagesInputGUI::fetchContentImageTitleFromValue (   $value)
protected
Parameters
string$value

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

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

Referenced by render().

409  {
410  if ($this->valueHasContentImageTitle($value)) {
411  return $value['title'];
412  }
413 
415  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageRemovalCommand()

ilMultipleImagesInputGUI::getImageRemovalCommand ( )
Returns
string

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

References $imageRemovalCommand.

Referenced by render().

+ Here is the caller graph for this function:

◆ getImageUploadCommand()

ilMultipleImagesInputGUI::getImageUploadCommand ( )
Returns
string

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

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

References $suffixes.

Referenced by onCheckInput(), and render().

+ Here is the caller graph for this function:

◆ getTemplate()

ilMultipleImagesInputGUI::getTemplate ( )
protected
Returns
ilTemplate

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

Referenced by render().

421  {
422  return new ilTemplate(self::RENDERING_TEMPLATE, true, true, "Services/Form");
423  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ isEditElementOccuranceEnabled()

ilMultipleImagesInputGUI::isEditElementOccuranceEnabled ( )
Returns
boolean $editElementOccuranceEnabled

Definition at line 134 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 150 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

Referenced by setEditElementOrderEnabled().

+ Here is the caller graph for this function:

◆ onCheckInput()

ilMultipleImagesInputGUI::onCheckInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean $validationSuccess

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

References $error, $filename, $GLOBALS, $index, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, array, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSuffixes(), ilFormPropertyGUI\setAlert(), and ilUtil\virusHandling().

175  {
176  $lng = $GLOBALS['DIC'] ? $GLOBALS['DIC']['lng'] : $GLOBALS['lng'];
177  $F = $_FILES[$this->getPostVar()];
178  if ($F && isset($_REQUEST[$this->getPostVar()][self::FILE_DATA_INDEX_DODGING_FILE])) {
179  $F = array_merge(array(self::FILE_DATA_INDEX_DODGING_FILE => $_REQUEST[$this->getPostVar()][self::FILE_DATA_INDEX_DODGING_FILE]), $F);
180  }
181 
182  if ($this->getRequired() && !is_array($F['error'])) {
183  $this->setAlert($lng->txt("form_msg_file_no_upload"));
184  return false;
185  } else {
186  foreach ($F['error'] as $index => $error) {
187  // error handling
188  if ($error > 0) {
189  switch ($error) {
190  case UPLOAD_ERR_INI_SIZE:
191  $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
192  return false;
193  break;
194 
195  case UPLOAD_ERR_FORM_SIZE:
196  $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
197  return false;
198  break;
199 
200  case UPLOAD_ERR_PARTIAL:
201  $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
202  return false;
203  break;
204 
205  case UPLOAD_ERR_NO_FILE:
206  if (!$this->getRequired()) {
207  break;
208  } elseif (strlen($F[self::FILE_DATA_INDEX_DODGING_FILE][$index])) {
209  break;
210  }
211  $this->setAlert($lng->txt("form_msg_file_no_upload"));
212  return false;
213  break;
214 
215  case UPLOAD_ERR_NO_TMP_DIR:
216  $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
217  return false;
218  break;
219 
220  case UPLOAD_ERR_CANT_WRITE:
221  $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
222  return false;
223  break;
224 
225  case UPLOAD_ERR_EXTENSION:
226  $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
227  return false;
228  break;
229  }
230  }
231  }
232  }
233 
234  if (is_array($F['tmp_name'])) {
235  foreach ($F['tmp_name'] as $index => $tmpname) {
236  $filename = $F['name'][$index];
237  $filename_arr = pathinfo($filename);
238  $suffix = $filename_arr["extension"];
239  $mimetype = $F['type'][$index];
240  $size_bytes = $F['size'][$index];
241  // check suffixes
242  if (strlen($tmpname) && is_array($this->getSuffixes())) {
243  if (!in_array(strtolower($suffix), $this->getSuffixes())) {
244  $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
245  return false;
246  }
247  }
248  }
249  }
250 
251  foreach ($F['tmp_name'] as $index => $tmpname) {
252  $filename = $F['name'][$index];
253  $filename_arr = pathinfo($filename);
254  $suffix = $filename_arr["extension"];
255  $mimetype = $F['type'][$index];
256  $size_bytes = $F['size'][$index];
257  // virus handling
258  if (strlen($tmpname)) {
259  $vir = ilUtil::virusHandling($tmpname, $filename);
260  if ($vir[0] == false) {
261  $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
262  return false;
263  }
264  }
265  }
266 
267  return $this->checkSubItemsInput();
268  }
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
getPostVar()
Get Post Variable.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$index
Definition: metadata.php:60
setAlert($a_alert)
Set Alert Text.
$error
Definition: Error.php:17
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ render()

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

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

References $GLOBALS, $i, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilIdentifiedMultiValuesInputGUI\buildMultiValueSubmitVar(), ilGlyphGUI\DOWN, fetchContentImageSourceFromValue(), fetchContentImageTitleFromValue(), ilGlyphGUI\get(), ilFormPropertyGUI\getDisabled(), ilUtil\getFileSizeInfo(), ilIdentifiedMultiValuesInputGUI\getIdentifiedMultiValues(), getImageRemovalCommand(), getImageUploadCommand(), ilIdentifiedMultiValuesInputGUI\getMultiValuePosIndexedSubFieldId(), ilIdentifiedMultiValuesInputGUI\getMultiValuePostVarSubFieldPosIndexed(), ilFormPropertyGUI\getPostVar(), getSuffixes(), getTemplate(), isEditElementOccuranceEnabled(), isEditElementOrderEnabled(), ilUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, ilGlyphGUI\UP, and valueHasContentImageSource().

275  {
276  $lng = $this->lng;
277 
278  $tpl = $this->getTemplate();
279  $i = 0;
280  foreach ($this->getIdentifiedMultiValues() as $identifier => $value) {
281  if ($this->valueHasContentImageSource($value)) {
282  $tpl->setCurrentBlock('image');
283 
284  $tpl->setVariable('STORED_IMAGE_SRC', $this->fetchContentImageSourceFromValue($value));
285  $tpl->setVariable('STORED_IMAGE_ALT', ilUtil::prepareFormOutput($this->fetchContentImageTitleFromValue($value)));
286  $tpl->setVariable('STORED_IMAGE_FILENAME', $this->fetchContentImageTitleFromValue($value));
287  $tpl->setVariable("STORED_IMAGE_POST_VAR", $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::STORED_IMAGE_SUBFIELD_NAME, $i));
288 
289  $tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
290  $tpl->setVariable("IMAGE_CMD_REMOVE", $this->buildMultiValueSubmitVar($identifier, $i, $this->getImageRemovalCommand()));
291 
292  $tpl->parseCurrentBlock();
293  }
294 
295  $tpl->setCurrentBlock('addimage');
296 
297  $tpl->setVariable("IMAGE_BROWSE", $lng->txt('select_file'));
298  $tpl->setVariable("IMAGE_ID", $this->getMultiValuePosIndexedSubFieldId($identifier, self::IMAGE_UPLOAD_SUBFIELD_NAME, $i));
299  $tpl->setVariable("TXT_IMAGE_SUBMIT", $lng->txt("upload"));
300  $tpl->setVariable("IMAGE_CMD_UPLOAD", $this->buildMultiValueSubmitVar($identifier, $i, $this->getImageUploadCommand()));
301  $tpl->setVariable("UPLOAD_IMAGE_POST_VAR", $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::IMAGE_UPLOAD_SUBFIELD_NAME, $i));
302  $tpl->setVariable("COUNT_POST_VAR", $this->getMultiValuePostVarSubFieldPosIndexed($identifier, self::ITERATOR_SUBFIELD_NAME, $i));
303 
304  $tpl->parseCurrentBlock();
305 
306  if ($this->isEditElementOrderEnabled()) {
307  $tpl->setCurrentBlock("move");
308  $tpl->setVariable("ID_UP", $this->getMultiValuePosIndexedSubFieldId($identifier, 'up', $i));
309  $tpl->setVariable("ID_DOWN", $this->getMultiValuePosIndexedSubFieldId($identifier, 'down', $i));
310  $tpl->setVariable("CMD_UP", $this->buildMultiValueSubmitVar($identifier, $i, 'up'));
311  $tpl->setVariable("CMD_DOWN", $this->buildMultiValueSubmitVar($identifier, $i, 'down'));
312  $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
313  $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
314  $tpl->parseCurrentBlock();
315  }
316 
317  if ($this->isEditElementOccuranceEnabled()) {
318  $tpl->setCurrentBlock("row");
319  $tpl->setVariable("ID_ADD", $this->getMultiValuePosIndexedSubFieldId($identifier, 'add', $i));
320  $tpl->setVariable("ID_REMOVE", $this->getMultiValuePosIndexedSubFieldId($identifier, 'remove', $i));
321  $tpl->setVariable("CMD_ADD", $this->buildMultiValueSubmitVar($identifier, $i, 'add'));
322  $tpl->setVariable("CMD_REMOVE", $this->buildMultiValueSubmitVar($identifier, $i, 'remove'));
323  $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
324  $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
325  $tpl->parseCurrentBlock();
326  }
327 
328  $i++;
329  }
330 
331  if (is_array($this->getSuffixes())) {
332  $suff_str = $delim = "";
333  foreach ($this->getSuffixes() as $suffix) {
334  $suff_str.= $delim . "." . $suffix;
335  $delim = ", ";
336  }
337  $tpl->setCurrentBlock('allowed_image_suffixes');
338  $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str);
339  $tpl->parseCurrentBlock();
340  }
341  /*
342  $tpl->setCurrentBlock("image_heading");
343  $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
344  $tpl->parseCurrentBlock();
345  */
346 
347  $tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
348  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
349  $tpl->setVariable("TEXT_YES", $lng->txt('yes'));
350  $tpl->setVariable("TEXT_NO", $lng->txt('no'));
351  $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
352  $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
353  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
354  $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
355 
356  if (!$this->getDisabled()) {
357  $tpl->setCurrentBlock('js_engine_initialisation');
358  $tpl->setVariable('UPLOAD_CMD', $this->getImageUploadCommand());
359  $tpl->setVariable('REMOVE_CMD', $this->getImageRemovalCommand());
360  $tpl->setVariable('ITERATOR', self::ITERATOR_SUBFIELD_NAME);
361  $tpl->setVariable('STORED_IMAGE_POSTVAR', self::STORED_IMAGE_SUBFIELD_NAME);
362  $tpl->setVariable('UPLOAD_IMAGE_POSTVAR', self::IMAGE_UPLOAD_SUBFIELD_NAME);
363  $tpl->parseCurrentBlock();
364 
365  $globalTpl = $GLOBALS['DIC'] ? $GLOBALS['DIC']['tpl'] : $GLOBALS['tpl'];
366  $globalTpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
367  $globalTpl->addJavascript("./Services/Form/js/ServiceFormIdentifiedWizardInputExtend.js");
368  //$globalTpl->addJavascript("./Services/Form/js/ServiceFormIdentifiedImageWizardInputConcrete.js");
369  }
370 
371  return $tpl->get();
372  }
getMultiValuePostVarSubFieldPosIndexed($identifier, $subFieldIndex, $positionIndex)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMultiValuePosIndexedSubFieldId($identifier, $subFieldIndex, $positionIndex)
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static get($a_glyph, $a_text="")
Get glyph html.
static getFileSizeInfo()
buildMultiValueSubmitVar($identifier, $positionIndex, $submitCommand)
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ setEditElementOccuranceEnabled()

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

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

References $editElementOccuranceEnabled.

143  {
144  $this->editElementOccuranceEnabled = $editElementOccuranceEnabled;
145  }

◆ setEditElementOrderEnabled()

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

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

References $editElementOrderEnabled, and isValidFilenameInput().

159  {
160  $this->editElementOrderEnabled = $editElementOrderEnabled;
161  }
+ Here is the call graph for this function:

◆ setImageRemovalCommand()

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

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

References $imageRemovalCommand.

111  {
112  $this->imageRemovalCommand = $imageRemovalCommand;
113  }

◆ setImageUploadCommand()

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

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

References $imageUploadCommand.

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

◆ setSuffixes()

ilMultipleImagesInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

Referenced by __construct().

85  {
86  $this->suffixes = $a_suffixes;
87  }
+ Here is the caller graph for this function:

◆ valueHasContentImageSource()

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

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

References ilTextInputGUI\$value.

Referenced by fetchContentImageSourceFromValue(), and render().

379  {
380  return isset($value['src']) && strlen($value['src']);
381  }
+ Here is the caller graph for this function:

◆ valueHasContentImageTitle()

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

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

References ilTextInputGUI\$value.

Referenced by fetchContentImageTitleFromValue().

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

Field Documentation

◆ $editElementOccuranceEnabled

ilMultipleImagesInputGUI::$editElementOccuranceEnabled = false
protected

◆ $editElementOrderEnabled

ilMultipleImagesInputGUI::$editElementOrderEnabled = false
protected

◆ $imageRemovalCommand

ilMultipleImagesInputGUI::$imageRemovalCommand = 'removeImage'
protected

◆ $imageUploadCommand

ilMultipleImagesInputGUI::$imageUploadCommand = 'uploadImage'
protected

◆ $suffixes

ilMultipleImagesInputGUI::$suffixes = array()
protected

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

Referenced by getSuffixes().

◆ FILE_DATA_INDEX_DODGING_FILE

const ilMultipleImagesInputGUI::FILE_DATA_INDEX_DODGING_FILE = 'dodging_file'

Definition at line 21 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 15 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: