ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 setPersonalWorkspaceQuotaCheck ($a_value)
 
- 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Attributes

 $cache
 
- Protected Attributes inherited from ilFileInputGUI
 $size = 40
 
 $pending
 
 $allow_deletion
 
 $forbidden_suffixes = array()
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Protected Member Functions inherited from ilFileInputGUI
 outputSuffixes ($a_tpl, $a_block="allowed_suffixes")
 
 getMaxFileSizeString ()
 
- 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 $lng;
24
25 parent::__construct($a_title, $a_postvar);
26 $this->setType("image_file");
27 $this->setAllowDeletion(true);
28 $this->setSuffixes(array("jpg", "jpeg", "png", "gif"));
29 $this->setHiddenTitle("(".$lng->txt("form_image_file_input").")");
30 $this->cache = true;
31 }
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setType($a_type)
Set Type.
setHiddenTitle($a_val)
Set hidden title (for screenreaders)
global $lng
Definition: privfeed.php:40

References $lng, 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 48 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 108 of file class.ilImageFileInputGUI.php.

109 {
110 return $this->alt;
111 }

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

+ Here is the caller graph for this function:

◆ getDeletionFlag()

ilImageFileInputGUI::getDeletionFlag ( )

Get deletion flag.

Reimplemented from ilFileInputGUI.

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

218 {
219 if ($_POST[$this->getPostVar()."_delete"])
220 {
221 return true;
222 }
223 return false;
224 }
getPostVar()
Get Post Variable.
$_POST['username']
Definition: cron.php:12

References $_POST, and ilFormPropertyGUI\getPostVar().

+ Here is the call graph for this function:

◆ getImage()

ilImageFileInputGUI::getImage ( )

Get Image.

Returns
string Image

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

89 {
90 return $this->image;
91 }

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

+ Here is the caller graph for this function:

◆ getUseCache()

ilImageFileInputGUI::getUseCache ( )

Get cache.

Returns
boolean

Definition at line 68 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 ilImagemapFileInputGUI.

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

117 {
118 global $lng;
119
120 $quota_exceeded = $quota_legend = false;
121 if(self::$check_wsp_quota)
122 {
123 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
125 {
126 $lng->loadLanguageModule("file");
127 $quota_exceeded = $lng->txt("personal_workspace_quota_exceeded_warning");
128 }
129 else
130 {
131 $quota_legend = ilDiskQuotaHandler::getStatusLegend();
132 if($quota_legend)
133 {
134 $quota_legend = "<br />".$quota_legend;
135 }
136 }
137 }
138
139 $i_tpl = new ilTemplate("tpl.prop_image_file.html", true, true, "Services/Form");
140
141 if ($this->getImage() != "")
142 {
143 if (!$this->getDisabled() && $this->getALlowDeletion())
144 {
145 $i_tpl->setCurrentBlock("delete_bl");
146 $i_tpl->setVariable("POST_VAR_D", $this->getPostVar());
147 $i_tpl->setVariable("TXT_DELETE_EXISTING",
148 $lng->txt("delete_existing_file"));
149 $i_tpl->parseCurrentBlock();
150 }
151
152 if (strlen($this->getValue()))
153 {
154 $i_tpl->setCurrentBlock("has_value");
155 $i_tpl->setVariable("TEXT_IMAGE_NAME", $this->getValue());
156 $i_tpl->parseCurrentBlock();
157 }
158 $i_tpl->setCurrentBlock("image");
159 if (!$this->getUseCache())
160 {
161 $pos = strpos($this->getImage(), '?');
162 if ($pos !== false)
163 {
164 $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "&amp;time=" . time());
165 }
166 else
167 {
168 $i_tpl->setVariable("SRC_IMAGE", $this->getImage() . "?time=" . time());
169 }
170 }
171 else
172 {
173 $i_tpl->setVariable("SRC_IMAGE", $this->getImage());
174 }
175 $i_tpl->setVariable("ALT_IMAGE", $this->getAlt());
176 $i_tpl->parseCurrentBlock();
177 }
178
179 $pending = $this->getPending();
180 if($pending)
181 {
182 $i_tpl->setCurrentBlock("pending");
183 $i_tpl->setVariable("TXT_PENDING", $lng->txt("file_upload_pending").
184 ": ".$pending);
185 $i_tpl->parseCurrentBlock();
186 }
187
188 $i_tpl->setVariable("POST_VAR", $this->getPostVar());
189 $i_tpl->setVariable("ID", $this->getFieldId());
190
191 if(!$quota_exceeded)
192 {
193 $i_tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice")." ".
194 $this->getMaxFileSizeString().$quota_legend);
195
196 $this->outputSuffixes($i_tpl, "allowed_image_suffixes");
197 }
198 else
199 {
200 $i_tpl->setVariable("TXT_MAX_SIZE", $quota_exceeded);
201 }
202
203 if ($this->getDisabled() || $quota_exceeded)
204 {
205 $i_tpl->setVariable("DISABLED",
206 " disabled=\"disabled\"");
207 }
208
209 $a_tpl->setCurrentBlock("prop_generic");
210 $a_tpl->setVariable("PROP_GENERIC", $i_tpl->get());
211 $a_tpl->parseCurrentBlock();
212 }
static isUploadPossible($a_additional_size=null)
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 $lng, ilFileInputGUI\$pending, getALlowDeletion(), getAlt(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getImage(), ilFileInputGUI\getPending(), ilFormPropertyGUI\getPostVar(), ilDiskQuotaHandler\getStatusLegend(), getUseCache(), ilFileInputGUI\getValue(), ilDiskQuotaHandler\isUploadPossible(), 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 38 of file class.ilImageFileInputGUI.php.

39 {
40 $this->allow_deletion = $a_val;
41 }

◆ setAlt()

ilImageFileInputGUI::setAlt (   $a_alt)

Set Alternative Text.

Parameters
string$a_altAlternative Text

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

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

◆ setImage()

ilImageFileInputGUI::setImage (   $a_image)

Set Image.

Parameters
string$a_imageImage

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

79 {
80 $this->image = $a_image;
81 }

◆ 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 58 of file class.ilImageFileInputGUI.php.

59 {
60 $this->cache = ($a_cache) ? true : false;
61 }

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: