ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilIndividualAssessmentFileStorage Class Reference
+ Inheritance diagram for ilIndividualAssessmentFileStorage:
+ Collaboration diagram for ilIndividualAssessmentFileStorage:

Public Member Functions

 setUserId (int $user_id)
 Set the user id for an extra folder of each participant in the IA. More...
 
 create ()
 creates the folder structure More...
 
 getAbsolutePath ()
 Get the absolute path for files. More...
 
 readDir ()
 Read the dir. More...
 
 uploadFile (UploadResult $file)
 Upload the file. More...
 
 deleteAllFilesBut (?string $filename)
 Delete the existing file. More...
 
- Public Member Functions inherited from ilFileSystemAbstractionStorage
 __construct (private int $storage_type, private bool $path_conversion, private int $container_id)
 Constructor. More...
 
 fileExists (string $a_absolute_path)
 
 getContainerId ()
 
 writeToFile (string $a_data, $a_absolute_path)
 
 copyFile (string $a_from, string $a_to)
 
 create ()
 
 getAbsolutePath ()
 Calculates the full path on the filesystem. More...
 
 delete ()
 
 deleteDirectory (string $a_abs_name)
 
 deleteFile (string $a_abs_name)
 
 appendToPath (string $a_appendix)
 
 getStorageType ()
 
 getPath ()
 
- Public Member Functions inherited from IndividualAssessmentFileStorage
 deleteAllFilesBut (string $file)
 
 uploadFile (UploadResult $file)
 
 create ()
 
 setUserId (int $user_id)
 

Static Public Member Functions

static getInstance (int $container_id=0)
 
- Static Public Member Functions inherited from ilFileSystemAbstractionStorage
static createPathFromId (int $a_container_id, string $a_name)
 
static _copyDirectory (string $a_sdir, string $a_tdir)
 

Data Fields

const PATH_POSTFIX = "iass"
 
const PATH_PREFIX = "IASS"
 
- Data Fields inherited from ilFileSystemAbstractionStorage
const STORAGE_WEB = 1
 
const STORAGE_DATA = 2
 
const STORAGE_SECURED = 3
 

Protected Member Functions

 getPathPostfix ()
 part of the folder structure in ILIAS webdir. More...
 
 getPathPrefix ()
 part of the folder structure in ILIAS webdir. More...
 
- Protected Member Functions inherited from ilFileSystemAbstractionStorage
 getLegacyFullAbsolutePath (string $relative_path)
 
 getFileSystemService ()
 
 getPathPrefix ()
 Get path prefix. More...
 
 getPathPostfix ()
 Get directory name. More...
 
 getLegacyAbsolutePath ()
 Calculates the absolute filesystem storage location. More...
 
 init ()
 

Protected Attributes

int $user_id = null
 
- Protected Attributes inherited from ilFileSystemAbstractionStorage
string $path = null
 
Filesystems $file_system_service
 

Detailed Description

Deprecated:
in favor of ResourceStorage. This class is only used for migration.

Definition at line 26 of file class.ilIndividualAssessmentFileStorage.php.

Member Function Documentation

◆ create()

ilIndividualAssessmentFileStorage::create ( )

creates the folder structure

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 65 of file class.ilIndividualAssessmentFileStorage.php.

65 : void
66 {
67 if (!file_exists($this->getAbsolutePath())) {
69 }
70 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

References getAbsolutePath(), and ilFileUtils\makeDirParents().

Referenced by readDir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllFilesBut()

ilIndividualAssessmentFileStorage::deleteAllFilesBut ( ?string  $filename)

Delete the existing file.

Definition at line 131 of file class.ilIndividualAssessmentFileStorage.php.

131 : void
132 {
133 $files = $this->readDir();
134 foreach ($files as $file) {
135 if ($file === $filename) {
136 continue;
137 }
138 $this->deleteFile($this->getAbsolutePath() . "/" . $file);
139 }
140 }
$filename
Definition: buildRTE.php:78

References $filename, ilFileSystemAbstractionStorage\deleteFile(), getAbsolutePath(), and readDir().

+ Here is the call graph for this function:

◆ getAbsolutePath()

ilIndividualAssessmentFileStorage::getAbsolutePath ( )

Get the absolute path for files.

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 75 of file class.ilIndividualAssessmentFileStorage.php.

75 : string
76 {
77 $path = parent::getAbsolutePath();
78
79 if ($this->user_id) {
80 $path .= "/user_" . $this->user_id;
81 }
82
83 return $path;
84 }

References ilFileSystemAbstractionStorage\$path, and $user_id.

Referenced by create(), deleteAllFilesBut(), readDir(), and uploadFile().

+ Here is the caller graph for this function:

◆ getInstance()

static ilIndividualAssessmentFileStorage::getInstance ( int  $container_id = 0)
static

◆ getPathPostfix()

ilIndividualAssessmentFileStorage::getPathPostfix ( )
protected

part of the folder structure in ILIAS webdir.

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 41 of file class.ilIndividualAssessmentFileStorage.php.

References PATH_POSTFIX.

◆ getPathPrefix()

ilIndividualAssessmentFileStorage::getPathPrefix ( )
protected

part of the folder structure in ILIAS webdir.

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 49 of file class.ilIndividualAssessmentFileStorage.php.

References PATH_PREFIX.

◆ readDir()

ilIndividualAssessmentFileStorage::readDir ( )

Read the dir.

Returns
string[]

Definition at line 91 of file class.ilIndividualAssessmentFileStorage.php.

91 : array
92 {
93 if (!is_dir($this->getAbsolutePath())) {
94 $this->create();
95 }
96
97 $fh = opendir($this->getAbsolutePath());
98 $files = array();
99 while ($file = readdir($fh)) {
100 if ($file != "." && $file != ".." && !is_dir($this->getAbsolutePath() . "/" . $file)) {
101 $files[] = $file;
102 }
103 }
104 closedir($fh);
105
106 return $files;
107 }

References create(), and getAbsolutePath().

Referenced by deleteAllFilesBut().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUserId()

ilIndividualAssessmentFileStorage::setUserId ( int  $user_id)

Set the user id for an extra folder of each participant in the IA.

Implements IndividualAssessmentFileStorage.

Definition at line 57 of file class.ilIndividualAssessmentFileStorage.php.

57 : void
58 {
59 $this->user_id = $user_id;
60 }

References $user_id.

◆ uploadFile()

ilIndividualAssessmentFileStorage::uploadFile ( UploadResult  $file)

Upload the file.

Implements IndividualAssessmentFileStorage.

Definition at line 112 of file class.ilIndividualAssessmentFileStorage.php.

112 : string
113 {
114 $path = $this->getAbsolutePath();
115
116 $clean_name = ilFileUtils::getValidFilename($file->getName());
117 $new_file = $path . "/" . $clean_name;
118
120 $file->getPath(),
121 $clean_name, // This parameter does not do a thing
122 $new_file
123 );
124
125 return $clean_name;
126 }
static getValidFilename(string $a_filename)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file

References ilFileSystemAbstractionStorage\$path, getAbsolutePath(), ILIAS\FileUpload\DTO\UploadResult\getName(), ILIAS\FileUpload\DTO\UploadResult\getPath(), ilFileUtils\getValidFilename(), and ilFileUtils\moveUploadedFile().

+ Here is the call graph for this function:

Field Documentation

◆ $user_id

int ilIndividualAssessmentFileStorage::$user_id = null
protected

Definition at line 31 of file class.ilIndividualAssessmentFileStorage.php.

Referenced by getAbsolutePath(), and setUserId().

◆ PATH_POSTFIX

const ilIndividualAssessmentFileStorage::PATH_POSTFIX = "iass"

Definition at line 28 of file class.ilIndividualAssessmentFileStorage.php.

Referenced by getPathPostfix().

◆ PATH_PREFIX

const ilIndividualAssessmentFileStorage::PATH_PREFIX = "IASS"

Definition at line 29 of file class.ilIndividualAssessmentFileStorage.php.

Referenced by getPathPrefix().


The documentation for this class was generated from the following file: