25 protected \ILIAS\FileUpload\FileUpload
$upload;
34 int $a_container_id = 0,
39 $this->ass_id = $a_ass_id;
41 $this->
upload = $DIC->upload();
52 public function init(): bool
55 if ($this->ass_id > 0) {
57 $this->relative_submission_path = $this->path .
"/subm_" .
$this->ass_id;
94 $path = $this->feedb_path .
"/" . $a_user_id;
95 if (!file_exists(
$path)) {
103 $path = $this->feedb_path .
"/0";
104 if (!file_exists(
$path)) {
117 $path = $this->multi_feedback_upload_path .
"/" . $a_user_id;
118 if (!file_exists(
$path)) {
131 ?
int $a_crit_id = null
133 $path = $this->peer_review_upload_path .
"/" . $a_peer_id .
"/" . $a_giver_id .
"/";
135 if ((
int) $a_crit_id !== 0) {
138 if (!file_exists(
$path)) {
150 if (!file_exists($this->submission_path)) {
153 if (!file_exists($this->tmp_path)) {
156 if (!file_exists($this->feedb_path)) {
164 if (!is_dir($this->path)) {
168 $dp = opendir($this->path);
169 while ($file = readdir($dp)) {
170 if (!is_dir($this->path .
'/' . $file)) {
173 'size' => filesize($this->path .
'/' . $file),
174 'ctime' => filectime($this->path .
'/' . $file),
175 'fullpath' => $this->path .
'/' . $file);
198 array $a_http_post_file,
200 bool $is_unziped =
false 208 if (isset($a_http_post_file) && $a_http_post_file[
'size']) {
216 $savepath .=
'/' . $user_id;
217 if (!is_dir($savepath)) {
222 if (!is_dir($savepath)) {
227 "%04d%02d%02d%02d%02d%02d",
238 $a_http_post_file[
"tmp_name"],
240 $savepath .
"/" . $prefix .
"_" . $filename
244 $a_http_post_file[
'tmp_name'],
245 $savepath .
"/" . $prefix .
"_" .
$filename 249 if (is_file($savepath .
"/" . $prefix .
"_" .
$filename)) {
251 "filename" => $prefix .
"_" . $filename,
252 "fullname" => $savepath .
"/" . $prefix .
"_" . $filename,
266 $filename = preg_replace(
"/\s/",
"_", $filename);
267 $filename = (new \ilFileServicesPolicy($DIC->fileServiceSettings()))->ascii($filename);
269 $filename = preg_replace(
"/[^_a-zA-Z0-9\.]/",
"", $filename);
283 \
ILIAS\FileUpload\DTO\UploadResult $result,
292 $savepath .=
'/' . $user_id;
296 "%04d%02d%02d%02d%02d%02d",
305 $this->
upload->moveOneFileTo(
308 \
ILIAS\FileUpload\Location::STORAGE,
314 "filename" => $prefix .
"_" . $filename,
315 "fullname" => $savepath .
"/" . $prefix .
"_" . $filename,
316 "mimetype" => $result->getMimeType()
330 if ($a_user_id ===
"t") {
337 while ($file = readdir($dp)) {
338 if (!is_dir($this->path .
'/' . $file) && substr($file, 0, 1) !=
".") {
363 return $dir .
"/" . $a_file;
372 if (is_array($a_files[
"name"])) {
373 foreach ($a_files[
"name"] as $k => $name) {
375 $tmp_name = $a_files[
"tmp_name"][$k];
getFeedbackPath(string $a_user_id)
getStorageFilename(string $filename)
getAbsoluteSubmissionPath()
init()
Append ass_<ass_id> to path (assignment id)
addFileUpload(\ILIAS\FileUpload\DTO\UploadResult $result, int $user_id)
store delivered file in filesystem
getMultiFeedbackUploadPath(int $a_user_id)
Get multi feedback upload path (each uploader handled in a separate path)
Class ChatMainBarProvider .
getFeedbackFilePath(string $a_user_id, string $a_file)
static getValidFilename(string $a_filename)
getPeerReviewUploadPath(int $a_peer_id, int $a_giver_id, ?int $a_crit_id=null)
Get pear review upload path (each peer handled in a separate path)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
countFeedbackFiles(string $a_user_id)
string $multi_feedback_upload_path
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
getAbsolutePath()
Calculates the full path on the filesystem.
__construct(int $a_container_id=0, int $a_ass_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
create()
Create directory.
uploadAssignmentFiles(array $a_files)
static rename(string $a_source, string $a_target)
string $relative_submission_path
getFeedbackFiles(string $a_user_id)
getAssignmentFilePath(string $a_file)
uploadFile(array $a_http_post_file, int $user_id, bool $is_unziped=false)
store delivered file in filesystem
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
ILIAS FileUpload FileUpload $upload
string $peer_review_upload_path
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
getRelativeSubmissionPath()