ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilFileWizardInputGUI Class Reference

This class represents a file wizard property in a property form. More...

+ Inheritance diagram for ilFileWizardInputGUI:
+ Collaboration diagram for ilFileWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setImagePathWeb ($a_path)
 Set the web image path. More...
 
 getImagePathWeb ()
 Get the web image path. More...
 
 setFilenames ($a_filenames)
 Set filenames. More...
 
 getFilenames ()
 Get filenames. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (&$a_tpl)
 Insert property html. 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

 $filenames = array()
 
 $allowMove = false
 
 $imagepath_web = ""
 
- 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 a file wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
Id
class.ilFileWizardInputGUI.php 18834 2009-02-03 10:10:29Z hschottm

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFileInputGUI.

Definition at line 43 of file class.ilFileWizardInputGUI.php.

44 {
45 parent::__construct($a_title, $a_postvar);
46 }

Member Function Documentation

◆ checkInput()

ilFileWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFileInputGUI.

Definition at line 113 of file class.ilFileWizardInputGUI.php.

114 {
115 global $lng;
116
117 // see ilFileInputGUI
118 // if no information is received, something went wrong
119 // this is e.g. the case, if the post_max_size has been exceeded
120 if (!is_array($_FILES[$this->getPostVar()]))
121 {
122 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
123 return false;
124 }
125
126 $pictures = $_FILES[$this->getPostVar()];
127 $uploadcheck = true;
128 if (is_array($pictures))
129 {
130 foreach ($pictures['name'] as $index => $name)
131 {
132 // remove trailing '/'
133 while (substr($name, -1) == '/')
134 {
135 $name = substr($name, 0, -1);
136 }
137
138 $filename = $name;
139 $filename_arr = pathinfo($name);
140 $suffix = $filename_arr["extension"];
141 $mimetype = $pictures["type"][$index];
142 $size_bytes = $pictures["size"][$index];
143 $temp_name = $pictures["tmp_name"][$index];
144 $error = $pictures["error"][$index];
145 // error handling
146 if ($error > 0)
147 {
148 switch ($error)
149 {
150 case UPLOAD_ERR_INI_SIZE:
151 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
152 $uploadcheck = false;
153 break;
154
155 case UPLOAD_ERR_FORM_SIZE:
156 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
157 $uploadcheck = false;
158 break;
159
160 case UPLOAD_ERR_PARTIAL:
161 $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
162 $uploadcheck = false;
163 break;
164
165 case UPLOAD_ERR_NO_FILE:
166 if ($this->getRequired())
167 {
168 $filename = $this->filenames[$index];
169 if (!strlen($filename))
170 {
171 $this->setAlert($lng->txt("form_msg_file_no_upload"));
172 $uploadcheck = false;
173 }
174 }
175 break;
176
177 case UPLOAD_ERR_NO_TMP_DIR:
178 $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
179 $uploadcheck = false;
180 break;
181
182 case UPLOAD_ERR_CANT_WRITE:
183 $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
184 $uploadcheck = false;
185 break;
186
187 case UPLOAD_ERR_EXTENSION:
188 $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
189 $uploadcheck = false;
190 break;
191 }
192 }
193
194 // check suffixes
195 if ($pictures["tmp_name"][$index] != "" && is_array($this->getSuffixes()))
196 {
197 if (!in_array(strtolower($suffix), $this->getSuffixes()))
198 {
199 $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
200 $uploadcheck = false;
201 }
202 }
203
204 // virus handling
205 if ($pictures["tmp_name"][$index] != "")
206 {
207 $vir = ilUtil::virusHandling($temp_name, $filename);
208 if ($vir[0] == false)
209 {
210 $this->setAlert($lng->txt("form_msg_file_virus_found")."<br />".$vir[1]);
211 $uploadcheck = false;
212 }
213 }
214 }
215
216 }
217
218 if (!$uploadcheck)
219 {
220 return FALSE;
221 }
222
223 return $this->checkSubItemsInput();
224 }
getSuffixes()
Get Accepted Suffixes.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
global $lng
Definition: privfeed.php:40

References ilFileInputGUI\$filename, $lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFileInputGUI\getSuffixes(), ilFormPropertyGUI\setAlert(), and ilUtil\virusHandling().

