ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ($file)
 Upload the file. More...
 
 deleteCurrentFile ()
 Delete the existing file. More...
 
 getFilePath ()
 Get the path of 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)
 

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 10 of file class.ilIndividualAssessmentFileStorage.php.

Member Function Documentation

◆ create()

ilIndividualAssessmentFileStorage::create ( )

creates the folder structure

Returns
boolen

Implements IndividualAssessmentFileStorage.

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

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

Referenced by readDir().

65  {
66  if (!file_exists($this->getAbsolutePath())) {
68  }
69  return true;
70  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
+ 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 137 of file class.ilIndividualAssessmentFileStorage.php.

References $files, ilFileSystemStorage\deleteFile(), getAbsolutePath(), and readDir().

138  {
139  $files = $this->readDir();
140  $this->deleteFile($this->getAbsolutePath() . "/" . $files[0]);
141  }
$files
Definition: add-vimline.php:18
deleteFile($a_abs_name)
Delete file.
+ 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 159 of file class.ilIndividualAssessmentFileStorage.php.

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

160  {
161  $this->deleteFile($this->getAbsolutePath() . "/" . $file_name);
162  }
deleteFile($a_abs_name)
Delete file.
+ Here is the call graph for this function:

◆ getAbsolutePath()

ilIndividualAssessmentFileStorage::getAbsolutePath ( )

Get the absolute path for files.

Returns
string

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

References ilFileSystemStorage\$path.

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

78  {
79  $path = parent::getAbsolutePath();
80 
81  if ($this->user_id) {
82  $path .= "/user_" . $this->user_id;
83  }
84 
85  return $path;
86  }
+ Here is the caller graph for this function:

◆ getFilePath()

ilIndividualAssessmentFileStorage::getFilePath ( )

Get the path of file.

Returns
sgtring

Implements IndividualAssessmentFileStorage.

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

References $files, getAbsolutePath(), and readDir().

149  {
150  $files = $this->readDir();
151  return $this->getAbsolutePath() . "/" . $files[0];
152  }
$files
Definition: add-vimline.php:18
+ Here is the call graph for this function:

◆ getInstance()

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

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

Referenced by ilObjIndividualAssessment\getFileStorage().

13  {
14  return new self(self::STORAGE_SECURED, true, $a_container_id);
15  }
+ Here is the caller graph for this function:

◆ getPathPostfix()

ilIndividualAssessmentFileStorage::getPathPostfix ( )
protected

part of the folder structure in ILIAS webdir.

Returns
string

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

23  {
24  return 'iass';
25  }

◆ getPathPrefix()

ilIndividualAssessmentFileStorage::getPathPrefix ( )
protected

part of the folder structure in ILIAS webdir.

Returns
string

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

33  {
34  return 'ilIndividualAssessment';
35  }

◆ isEmpty()

ilIndividualAssessmentFileStorage::isEmpty ( )

Is the webdir folder for this IA empty.

Returns
boolean

Implements IndividualAssessmentFileStorage.

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

References $files, and readDir().

43  {
44  $files = $this->readDir();
45 
46  return (count($files) == 0) ? true : false;
47  }
$files
Definition: add-vimline.php:18
+ Here is the call graph for this function:

◆ readDir()

ilIndividualAssessmentFileStorage::readDir ( )

Read the dir.

Returns
string[]

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

References $fh, $file, $files, array, create(), and getAbsolutePath().

Referenced by deleteCurrentFile(), getFilePath(), and isEmpty().

94  {
95  if (!is_dir($this->getAbsolutePath())) {
96  $this->create();
97  }
98 
99  $fh = opendir($this->getAbsolutePath());
100  $files = array();
101  while ($file = readdir($fh)) {
102  if ($file !="." && $file !=".." && !is_dir($this->getAbsolutePath() . "/" . $file)) {
103  $files[] = $file;
104  }
105  }
106  closedir($fh);
107 
108  return $files;
109  }
$files
Definition: add-vimline.php:18
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 54 of file class.ilIndividualAssessmentFileStorage.php.

55  {
56  $this->user_id = $user_id;
57  }

◆ uploadFile()

ilIndividualAssessmentFileStorage::uploadFile (   $file)

Upload the file.

Parameters
string[]
Returns
boolen

Implements IndividualAssessmentFileStorage.

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

References $file, ilFileSystemStorage\$path, and getAbsolutePath().

119  {
120  $path = $this->getAbsolutePath();
121 
122  $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $file["name"]);
123  $new_file = $path . "/" . $clean_name;
124 
125  ilUtil::moveUploadedFile(
126  $file["tmp_name"],
127  $clean_name, // This parameter does not do a thing
128  $new_file
129  );
130 
131  return true;
132  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

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