ILIAS  release_7 Revision v7.30-3-g800a261c036
ilIndividualAssessmentFileStorage Class Reference

Handles the fileupload and folder creation for files uploaded in grading form. More...

+ Inheritance diagram for ilIndividualAssessmentFileStorage:
+ Collaboration diagram for ilIndividualAssessmentFileStorage:

Public Member Functions

 isEmpty ()
 Is the webdir folder for this IA empty. More...
 
 setUserId ($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 $result)
 Upload the file. More...
 
 deleteCurrentFile ()
 Delete the existing file. More...
 
 getFilePath ()
 Get the path of the file. More...
 
 getFileName ()
 Get the name of the file. More...
 
 deleteFileByName ($file_name)
 Delete a file by name. More...
 
- Public Member Functions inherited from ilFileSystemStorage
 __construct ($a_storage_type, $a_path_conversion, $a_container_id)
 Constructor. More...
 
 getContainerId ()
 
 create ()
 Create directory. More...
 
 getAbsolutePath ()
 Get absolute path of storage directory. More...
 
 writeToFile ($a_data, $a_absolute_path)
 Write data to file. More...
 
 deleteFile ($a_abs_name)
 Delete file. More...
 
 deleteDirectory ($a_abs_name)
 Delete directory. More...
 
 delete ()
 Delete complete directory. More...
 
 copyFile ($a_from, $a_to)
 Copy files. More...
 
 appendToPath ($a_appendix)
 
 getStorageType ()
 
 getPath ()
 Get path. More...
 
 __construct ($a_storage_type, $a_path_conversion, $a_container_id)
 Constructor. More...
 
 create ()
 Create directory. More...
 
 getAbsolutePath ()
 Get absolute path of storage directory. More...
 
 getShortPath ()
 
 rename ($from, $to)
 
 isEmpty ()
 
 deleteCurrentFile ()
 
 getFilePath ()
 
 getFileName ()
 
 uploadFile (UploadResult $file)
 
 create ()
 
 setUserId ($user_id)
 Set user for path creation. More...
 

Static Public Member Functions

static getInstance ($a_container_id=0)
 
- Static Public Member Functions inherited from ilFileSystemStorage
static _createPathFromId ($a_container_id, $a_name)
 Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5. More...
 
static _copyDirectory ($a_source, $a_target)
 Copy directory and all contents. More...
 
static _createPathFromId ($a_container_id, $a_name)
 Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5. More...
 

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 ilFileSystemStorage
 getPathPrefix ()
 Get path prefix. More...
 
 getPathPostfix ()
 Get directory name. More...
 
 init ()
 Read path info. More...
 
 getPathPrefix ()
 Get path prefix. More...
 
 getPathPostfix ()
 Get directory name. More...
 

Additional Inherited Members

- Data Fields inherited from ilFileSystemStorage
const STORAGE_WEB = 1
 
const STORAGE_DATA = 2
 
const STORAGE_SECURED = 3
 
const FACTOR = 100
 
const MAX_EXPONENT = 3
 
const SECURED_DIRECTORY = "sec"
 
- Protected Attributes inherited from ilFileSystemStorage
 $path
 

Detailed Description

Handles the fileupload and folder creation for files uploaded in grading form.

Author
Stefan Hecken stefa.nosp@m.n.he.nosp@m.cken@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de

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

Member Function Documentation

◆ create()

ilIndividualAssessmentFileStorage::create ( )

creates the folder structure

Returns
boolean

Implements IndividualAssessmentFileStorage.

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

68 {
69 if (!file_exists($this->getAbsolutePath())) {
71 }
72 return true;
73 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.

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

Referenced by readDir().

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

◆ deleteCurrentFile()

ilIndividualAssessmentFileStorage::deleteCurrentFile ( )

Delete the existing file.

Implements IndividualAssessmentFileStorage.

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

142 {
143 $this->deleteFile($this->getFilePath());
144 }
deleteFile($a_abs_name)
Delete file.

References ilFileSystemStorage\deleteFile(), and getFilePath().

+ Here is the call graph for this function:

◆ deleteFileByName()

ilIndividualAssessmentFileStorage::deleteFileByName (   $file_name)

Delete a file by name.

Parameters
string$file_name

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

173 {
174 $this->deleteFile($this->getAbsolutePath() . "/" . $file_name);
175 }

References ilFileSystemStorage\deleteFile(), and getAbsolutePath().

+ Here is the call graph for this function:

◆ getAbsolutePath()

ilIndividualAssessmentFileStorage::getAbsolutePath ( )

Get the absolute path for files.

Returns
string

Reimplemented from ilFileSystemStorage.

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

81 {
82 $path = parent::getAbsolutePath();
83
84 if ($this->user_id) {
85 $path .= "/user_" . $this->user_id;
86 }
87
88 return $path;
89 }

References ilFileSystemStorage\$path.

Referenced by create(), deleteFileByName(), getFilePath(), readDir(), and uploadFile().

+ Here is the caller graph for this function:

◆ getFileName()

ilIndividualAssessmentFileStorage::getFileName ( )

Get the name of the file.

Returns
string

Implements IndividualAssessmentFileStorage.

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

162 {
163 $files = $this->readDir();
164 return $files[0];
165 }

References readDir().

Referenced by getFilePath().

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

◆ getFilePath()

ilIndividualAssessmentFileStorage::getFilePath ( )

Get the path of the file.

Returns
string

Implements IndividualAssessmentFileStorage.

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

152 {
153 return $this->getAbsolutePath() . "/" . $this->getFileName();
154 }

References getAbsolutePath(), and getFileName().

Referenced by deleteCurrentFile().

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

◆ getInstance()

static ilIndividualAssessmentFileStorage::getInstance (   $a_container_id = 0)
static

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

16 {
17 return new self(self::STORAGE_WEB, true, $a_container_id);
18 }

References ilFileSystemStorage\STORAGE_WEB.

Referenced by ilObjIndividualAssessment\getFileStorage().

+ Here is the caller graph for this function:

◆ getPathPostfix()

ilIndividualAssessmentFileStorage::getPathPostfix ( )
protected

part of the folder structure in ILIAS webdir.

Returns
string

Reimplemented from ilFileSystemStorage.

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

26 {
27 return 'iass';
28 }

◆ getPathPrefix()

ilIndividualAssessmentFileStorage::getPathPrefix ( )
protected

part of the folder structure in ILIAS webdir.

Returns
string

Reimplemented from ilFileSystemStorage.

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

36 {
37 return 'IASS';
38 }

◆ isEmpty()

ilIndividualAssessmentFileStorage::isEmpty ( )

Is the webdir folder for this IA empty.

Returns
boolean

Implements IndividualAssessmentFileStorage.

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

46 {
47 $files = $this->readDir();
48
49 return (count($files) == 0) ? true : false;
50 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

References readDir(), and true.

+ Here is the call graph for this function:

◆ readDir()

ilIndividualAssessmentFileStorage::readDir ( )

Read the dir.

Returns
string[]

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

97 {
98 if (!is_dir($this->getAbsolutePath())) {
99 $this->create();
100 }
101
102 $fh = opendir($this->getAbsolutePath());
103 $files = array();
104 while ($file = readdir($fh)) {
105 if ($file != "." && $file != ".." && !is_dir($this->getAbsolutePath() . "/" . $file)) {
106 $files[] = $file;
107 }
108 }
109 closedir($fh);
110
111 return $files;
112 }

References create(), and getAbsolutePath().

Referenced by getFileName(), and isEmpty().

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

◆ setUserId()

ilIndividualAssessmentFileStorage::setUserId (   $user_id)

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

Parameters
int$user_id

Implements IndividualAssessmentFileStorage.

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

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

Referenced by ilIndividualAssessmentMemberGUI\getUserFileStorage().

+ Here is the caller graph for this function:

◆ uploadFile()

ilIndividualAssessmentFileStorage::uploadFile ( UploadResult  $result)

Upload the file.

Parameters
UploadResult$result
Returns
bool
Exceptions
ilException

Implements IndividualAssessmentFileStorage.

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

123 {
124 $path = $this->getAbsolutePath();
125
126 $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $result->getName());
127 $new_file = $path . "/" . $clean_name;
128
130 $result->getPath(),
131 $clean_name, // This parameter does not do a thing
132 $new_file
133 );
134
135 return true;
136 }
$result
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

References ilFileSystemStorage\$path, $result, getAbsolutePath(), and ilUtil\moveUploadedFile().

+ Here is the call graph for this function:

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