ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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
Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 35 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().

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

Member Function Documentation

◆ getAllowCapture()

ilImageFileInputGUI::getAllowCapture ( )

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

References $allow_capture.

Referenced by insert().

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

◆ getALlowDeletion()

ilImageFileInputGUI::getALlowDeletion ( )

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

References ilFileInputGUI\$allow_deletion.

Referenced by insert().

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

◆ getAlt()

ilImageFileInputGUI::getAlt ( )

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

References $alt.

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

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

◆ getDeletionFlag()

ilImageFileInputGUI::getDeletionFlag ( )

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

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

Referenced by ilLTIConsumeProviderIcon\handleUploadInputSubission().

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

◆ getImage()

ilImageFileInputGUI::getImage ( )

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

References $image.

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

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

◆ getUseCache()

ilImageFileInputGUI::getUseCache ( )

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

References $cache.

Referenced by insert().

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

◆ insert()

ilImageFileInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 109 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().

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

Referenced by ilUserProfile\getImageInput().

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

◆ setAllowDeletion()

ilImageFileInputGUI::setAllowDeletion ( bool  $a_val)

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

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

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

◆ setAlt()

ilImageFileInputGUI::setAlt ( string  $a_alt)

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

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

◆ setImage()

ilImageFileInputGUI::setImage ( string  $a_image)

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

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

89  : void
90  {
91  $this->image = $a_image;
92  }
+ 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 79 of file class.ilImageFileInputGUI.php.

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

Field Documentation

◆ $allow_capture

bool ilImageFileInputGUI::$allow_capture = false
protected

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

Referenced by getAllowCapture().

◆ $alt

string ilImageFileInputGUI::$alt = ""
protected

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

Referenced by getAlt().

◆ $cache

bool ilImageFileInputGUI::$cache = false
protected

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

Referenced by getUseCache().

◆ $image

string ilImageFileInputGUI::$image = ""
protected

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

Referenced by getImage().

◆ $tpl

ilGlobalTemplateInterface ilImageFileInputGUI::$tpl
protected

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

Referenced by insert().


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