ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilImageFileInputGUI Class Reference

This class represents an image file property in a property form. More...

+ Inheritance diagram for ilImageFileInputGUI:
+ Collaboration diagram for ilImageFileInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setAllowDeletion (bool $a_val)
 
 getALlowDeletion ()
 
 setAllowCapture (bool $a_val)
 
 getAllowCapture ()
 
 setUseCache (bool $a_cache)
 Set cache. More...
 
 getUseCache ()
 
 setImage (string $a_image)
 
 getImage ()
 
 setAlt (string $a_alt)
 
 getAlt ()
 
 insert (ilTemplate $a_tpl)
 
 getDeletionFlag ()
 
- Public Member Functions inherited from ilFileInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setValueByArray (array $a_values)
 
 setValue (string $a_value)
 Set Value. More...
 
 getValue ()
 
 setSize (int $a_size)
 
 getSize ()
 
 setFilename (string $a_val)
 
 getFilename ()
 
 setSuffixes (array $a_suffixes)
 
 getSuffixes ()
 
 setForbiddenSuffixes (array $a_suffixes)
 
 getForbiddenSuffixes ()
 
 setPending (string $a_val)
 
 getPending ()
 
 enableFileNameSelection (string $a_post_var)
 
 isFileNameSelectionEnabled ()
 
 getFileNamePostVar ()
 
 setAllowDeletion (bool $a_val)
 
 getALlowDeletion ()
 
 checkInput ()
 
 getInput ()
 
 render (string $a_mode="")
 
 insert (ilTemplate $a_tpl)
 
 getDeletionFlag ()
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
- 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...
 

Protected Attributes

ilGlobalTemplateInterface $tpl
 
bool $cache = false
 
string $alt = ""
 
string $image = ""
 
bool $allow_capture = false
 
- Protected Attributes inherited from ilFileInputGUI
int $size = 40
 
string $pending = ""
 
bool $allow_deletion = false
 
bool $filename_selection = false
 
array $forbidden_suffixes = []
 
array $suffixes = []
 
string $value = ""
 
FileUpload $upload_service
 
UploadLimitResolver $upload_limit
 
- 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...
 
- Protected Member Functions inherited from ilFileInputGUI
 outputSuffixes (ilTemplate $a_tpl, string $a_block="allowed_suffixes")
 
 getMaxFileSizeString ()
 
 getMaxFileUploads ()
 Get number of maximum file uploads as declared in php.ini. More...
 
- 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)
 

Detailed Description

This class represents an image file property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilImageFileInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilImageFileInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

Definition at line 34 of file class.ilImageFileInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), setAllowDeletion(), ilFormPropertyGUI\setHiddenTitle(), ilFileInputGUI\setSuffixes(), ilFormPropertyGUI\setType(), and ilLanguage\txt().

37  {
38  global $DIC;
39 
40  $this->lng = $DIC->language();
41  $lng = $DIC->language();
42 
43  parent::__construct($a_title, $a_postvar);
44  $this->setType("image_file");
45  $this->setAllowDeletion(true);
46  $this->setSuffixes(array("jpg", "jpeg", "png", "gif"));
47  $this->setHiddenTitle("(" . $lng->txt("form_image_file_input") . ")");
48  $this->cache = true;
49  $this->tpl = $DIC->ui()->mainTemplate();
50  }
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...
setSuffixes(array $a_suffixes)
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getAllowCapture()

ilImageFileInputGUI::getAllowCapture ( )

Definition at line 67 of file class.ilImageFileInputGUI.php.

References $allow_capture.

Referenced by insert().

67  : bool
68  {
69  return $this->allow_capture;
70  }
+ Here is the caller graph for this function:

◆ getALlowDeletion()

ilImageFileInputGUI::getALlowDeletion ( )

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

References ilFileInputGUI\$allow_deletion.

Referenced by insert().

57  : bool
58  {
59  return $this->allow_deletion;
60  }
+ Here is the caller graph for this function:

◆ getAlt()

ilImageFileInputGUI::getAlt ( )

Definition at line 103 of file class.ilImageFileInputGUI.php.

References $alt.

Referenced by ilImagemapCorrectionsInputGUI\insert(), insert(), and ilImagemapFileInputGUI\insert().

103  : string
104  {
105  return $this->alt;
106  }
+ Here is the caller graph for this function:

◆ getDeletionFlag()

ilImageFileInputGUI::getDeletionFlag ( )

Definition at line 196 of file class.ilImageFileInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and ilFormPropertyGUI\str().

Referenced by ilLTIConsumeProviderIcon\handleUploadInputSubission().

196  : bool
197  {
198  if ($this->str($this->getPostVar() . "_delete") != "") {
199  return true;
200  }
201  return false;
202  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImage()

ilImageFileInputGUI::getImage ( )

Definition at line 93 of file class.ilImageFileInputGUI.php.

References $image.

Referenced by ilImagemapCorrectionsInputGUI\insert(), insert(), and ilImagemapFileInputGUI\insert().

93  : string
94  {
95  return $this->image;
96  }
+ Here is the caller graph for this function:

◆ getUseCache()

ilImageFileInputGUI::getUseCache ( )

Definition at line 83 of file class.ilImageFileInputGUI.php.

References $cache.

Referenced by insert().

83  : bool
84  {
85  return $this->cache;
86  }
+ Here is the caller graph for this function:

◆ insert()

ilImageFileInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 108 of file class.ilImageFileInputGUI.php.

References ilFormPropertyGUI\$lng, ilFileInputGUI\$pending, $tpl, getAllowCapture(), getALlowDeletion(), getAlt(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getImage(), ilFileInputGUI\getMaxFileSizeString(), ilFileInputGUI\getPending(), ilFormPropertyGUI\getPostVar(), getUseCache(), ilFileInputGUI\getValue(), ILIAS\Repository\lng(), ilFileInputGUI\outputSuffixes(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

108  : void
109  {
110  $lng = $this->lng;
111 
112  $quota_exceeded = $quota_legend = false;
113  $i_tpl = new ilTemplate("tpl.prop_image_file.html", true, true, "components/ILIAS/Form");
114 
115  if ($this->getAllowCapture()) {
116  $i_tpl->setCurrentBlock("capture");
117  $i_tpl->setVariable("POST_VAR_V", $this->getPostVar());
118  $i_tpl->setVariable("TXT_USE_CAMERA", $lng->txt("form_use_camera"));
119  $i_tpl->setVariable("TXT_TAKE_SNAPSHOT", $lng->txt("form_take_snapshot"));
120  $i_tpl->parseCurrentBlock();
121  $main_tpl = $this->tpl;
122  $main_tpl->addJavascript("assets/js/ServiceFormImageFileCapture.js");
123  }
124 
125  if ($this->getImage() != "") {
126  if (!$this->getDisabled() && $this->getALlowDeletion()) {
127  $i_tpl->setCurrentBlock("delete_bl");
128  $i_tpl->setVariable("POST_VAR_D", $this->getPostVar());
129  $i_tpl->setVariable(
130  "TXT_DELETE_EXISTING",
131  $lng->txt("delete_existing_file")
132  );
133  $i_tpl->parseCurrentBlock();
134  }
135 
136  if (strlen($this->getValue())) {
137  $i_tpl->setCurrentBlock("has_value");
138  $i_tpl->setVariable("TEXT_IMAGE_NAME", $this->getValue());
139  $i_tpl->parseCurrentBlock();
140  }
141  $i_tpl->setCurrentBlock("image");
142  if (!$this->getUseCache()) {
143  $pos = strpos($this->getImage(), '?');
144  if ($pos !== false) {
145  $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "&time=" . time());
146  } else {
147  $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "?time=" . time());
148  }
149  } else {
150  $i_tpl->setVariable("SRC_IMAGE", $this->getImage());
151  }
152  $i_tpl->setVariable("POST_VAR_I", $this->getPostVar());
153  $i_tpl->setVariable("ALT_IMAGE", $this->getAlt());
154  $i_tpl->parseCurrentBlock();
155  }
156 
157  $pending = $this->getPending();
158  if ($pending) {
159  $i_tpl->setCurrentBlock("pending");
160  $i_tpl->setVariable("TXT_PENDING", $lng->txt("file_upload_pending") .
161  ": " . htmlentities($pending));
162  $i_tpl->parseCurrentBlock();
163  }
164 
165  $i_tpl->setVariable('MAX_SIZE_WARNING', $this->lng->txt('form_msg_file_size_exceeds'));
166  $i_tpl->setVariable('MAX_SIZE', $this->upload_limit->getPhpUploadLimitInBytes());
167  $i_tpl->setVariable("POST_VAR", $this->getPostVar());
168  $i_tpl->setVariable("ID", $this->getFieldId());
169  $i_tpl->setVariable("LABEL_SELECTED_FILES_INPUT", $this->lng->txt('selected_files'));
170 
171  /* experimental: bootstrap'ed file upload */
172  $i_tpl->setVariable("TXT_BROWSE", $lng->txt("select_file"));
173 
174 
175  if (!$quota_exceeded) {
176  $i_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " .
177  $this->getMaxFileSizeString() . $quota_legend);
178 
179  $this->outputSuffixes($i_tpl, "allowed_image_suffixes");
180  } else {
181  $i_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded);
182  }
183 
184  if ($this->getDisabled() || $quota_exceeded) {
185  $i_tpl->setVariable(
186  "DISABLED",
187  " disabled=\"disabled\""
188  );
189  }
190 
191  $a_tpl->setCurrentBlock("prop_generic");
192  $a_tpl->setVariable("PROP_GENERIC", $i_tpl->get());
193  $a_tpl->parseCurrentBlock();
194  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
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...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
outputSuffixes(ilTemplate $a_tpl, string $a_block="allowed_suffixes")
ilGlobalTemplateInterface $tpl
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setAllowCapture()

