4 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
24 return self::$uniqueInc++;
35 parent::__construct($a_title, $a_postvar);
36 $this->uniqueId = self::getNextUniqueId();
46 $this->archive_suffixes = $a_suffixes;
61 $this->submit_button_name = $a_submit_name;
62 $this->cancel_button_name = $a_cancel_name;
72 $quota_exceeded = $quota_legend =
false;
73 if(self::$check_wsp_quota)
75 include_once
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
78 $lng->loadLanguageModule(
"file");
79 return $lng->txt(
"personal_workspace_quota_exceeded_warning");
91 include_once(
"./Services/FileUpload/classes/class.ilFileUploadGUI.php");
95 $this->tpl =
new ilTemplate(
"tpl.prop_dndfiles.html",
true,
true,
"Services/Form");
98 $this->tpl->setVariable(
"UPLOAD_ID", $this->uniqueId);
102 $this->tpl->setVariable(
"TXT_SHOW_ALL_DETAILS", $lng->txt(
'show_all_details'));
103 $this->tpl->setVariable(
"TXT_HIDE_ALL_DETAILS", $lng->txt(
'hide_all_details'));
104 $this->tpl->setVariable(
"TXT_SELECTED_FILES", $lng->txt(
'selected_files'));
105 $this->tpl->setVariable(
"TXT_DRAG_FILES_HERE", $lng->txt(
'drag_files_here'));
106 $this->tpl->setVariable(
"TXT_NUM_OF_SELECTED_FILES", $lng->txt(
'num_of_selected_files'));
107 $this->tpl->setVariable(
"TXT_SELECT_FILES_FROM_COMPUTER", $lng->txt(
'select_files_from_computer'));
108 $this->tpl->setVariable(
"TXT_OR", $lng->txt(
'logic_or'));
112 $this->tpl->setCurrentBlock(
"max_size");
113 $this->tpl->setVariable(
"TXT_MAX_SIZE", $lng->txt(
"file_notice").
" ".$this->
getMaxFileSizeString());
114 $this->tpl->parseCurrentBlock();
118 $this->tpl->setVariable(
"TXT_MAX_SIZE", $quota_legend);
119 $this->tpl->parseCurrentBlock();
125 $upload =
new ilFileUploadGUI(
"ilFileUploadDropZone_" . $this->uniqueId, $this->uniqueId,
false);
126 $upload->enableFormSubmit(
"ilFileUploadInput_" . $this->uniqueId, $this->submit_button_name, $this->cancel_button_name);
127 $upload->setDropAreaId(
"ilFileUploadDropArea_" . $this->uniqueId);
128 $upload->setFileListId(
"ilFileUploadList_" . $this->uniqueId);
129 $upload->setFileSelectButtonId(
"ilFileUploadFileSelect_" . $this->uniqueId);
131 $this->tpl->setVariable(
"FILE_UPLOAD", $upload->getHTML());
133 return $this->tpl->get();
149 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
156 $this->
setAlert($lng->txt(
"error_upload_was_zero_bytes"));
161 $inputValid = parent::checkInput();
171 include_once(
"./Services/Utilities/classes/class.ilStr.php");
184 if (is_array($suffixes) && count($suffixes) > 0)
186 foreach($suffixes as $suffix)
188 $list .= $delim .
"." . $suffix;
200 if (is_array($suffixes) && count($suffixes) > 0)
202 foreach($suffixes as $suffix)
204 $list .= $delim .
"\"" . $suffix .
"\"";
215 $umf = ini_get(
"upload_max_filesize");
217 $pms = ini_get(
"post_max_size");
220 $multiplier_a=
array(
"K"=>1024,
"M"=>1024*1024,
"G"=>1024*1024*1024);
222 $umf_parts=preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
223 $pms_parts=preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
225 if (count($umf_parts) == 2) {
226 $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]];
228 if (count($pms_parts) == 2) {
229 $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]];
233 $max_filesize = min($umf, $pms);
236 $max_filesize=max($umf, $pms);
238 return $max_filesize;
static initFileUpload()
Initializes the file upload and loads the needed javascripts and styles.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static normalizeUtf8String($a_str)
Normalize UTF8 string.
special template class to simplify handling of ITX/PEAR
static isUploadPossible($a_additional_size=null)
Create styles array
The data for the language used.
static initjQuery($a_tpl=null)
Init jQuery.