Class ilCloudPluginUploadGUI.
More...
|
| uploadDirectory ($dir, $parent_id, $file_tree, $keep_structure=true) |
| Recursive Method to upload a directory. More...
|
|
Class ilCloudPluginUploadGUI.
Standard class for uploading files. Can be overwritten if needed.
- Author
- Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
- Version
- $Id:
Definition at line 17 of file class.ilCloudPluginUploadGUI.php.
◆ asyncUploadFile()
ilCloudPluginUploadGUI::asyncUploadFile |
( |
| ) |
|
Definition at line 44 of file class.ilCloudPluginUploadGUI.php.
References $_POST, $_SESSION, $DIC, ilJsonUtil\encode(), exit, and initUploadForm().
47 $ilTabs = $DIC[
'ilTabs'];
49 $ilTabs->activateTab(
"content");
51 echo $this->form->getHTML();
53 $options =
new stdClass();
54 $options->dropZone =
"#ilFileUploadDropZone_1";
55 $options->fileInput =
"#ilFileUploadInput_1";
56 $options->submitButton =
"uploadFiles";
57 $options->cancelButton =
"cancelAll";
58 $options->dropArea =
"#ilFileUploadDropArea_1";
59 $options->fileList =
"#ilFileUploadList_1";
60 $options->fileSelectButton =
"#ilFileUploadFileSelect_1";
61 echo
"<script language='javascript' type='text/javascript'>var fileUpload1 = new ilFileUpload(1, " .
ilJsonUtil::encode($options) .
");</script>";
static encode($mixed, $suppress_native=false)
◆ cancelAll()
ilCloudPluginUploadGUI::cancelAll |
( |
| ) |
|
Definition at line 101 of file class.ilCloudPluginUploadGUI.php.
References exit.
103 echo
"<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterUpload('cancel');</script>";
◆ executeCommand()
ilCloudPluginUploadGUI::executeCommand |
( |
| ) |
|
◆ handleFileUpload()
ilCloudPluginUploadGUI::handleFileUpload |
( |
|
$file_upload | ) |
|
Definition at line 141 of file class.ilCloudPluginUploadGUI.php.
References $_POST, $_SESSION, Vendor\Package\$e, $response, ilUtil\delDir(), exit, ilCloudFileTree\getFileTreeFromSession(), ilUtil\ilTempnam(), ilUtil\makeDir(), ilFileUtils\processZipFile(), and uploadDirectory().
Referenced by uploadFiles().
146 $response->fileSize = intval($file_upload[
"size"]);
147 $response->fileType = $file_upload[
"type"];
148 $response->fileUnzipped = $file_upload[
"extract"];
153 if ($file_upload[
"extract"]) {
157 include_once
'./Services/Utilities/classes/class.ilFileUtils.php';
178 $file_tree->uploadFileToService(
$_SESSION[
"cld_folder_id"], $file_upload[
"tmp_name"],
$_POST[
"title"]);
static getFileTreeFromSession()
uploadDirectory($dir, $parent_id, $file_tree, $keep_structure=true)
Recursive Method to upload a directory.
static processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
◆ initUploadForm()
ilCloudPluginUploadGUI::initUploadForm |
( |
| ) |
|
Definition at line 69 of file class.ilCloudPluginUploadGUI.php.
References $DIC, $ilCtrl, $lng, ilUtil\getImagePath(), and ilFormPropertyGUI\setRequired().
Referenced by asyncUploadFile(), and uploadFiles().
75 include_once(
"./Services/Form/classes/class.ilDragDropFileInputGUI.php");
76 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
79 $this->form->setId(
"upload");
80 $this->form->setMultipart(
true);
81 $this->form->setHideLabels();
85 $this->form->addItem($file);
87 $this->form->addCommandButton(
"uploadFiles",
$lng->txt(
"upload"));
88 $this->form->addCommandButton(
"cancelAll",
$lng->txt(
"cancel"));
90 $this->form->setTableWidth(
"100%");
91 $this->form->setTitle(
$lng->txt(
"upload_files_title"));
95 $this->form->setTitle(
$lng->txt(
"upload_files"));
96 $this->form->setFormAction(
$ilCtrl->getFormAction($this,
"uploadFiles"));
97 $this->form->setTarget(
"cld_blank_target");
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
◆ uploadDirectory()
ilCloudPluginUploadGUI::uploadDirectory |
( |
|
$dir, |
|
|
|
$parent_id, |
|
|
|
$file_tree, |
|
|
|
$keep_structure = true |
|
) |
| |
|
protected |
Recursive Method to upload a directory.
- Parameters
-
string | $dir | path to directory |
int | $parent_id | id of parent folder |
ilCloudFileTree | $file_tree | |
bool | $keep_structure | if false, only files will be extracted, without folder structure |
- Exceptions
-
Definition at line 195 of file class.ilCloudPluginUploadGUI.php.
References ilFileUtilsException\$BROKEN_FILE, $DIC, and $lng.
Referenced by handleFileUpload().
197 $dirlist = opendir($dir);
199 while (
false !== ($file = readdir($dirlist))) {
200 if (!is_file($dir .
"/" . $file) && !is_dir($dir .
"/" . $file)) {
205 if ($file !=
'.' && $file !=
'..') {
206 $newpath = $dir .
'/' . $file;
207 if (is_dir($newpath)) {
208 if ($keep_structure) {
209 $newnode = $file_tree->addFolderToService($parent_id, basename($newpath));
215 $file_tree->uploadFileToService($parent_id, $newpath, basename($newpath));
uploadDirectory($dir, $parent_id, $file_tree, $keep_structure=true)
Recursive Method to upload a directory.
◆ uploadFiles()
ilCloudPluginUploadGUI::uploadFiles |
( |
| ) |
|
◆ $form
ilCloudPluginUploadGUI::$form |
|
protected |
The documentation for this class was generated from the following file: