ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
- 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

 $lng
 
 $tpl
 
 $filenames = array()
 
 $allowMove = false
 
 $imagepath_web = ""
 
- 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 ()
 
 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 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 53 of file class.ilFileWizardInputGUI.php.

54 {
55 global $DIC;
56
57 $this->lng = $DIC->language();
58 $this->lng->loadLanguageModule("form");
59 $this->tpl = $DIC["tpl"];
60 parent::__construct($a_title, $a_postvar);
61 }
global $DIC
Definition: saml.php:7

References $DIC.

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 128 of file class.ilFileWizardInputGUI.php.

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

References ilFileInputGUI\$filename, $index, $lng, $name, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFileInputGUI\getSuffixes(), ilStr\normalizeUtf8String(), 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 118 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 98 of file class.ilFileWizardInputGUI.php.

References $filenames.

◆ getImagePathWeb()

ilFileWizardInputGUI::getImagePathWeb ( )

Get the web image path.

Returns
string Path

Definition at line 78 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 235 of file class.ilFileWizardInputGUI.php.

236 {
238
239 $tpl = new ilTemplate("tpl.prop_filewizardinput.html", true, true, "Services/Form");
240
241 $i = 0;
242 foreach ($this->filenames as $value) {
243 if (strlen($value)) {
244 $tpl->setCurrentBlock("image");
245 $tpl->setVariable("SRC_IMAGE", $this->getImagePathWeb() . ilUtil::prepareFormOutput($value));
246 $tpl->setVariable("PICTURE_FILE", ilUtil::prepareFormOutput($value));
247 $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
248 $tpl->setVariable("ALT_IMAGE", ilUtil::prepareFormOutput($value));
249 $tpl->parseCurrentBlock();
250 }
251 if ($this->getAllowMove()) {
252 $tpl->setCurrentBlock("move");
253 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
254 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
255 $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
256 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
257 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
258 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
259 $tpl->parseCurrentBlock();
260 }
261
262 $this->outputSuffixes($tpl, "allowed_image_suffixes");
263
264 $tpl->setCurrentBlock("row");
265 $tpl->setVariable("POST_VAR", $this->getPostVar() . "[$i]");
266 $tpl->setVariable("ID", $this->getFieldId() . "[$i]");
267 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
268 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
269 $tpl->setVariable("ALT_ADD", $lng->txt("add"));
270 $tpl->setVariable("ALT_REMOVE", $lng->txt("remove"));
271 if ($this->getDisabled()) {
272 $tpl->setVariable(
273 "DISABLED",
274 " disabled=\"disabled\""
275 );
276 }
277
278 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
279 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
280 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
281 $tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString());
282 $tpl->setVariable("MAX_UPLOAD_VALUE", $this->getMaxFileUploads());
283 $tpl->setVariable("TXT_MAX_UPLOADS", $lng->txt("form_msg_max_upload") . " " . $this->getMaxFileUploads());
284 $tpl->parseCurrentBlock();
285 $i++;
286 }
287 $tpl->setVariable("ELEMENT_ID", $this->getFieldId());
288
289 $a_tpl->setCurrentBlock("prop_generic");
290 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
291 $a_tpl->parseCurrentBlock();
292
293 $main_tpl = $this->tpl;
294 $main_tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
295 $main_tpl->addJavascript("./Services/Form/templates/default/filewizard.js");
296 }
outputSuffixes($a_tpl, $a_block="allowed_suffixes")
getMaxFileUploads()
Get number of maximum file uploads as declared in php.ini.
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
$i
Definition: disco.tpl.php:19

References $i, $lng, $tpl, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getImagePathWeb(), ilFileInputGUI\getMaxFileUploads(), 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 108 of file class.ilFileWizardInputGUI.php.

109 {
110 $this->allowMove = $a_allow_move;
111 }

◆ setFilenames()

ilFileWizardInputGUI::setFilenames (   $a_filenames)

Set filenames.

Parameters
array$a_valueValue

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

89 {
90 $this->filenames = $a_filenames;
91 }

◆ setImagePathWeb()

ilFileWizardInputGUI::setImagePathWeb (   $a_path)

Set the web image path.

Parameters
string$a_pathPath

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

69 {
70 $this->imagepath_web = $a_path;
71 }

Field Documentation

◆ $allowMove

ilFileWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $filenames

ilFileWizardInputGUI::$filenames = array()
protected

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

Referenced by getFilenames().

◆ $imagepath_web

ilFileWizardInputGUI::$imagepath_web = ""
protected

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

Referenced by getImagePathWeb().

◆ $lng

ilFileWizardInputGUI::$lng
protected

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

Referenced by checkInput(), and insert().

◆ $tpl

ilFileWizardInputGUI::$tpl
protected

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

Referenced by insert().


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