ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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 ilFileInputGUI
static setPersonalWorkspaceQuotaCheck ($a_value)
 
- 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 ()
 
- 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: saml.php:7

References $DIC, ilFileInputGUI\$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 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 ilImagemapFileInputGUI\insert(), and insert().

+ Here is the caller graph for this function:

◆ getDeletionFlag()

ilImageFileInputGUI::getDeletionFlag ( )

Get deletion flag.

Reimplemented from ilFileInputGUI.

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

211 {
212 if ($_POST[$this->getPostVar() . "_delete"]) {
213 return true;
214 }
215 return false;
216 }
$_POST["username"]
getPostVar()
Get Post Variable.

References $_POST, and ilFormPropertyGUI\getPostVar().

+ Here is the call 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 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 ilImagemapFileInputGUI.

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

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

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

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