ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 setALlowDeletion ($a_val)
 Set allow deletion. More...
 
 getALlowDeletion ()
 Get allow deletion. More...
 
 setUseCache ($a_cache)
 Set cache. More...
 
 getUseCache ()
 Get cache. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setAlt ($a_alt)
 Set Alternative Text. More...
 
 getAlt ()
 Get Alternative Text. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getDeletionFlag ()
 Get deletion flag. More...
 
- Public Member Functions inherited from ilFileInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setSize ($a_size)
 Set Size. More...
 
 getSize ()
 Get Size. More...
 
 setFilename ($a_val)
 Set filename value (if filename selection is enabled) More...
 
 getFilename ()
 Get Value. More...
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 setForbiddenSuffixes ($a_suffixes)
 Set forbidden Suffixes. More...
 
 getForbiddenSuffixes ()
 Get Accepted Suffixes. More...
 
 setPending ($a_val)
 Set pending filename value. More...
 
 getPending ()
 Get pending filename. More...
 
 enableFileNameSelection ($a_post_var)
 If enabled, users get the possibility to enter a filename for the uploaded file. More...
 
 isFileNameSelectionEnabled ()
 Check if filename selection is enabled. More...
 
 getFileNamePostVar ()
 Get file name post var. More...
 
 setALlowDeletion ($a_val)
 Set allow deletion. More...
 
 getALlowDeletion ()
 Get allow deletion. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ($a_mode="")
 Render html. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getDeletionFlag ()
 Get deletion flag. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
- 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...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Attributes

 $cache
 
- Protected Attributes inherited from ilFileInputGUI
 $lng
 
 $size = 40
 
 $pending
 
 $allow_deletion
 
 $forbidden_suffixes = array()
 
- 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...
 
- Protected Member Functions inherited from ilFileInputGUI
 outputSuffixes ($a_tpl, $a_block="allowed_suffixes")
 
 getMaxFileSizeString ()
 
 getMaxFileUploads ()
 Get number of maximum file uploads as declared in php.ini. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 
- Static Protected Attributes inherited from ilFileInputGUI
static $check_wsp_quota
 

Detailed Description

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

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFileInputGUI.

Reimplemented in ilImagemapFileInputGUI.

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

22 {
23 global $DIC;
24
25 $this->lng = $DIC->language();
26 $lng = $DIC->language();
27
28 parent::__construct($a_title, $a_postvar);
29 $this->setType("image_file");
30 $this->setAllowDeletion(true);
31 $this->setSuffixes(array("jpg", "jpeg", "png", "gif"));
32 $this->setHiddenTitle("(" . $lng->txt("form_image_file_input") . ")");
33 $this->cache = true;
34 }
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setType($a_type)
Set Type.
setHiddenTitle($a_val)
Set hidden title (for screenreaders)
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getALlowDeletion()

ilImageFileInputGUI::getALlowDeletion ( )

Get allow deletion.

Returns
boolean allow deletion

Reimplemented from ilFileInputGUI.

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

References ilFileInputGUI\$allow_deletion.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getAlt()

ilImageFileInputGUI::getAlt ( )

Get Alternative Text.

Returns
string Alternative Text

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

112 {
113 return $this->alt;
114 }

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

+ Here is the caller graph for this function:

◆ getDeletionFlag()

ilImageFileInputGUI::getDeletionFlag ( )

Get deletion flag.

Reimplemented from ilFileInputGUI.

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

198 {
199 if ($_POST[$this->getPostVar() . "_delete"]) {
200 return true;
201 }
202 return false;
203 }
$_POST["username"]
getPostVar()
Get Post Variable.

References $_POST, and ilFormPropertyGUI\getPostVar().

Referenced by ilLTIConsumeProviderIcon\handleUploadInputSubission().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImage()

ilImageFileInputGUI::getImage ( )

Get Image.

Returns
string Image

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

92 {
93 return $this->image;
94 }

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

+ Here is the caller graph for this function:

◆ getUseCache()

ilImageFileInputGUI::getUseCache ( )

Get cache.

Returns
boolean

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

References $cache.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilImageFileInputGUI::insert (   $a_tpl)

Insert property html.

Reimplemented from ilFileInputGUI.

Reimplemented in ilImagemapCorrectionsInputGUI, and ilImagemapFileInputGUI.

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

120 {
122
123 $quota_exceeded = $quota_legend = false;
124 $i_tpl = new ilTemplate("tpl.prop_image_file.html", true, true, "Services/Form");
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("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("POST_VAR", $this->getPostVar());
166 $i_tpl->setVariable("ID", $this->getFieldId());
167
168
169 /* experimental: bootstrap'ed file upload */
170 $i_tpl->setVariable("TXT_BROWSE", $lng->txt("select_file"));
171
172
173 if (!$quota_exceeded) {
174 $i_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " .
175 $this->getMaxFileSizeString() . $quota_legend);
176
177 $this->outputSuffixes($i_tpl, "allowed_image_suffixes");
178 } else {
179 $i_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded);
180 }
181
182 if ($this->getDisabled() || $quota_exceeded) {
183 $i_tpl->setVariable(
184 "DISABLED",
185 " disabled=\"disabled\""
186 );
187 }
188
189 $a_tpl->setCurrentBlock("prop_generic");
190 $a_tpl->setVariable("PROP_GENERIC", $i_tpl->get());
191 $a_tpl->parseCurrentBlock();
192 }
outputSuffixes($a_tpl, $a_block="allowed_suffixes")
getPending()
Get pending filename.
getFieldId()
Get Post Variable.
getAlt()
Get Alternative Text.
getALlowDeletion()
Get allow deletion.
special template class to simplify handling of ITX/PEAR

References ilFileInputGUI\$lng, ilFileInputGUI\$pending, getALlowDeletion(), getAlt(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getImage(), ilFileInputGUI\getPending(), ilFormPropertyGUI\getPostVar(), getUseCache(), ilFileInputGUI\getValue(), and ilFileInputGUI\outputSuffixes().

+ Here is the call graph for this function:

◆ setALlowDeletion()

ilImageFileInputGUI::setALlowDeletion (   $a_val)

Set allow deletion.

Parameters
boolean$a_valallow deletion

Reimplemented from ilFileInputGUI.

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

42 {
43 $this->allow_deletion = $a_val;
44 }

Referenced by ilObjLearningSequenceSettingsGUI\initImgInput().

+ Here is the caller graph for this function:

◆ setAlt()

ilImageFileInputGUI::setAlt (   $a_alt)

Set Alternative Text.

Parameters
string$a_altAlternative Text

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

102 {
103 $this->alt = $a_alt;
104 }

◆ setImage()

ilImageFileInputGUI::setImage (   $a_image)

Set Image.

Parameters
string$a_imageImage

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

82 {
83 $this->image = $a_image;
84 }

◆ setUseCache()

ilImageFileInputGUI::setUseCache (   $a_cache)

Set cache.

Parameters
boolean$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 61 of file class.ilImageFileInputGUI.php.

62 {
63 $this->cache = ($a_cache) ? true : false;
64 }

Field Documentation

◆ $cache

ilImageFileInputGUI::$cache
protected

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

Referenced by getUseCache().


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