4 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
29 return self::$uniqueInc++;
42 $this->lng = $DIC->language();
43 parent::__construct($a_title, $a_postvar);
44 $this->uniqueId = self::getNextUniqueId();
54 $this->archive_suffixes = $a_suffixes;
69 $this->submit_button_name = $a_submit_name;
70 $this->cancel_button_name = $a_cancel_name;
80 $quota_exceeded = $quota_legend =
false;
81 if (self::$check_wsp_quota) {
82 include_once
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
84 $lng->loadLanguageModule(
"file");
85 return $lng->txt(
"personal_workspace_quota_exceeded_warning");
95 include_once(
"./Services/FileUpload/classes/class.ilFileUploadGUI.php");
99 $this->tpl =
new ilTemplate(
"tpl.prop_dndfiles.html",
true,
true,
"Services/Form");
102 $this->tpl->setVariable(
"UPLOAD_ID", $this->uniqueId);
105 $this->tpl->setVariable(
"FILE_SELECT_ICON", ilObject::_getIcon(
"",
"",
"fold"));
106 $this->tpl->setVariable(
"TXT_SHOW_ALL_DETAILS",
$lng->txt(
'show_all_details'));
107 $this->tpl->setVariable(
"TXT_HIDE_ALL_DETAILS",
$lng->txt(
'hide_all_details'));
108 $this->tpl->setVariable(
"TXT_SELECTED_FILES",
$lng->txt(
'selected_files'));
109 $this->tpl->setVariable(
"TXT_DRAG_FILES_HERE",
$lng->txt(
'drag_files_here'));
110 $this->tpl->setVariable(
"TXT_NUM_OF_SELECTED_FILES",
$lng->txt(
'num_of_selected_files'));
111 $this->tpl->setVariable(
"TXT_SELECT_FILES_FROM_COMPUTER",
$lng->txt(
'select_files_from_computer'));
112 $this->tpl->setVariable(
"TXT_OR",
$lng->txt(
'logic_or'));
116 $this->tpl->setCurrentBlock(
"max_size");
118 $this->tpl->parseCurrentBlock();
121 $this->tpl->setVariable(
"TXT_MAX_SIZE", $quota_legend);
122 $this->tpl->parseCurrentBlock();
128 $upload =
new ilFileUploadGUI(
"ilFileUploadDropZone_" . $this->uniqueId, $this->uniqueId,
false);
129 $upload->enableFormSubmit(
"ilFileUploadInput_" . $this->uniqueId, $this->submit_button_name, $this->cancel_button_name);
130 $upload->setDropAreaId(
"ilFileUploadDropArea_" . $this->uniqueId);
131 $upload->setFileListId(
"ilFileUploadList_" . $this->uniqueId);
132 $upload->setFileSelectButtonId(
"ilFileUploadFileSelect_" . $this->uniqueId);
134 $this->tpl->setVariable(
"FILE_UPLOAD", $upload->getHTML());
136 return $this->tpl->get();
150 if (!is_array($_FILES[$this->
getPostVar()])) {
151 $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
156 if ($_FILES[$this->
getPostVar()][
"size"] < 1) {
157 $this->
setAlert(
$lng->txt(
"error_upload_was_zero_bytes"));
162 $inputValid = parent::checkInput();
171 include_once(
"./Services/Utilities/classes/class.ilStr.php");
183 if (is_array($suffixes) && count($suffixes) > 0) {
184 foreach ($suffixes as $suffix) {
185 $list .= $delim .
"." . $suffix;
197 if (is_array($suffixes) && count($suffixes) > 0) {
198 foreach ($suffixes as $suffix) {
199 $list .= $delim .
"\"" . $suffix .
"\"";
210 $umf = ini_get(
"upload_max_filesize");
212 $pms = ini_get(
"post_max_size");
215 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024);
217 $umf_parts = preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
218 $pms_parts = preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
220 if (count($umf_parts) == 2) {
221 $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
223 if (count($pms_parts) == 2) {
224 $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
228 $max_filesize = min($umf, $pms);
230 if (!$max_filesize) {
231 $max_filesize = max($umf, $pms);
234 return $max_filesize;
static initFileUpload()
Initializes the file upload and loads the needed javascripts and styles.
if(isset($_REQUEST['delete'])) $list
static normalizeUtf8String($a_str)
Normalize UTF8 string.
special template class to simplify handling of ITX/PEAR
static isUploadPossible($a_additional_size=null)
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template