ilImageFileInputGUI::setAllowCapture ( bool  $a_val)

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

Referenced by ilUserProfile\getImageInput().

62  : void
63  {
64  $this->allow_capture = $a_val;
65  }
+ Here is the caller graph for this function:

◆ setAllowDeletion()

ilImageFileInputGUI::setAllowDeletion ( bool  $a_val)

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

Referenced by __construct(), ilDidacticTemplateSettingsGUI\createImportForm(), and ilPCInteractiveImageGUI\initForm().

52  : void
53  {
54  $this->allow_deletion = $a_val;
55  }
+ Here is the caller graph for this function:

◆ setAlt()

ilImageFileInputGUI::setAlt ( string  $a_alt)

Definition at line 98 of file class.ilImageFileInputGUI.php.

98  : void
99  {
100  $this->alt = $a_alt;
101  }

◆ setImage()

ilImageFileInputGUI::setImage ( string  $a_image)

Definition at line 88 of file class.ilImageFileInputGUI.php.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), and ilObjUserGUI\initForm().

88  : void
89  {
90  $this->image = $a_image;
91  }
+ Here is the caller graph for this function:

◆ setUseCache()

ilImageFileInputGUI::setUseCache ( bool  $a_cache)

Set cache.

Parameters
bool$a_cacheIf false, the image will be forced to reload in the browser by adding an URL parameter with the actual timestamp

Definition at line 78 of file class.ilImageFileInputGUI.php.

78  : void
79  {
80  $this->cache = $a_cache;
81  }

Field Documentation

◆ $allow_capture

bool ilImageFileInputGUI::$allow_capture = false
protected

Definition at line 32 of file class.ilImageFileInputGUI.php.

Referenced by getAllowCapture().

◆ $alt

string ilImageFileInputGUI::$alt = ""
protected

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

Referenced by getAlt().

◆ $cache

bool ilImageFileInputGUI::$cache = false
protected

Definition at line 29 of file class.ilImageFileInputGUI.php.

Referenced by getUseCache().

◆ $image

string ilImageFileInputGUI::$image = ""
protected

Definition at line 31 of file class.ilImageFileInputGUI.php.

Referenced by getImage().

◆ $tpl

ilGlobalTemplateInterface ilImageFileInputGUI::$tpl
protected

Definition at line 28 of file class.ilImageFileInputGUI.php.

Referenced by insert().


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