ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFSWebStorageExercise Class Reference
+ Inheritance diagram for ilFSWebStorageExercise:
+ Collaboration diagram for ilFSWebStorageExercise:

Public Member Functions

 __construct ($a_container_id=0, $a_ass_id=0)
 Constructor. More...
 
 init ()
 Append ass_<ass_id> to path (assignment id) More...
 
 create ()
 Create directory. More...
 
 deleteUserSubmissionDirectory (int $user_id)
 
 getFiles ()
 Get assignment files. More...
 
 getAssignmentFilePath ($a_file)
 Get path for assignment file. More...
 
 uploadAssignmentFiles ($a_files)
 Upload assignment files (e.g. 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)
 

Protected Member Functions

 getPathPostfix ()
 Implementation of abstract method. More...
 
 getPathPrefix ()
 Implementation of abstract method. 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...
 

Protected Attributes

 $log
 
 $ass_id
 
 $submissions_path
 
- Protected Attributes inherited from ilFileSystemStorage
 $path
 

Additional Inherited Members

- 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...
 
- 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"
 

Detailed Description

Author
Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 10 of file class.ilFSWebStorageExercise.php.

Constructor & Destructor Documentation

◆ __construct()

ilFSWebStorageExercise::__construct (   $a_container_id = 0,
  $a_ass_id = 0 
)

Constructor.

Parameters
intassingment id

Definition at line 21 of file class.ilFSWebStorageExercise.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilLoggerFactory\getLogger().

22  {
23  $this->ass_id = $a_ass_id;
24  $this->log = ilLoggerFactory::getLogger("exc");
25  $this->log->debug("ilFSWebStorageExercise construct with a_container_id = " . $a_container_id . " and ass_id =" . $a_ass_id);
26  parent::__construct(self::STORAGE_WEB, true, $a_container_id);
27  }
__construct(Container $dic, ilPlugin $plugin)
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilFSWebStorageExercise::create ( )

Create directory.

public

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

Referenced by ilExAssignment\cloneAssignmentsOfExercise(), ilExAssignmentEditorGUI\executeCommand(), and ilExerciseDataSet\importRecord().

78  {
79  $this->log->debug("parent create");
80 
81  parent::create();
82 
83  return true;
84  }
+ Here is the caller graph for this function:

◆ deleteUserSubmissionDirectory()

ilFSWebStorageExercise::deleteUserSubmissionDirectory ( int  $user_id)

Definition at line 86 of file class.ilFSWebStorageExercise.php.

Referenced by ilExerciseManagementGUI\removeUserSubmissionFilesFromWebDir().

86  : void
87  {
88  $internal_dir = $this->submissions_path . "/" . $user_id;
89 
90  //remove first dot from (./data/client/ilExercise/3/exc_318/subm_21/6)
91  $internal_dir_without_dot = substr($internal_dir, 1);
92 
93  $absolute_path = ILIAS_ABSOLUTE_PATH . $internal_dir_without_dot;
94 
95  if (is_dir($absolute_path)) {
96  parent::deleteDirectory($absolute_path);
97  $this->log->debug("Removed = " . $absolute_path);
98  }
99  }
+ Here is the caller graph for this function:

◆ getAssignmentFilePath()

ilFSWebStorageExercise::getAssignmentFilePath (   $a_file)

Get path for assignment file.

Definition at line 134 of file class.ilFSWebStorageExercise.php.

References ilFileSystemStorage\getAbsolutePath().

135  {
136  return $this->getAbsolutePath() . "/" . $a_file;
137  }
getAbsolutePath()
Get absolute path of storage directory.
+ Here is the call graph for this function:

◆ getFiles()

ilFSWebStorageExercise::getFiles ( )

Get assignment files.

Definition at line 104 of file class.ilFSWebStorageExercise.php.

References ilUtil\sortArray().

105  {
106  $ass = new ilExAssignment($this->ass_id);
107  $files_order = $ass->getInstructionFilesOrder();
108 
109  $files = array();
110  if (!is_dir($this->path)) {
111  return $files;
112  }
113 
114  $dp = opendir($this->path);
115  while ($file = readdir($dp)) {
116  if (!is_dir($this->path . '/' . $file)) {
117  $files[] = array(
118  'name' => $file,
119  'size' => filesize($this->path . '/' . $file),
120  'ctime' => filectime($this->path . '/' . $file),
121  'fullpath' => $this->path . '/' . $file,
122  'order' => $files_order[$file]["order_nr"] ? $files_order[$file]["order_nr"] : 0
123  );
124  }
125  }
126  closedir($dp);
127  $files = ilUtil::sortArray($files, "order", "asc", true);
128  return $files;
129  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
Exercise assignment.
+ Here is the call graph for this function:

◆ getPathPostfix()

ilFSWebStorageExercise::getPathPostfix ( )
protected

Implementation of abstract method.

protected

Definition at line 55 of file class.ilFSWebStorageExercise.php.

56  {
57  return 'exc';
58  }

◆ getPathPrefix()

ilFSWebStorageExercise::getPathPrefix ( )
protected

Implementation of abstract method.

protected

Definition at line 66 of file class.ilFSWebStorageExercise.php.

67  {
68  return 'ilExercise';
69  }

◆ init()

ilFSWebStorageExercise::init ( )

Append ass_<ass_id> to path (assignment id)

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

References $ass_id.

33  {
34  if (parent::init()) {
35  if ($this->ass_id > 0) {
36  $this->submissions_path = $this->path . "/subm_" . $this->ass_id;
37 
38  $this->log->debug("parent init() with ass_id =" . $this->ass_id);
39  $this->path .= "/ass_" . $this->ass_id;
40  }
41  } else {
42  $this->log->debug("no parent init() without ass_id");
43  return false;
44  }
45  return true;
46  }

◆ uploadAssignmentFiles()

ilFSWebStorageExercise::uploadAssignmentFiles (   $a_files)

Upload assignment files (e.g.

from assignment creation form)

Definition at line 144 of file class.ilFSWebStorageExercise.php.

References $name, $size, $type, and ilUtil\moveUploadedFile().

145  {
146  if (is_array($a_files["name"])) {
147  foreach ($a_files["name"] as $k => $name) {
148  if ($name != "") {
149  $type = $a_files["type"][$k];
150  $tmp_name = $a_files["tmp_name"][$k];
151  $size = $a_files["size"][$k];
153  $tmp_name,
154  basename($name),
155  $this->path . DIRECTORY_SEPARATOR . basename($name),
156  false
157  );
158  }
159  }
160  }
161  }
$size
Definition: RandomTest.php:84
$type
if($format !==null) $name
Definition: metadata.php:230
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:

Field Documentation

◆ $ass_id

ilFSWebStorageExercise::$ass_id
protected

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

Referenced by init().

◆ $log

ilFSWebStorageExercise::$log
protected

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

◆ $submissions_path

ilFSWebStorageExercise::$submissions_path
protected

Definition at line 14 of file class.ilFSWebStorageExercise.php.


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