+ Here is the call graph for this function:

◆ getAllowMove()

ilFileWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 103 of file class.ilFileWizardInputGUI.php.

References $allowMove.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getFilenames()

ilFileWizardInputGUI::getFilenames ( )

Get filenames.

Returns
array filenames

Definition at line 83 of file class.ilFileWizardInputGUI.php.

References $filenames.

◆ getImagePathWeb()

ilFileWizardInputGUI::getImagePathWeb ( )

Get the web image path.

Returns
string Path

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

References $imagepath_web.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilFileWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilFileInputGUI.

Definition at line 231 of file class.ilFileWizardInputGUI.php.

232 {
233 global $lng;
234
235 $tpl = new ilTemplate("tpl.prop_filewizardinput.html", true, true, "Services/Form");
236
237 $i = 0;
238 foreach ($this->filenames as $value)
239 {
240 if (strlen($value))
241 {
242 $tpl->setCurrentBlock("image");
243 $tpl->setVariable("SRC_IMAGE", $this->getImagePathWeb() . ilUtil::prepareFormOutput($value));
244 $tpl->setVariable("PICTURE_FILE", ilUtil::prepareFormOutput($value));
245 $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
246 $tpl->setVariable("ALT_IMAGE", ilUtil::prepareFormOutput($value));
247 $tpl->parseCurrentBlock();
248 }
249 if ($this->getAllowMove())
250 {
251 $tpl->setCurrentBlock("move");
252 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
253 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
254 $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
255 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
256 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
257 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
258 $tpl->parseCurrentBlock();
259 }
260
261 $this->outputSuffixes($tpl, "allowed_image_suffixes");
262
263 $tpl->setCurrentBlock("row");
264 $tpl->setVariable("POST_VAR", $this->getPostVar() . "[$i]");
265 $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
266 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
267 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
268 $tpl->setVariable("ALT_ADD", $lng->txt("add"));
269 $tpl->setVariable("ALT_REMOVE", $lng->txt("remove"));
270 if ($this->getDisabled())
271 {
272 $tpl->setVariable("DISABLED",
273 " disabled=\"disabled\"");
274 }
275
276 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
277 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
278 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
279 $tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString());
280 $tpl->parseCurrentBlock();
281 $i++;
282 }
283 $tpl->setVariable("ELEMENT_ID", $this->getFieldId());
284
285 $a_tpl->setCurrentBlock("prop_generic");
286 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
287 $a_tpl->parseCurrentBlock();
288
289 global $tpl;
290 $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
291 $tpl->addJavascript("./Services/Form/templates/default/filewizard.js");
292 }
global $tpl
Definition: ilias.php:8
outputSuffixes($a_tpl, $a_block="allowed_suffixes")
getImagePathWeb()
Get the web image path.
getFieldId()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $lng, $tpl, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getImagePathWeb(), ilFormPropertyGUI\getPostVar(), ilFileInputGUI\outputSuffixes(), ilUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, and ilGlyphGUI\UP.

+ Here is the call graph for this function:

◆ setAllowMove()

ilFileWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 93 of file class.ilFileWizardInputGUI.php.

94 {
95 $this->allowMove = $a_allow_move;
96 }

◆ setFilenames()

ilFileWizardInputGUI::setFilenames (   $a_filenames)

Set filenames.

Parameters
array$a_valueValue

Definition at line 73 of file class.ilFileWizardInputGUI.php.

74 {
75 $this->filenames = $a_filenames;
76 }

◆ setImagePathWeb()

ilFileWizardInputGUI::setImagePathWeb (   $a_path)

Set the web image path.

Parameters
string$a_pathPath

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

54 {
55 $this->imagepath_web = $a_path;
56 }

Field Documentation

◆ $allowMove

ilFileWizardInputGUI::$allowMove = false
protected

Definition at line 34 of file class.ilFileWizardInputGUI.php.

Referenced by getAllowMove().

◆ $filenames

ilFileWizardInputGUI::$filenames = array()
protected

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

Referenced by getFilenames().

◆ $imagepath_web

ilFileWizardInputGUI::$imagepath_web = ""
protected

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

Referenced by getImagePathWeb().


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