ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 Check input, strip slashes etc. More...
 
 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)
 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...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. 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 = "" 
)

Reimplemented from ilFileInputGUI.

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

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 }
setSuffixes(array $a_suffixes)
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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getAllowCapture()

ilImageFileInputGUI::getAllowCapture ( )

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

68 : bool
69 {
71 }

References $allow_capture.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getALlowDeletion()

ilImageFileInputGUI::getALlowDeletion ( )

Reimplemented from ilFileInputGUI.

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

58 : bool
59 {
61 }

References ilFileInputGUI\$allow_deletion.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getAlt()

ilImageFileInputGUI::getAlt ( )

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

104 : string
105 {
106 return $this->alt;
107 }

References $alt.

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

+ Here is the caller graph for this function:

◆ getDeletionFlag()

ilImageFileInputGUI::getDeletionFlag ( )

Reimplemented from ilFileInputGUI.

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

197 : bool
198 {
199 if ($this->str($this->getPostVar() . "_delete") != "") {
200 return true;
201 }
202 return false;
203 }

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

Referenced by ilLTIConsumeProviderIcon\handleUploadInputSubission().

+ 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.

94 : string
95 {
96 return $this->image;
97 }

References $image.

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

+ Here is the caller graph for this function:

◆ getUseCache()

ilImageFileInputGUI::getUseCache ( )

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

84 : bool
85 {
86 return $this->cache;
87 }

References $cache.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilImageFileInputGUI::insert ( ilTemplate  $a_tpl)

Reimplemented from ilFileInputGUI.

Reimplemented in ilImagemapCorrectionsInputGUI, and ilImagemapFileInputGUI.

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

109 : void
110 {
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 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
outputSuffixes(ilTemplate $a_tpl, string $a_block="allowed_suffixes")
ilGlobalTemplateInterface $tpl
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.

References ilFormPropertyGUI\$lng, ilFileInputGUI\$pending, $tpl, getAllowCapture(), getALlowDeletion(), getAlt(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getImage(), 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().

+ Here is the call graph for this function:

◆ setAllowCapture()

ilImageFileInputGUI::setAllowCapture ( bool  $a_val)

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

63 : void
64 {
65 $this->allow_capture = $a_val;
66 }

◆ setAllowDeletion()

ilImageFileInputGUI::setAllowDeletion ( bool  $a_val)

Reimplemented from ilFileInputGUI.

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

53 : void
54 {
55 $this->allow_deletion = $a_val;
56 }

Referenced by __construct().

+ 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.

89 : void
90 {
91 $this->image = $a_image;
92 }

◆ 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: