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 |
( |
| ) |
|
◆ cancelAll()
ilCloudPluginUploadGUI::cancelAll |
( |
| ) |
|
Definition at line 92 of file class.ilCloudPluginUploadGUI.php.
References exit.
94 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 135 of file class.ilCloudPluginUploadGUI.php.
References $_POST, $_SESSION, ilUtil\delDir(), exit, ilCloudFileTree\getFileTreeFromSession(), ilUtil\ilTempnam(), ilUtil\makeDir(), ilFileUtils\processZipFile(), and uploadDirectory().
Referenced by uploadFiles().
138 $response =
new stdClass();
139 $response->fileName =
$_POST[
"title"];
140 $response->fileSize = intval($file_upload[
"size"]);
141 $response->fileType = $file_upload[
"type"];
142 $response->fileUnzipped = $file_upload[
"extract"];
143 $response->error = null;
147 if ($file_upload[
"extract"])
152 include_once
'./Services/Utilities/classes/class.ilFileUtils.php';
159 $response->error = $e->getMessage();
170 $response->error = $e->getMessage();
180 $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 makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
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
◆ initUploadForm()
ilCloudPluginUploadGUI::initUploadForm |
( |
| ) |
|
Definition at line 64 of file class.ilCloudPluginUploadGUI.php.
References $file, $ilCtrl, $lng, and ilUtil\getImagePath().
Referenced by asyncUploadFile(), and uploadFiles().
68 include_once(
"./Services/Form/classes/class.ilDragDropFileInputGUI.php");
69 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
72 $this->form->setId(
"upload");
73 $this->form->setMultipart(
true);
74 $this->form->setHideLabels();
77 $file->setRequired(
true);
78 $this->form->addItem(
$file);
80 $this->form->addCommandButton(
"uploadFiles", $lng->txt(
"upload"));
81 $this->form->addCommandButton(
"cancelAll", $lng->txt(
"cancel"));
83 $this->form->setTableWidth(
"100%");
84 $this->form->setTitle($lng->txt(
"upload_files_title"));
87 $this->form->setTitle($lng->txt(
"upload_files"));
88 $this->form->setFormAction($ilCtrl->getFormAction($this,
"uploadFiles"));
89 $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, $file, and $lng.
Referenced by handleFileUpload().
196 $dirlist = opendir($dir);
198 while (
false !== (
$file = readdir ($dirlist)))
201 if (!is_file($dir .
"/" .
$file) && !is_dir($dir .
"/" . $file))
206 if ($file !=
'.' && $file !=
'..')
208 $newpath = $dir.
'/'.
$file;
209 if (is_dir($newpath))
213 $newnode = $file_tree->addFolderToService($parent_id, basename($newpath));
223 $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 |
( |
| ) |
|
Update properties.
Definition at line 102 of file class.ilCloudPluginUploadGUI.php.
References ilJsonUtil\encode(), exit, handleFileUpload(), initUploadForm(), and ilCloudException\UPLOAD_FAILED.
104 $response =
new stdClass();
105 $response->error = null;
106 $response->debug = null;
109 if ($this->form->checkInput())
113 $fileresult = $this->
handleFileUpload($this->form->getInput(
"upload_files"));
116 $response = (object)array_merge((array)$response, (array)$fileresult);
120 $response->error = $e->getMessage();
125 $response->error = $error->getMessage();
129 header(
'Vary: Accept');
130 header(
'Content-type: text/plain');
Base class for ILIAS Exception handling.
static encode($mixed, $suppress_native=false)
handleFileUpload($file_upload)
◆ $form
ilCloudPluginUploadGUI::$form |
|
protected |
The documentation for this class was generated from the following file: