ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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...
 
 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
 
- 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
Version
$Id$

Definition at line 12 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 22 of file class.ilFSWebStorageExercise.php.

23 {
24 $this->ass_id = $a_ass_id;
25 $this->log = ilLoggerFactory::getLogger("exc");
26 $this->log->debug("ilFSWebStorageExercise construct with a_container_id = " . $a_container_id . " and ass_id =" . $a_ass_id);
27 parent::__construct(self::STORAGE_WEB, true, $a_container_id);
28 }
static getLogger($a_component_id)
Get component logger.

References ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilFSWebStorageExercise::create ( )

Create directory.

@access public

Reimplemented from ilFileSystemStorage.

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

77 {
78 $this->log->debug("parent create");
79
80 parent::create();
81
82 return true;
83 }

◆ getAssignmentFilePath()

ilFSWebStorageExercise::getAssignmentFilePath (   $a_file)

Get path for assignment file.

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

121 {
122 return $this->getAbsolutePath() . "/" . $a_file;
123 }
getAbsolutePath()
Get absolute path of storage directory.

References ilFileSystemStorage\getAbsolutePath().

+ Here is the call graph for this function:

◆ getFiles()

ilFSWebStorageExercise::getFiles ( )

Get assignment files.

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

89 {
90 require_once "./Modules/Exercise/classes/class.ilExAssignment.php";
91
92 $ass = new ilExAssignment($this->ass_id);
93 $files_order = $ass->getInstructionFilesOrder();
94
95 $files = array();
96 if (!is_dir($this->path)) {
97 return $files;
98 }
99
100 $dp = opendir($this->path);
101 while ($file = readdir($dp)) {
102 if (!is_dir($this->path . '/' . $file)) {
103 $files[] = array(
104 'name' => $file,
105 'size' => filesize($this->path . '/' . $file),
106 'ctime' => filectime($this->path . '/' . $file),
107 'fullpath' => $this->path . '/' . $file,
108 'order' => $files_order[$file]["order_nr"] ? $files_order[$file]["order_nr"] : 0
109 );
110 }
111 }
112 closedir($dp);
113 $files = ilUtil::sortArray($files, "order", "asc", true);
114 return $files;
115 }
$files
Definition: add-vimline.php:18
Exercise assignment.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $files, and ilUtil\sortArray().

+ Here is the call graph for this function:

◆ getPathPostfix()

ilFSWebStorageExercise::getPathPostfix ( )
protected

Implementation of abstract method.

@access protected

Reimplemented from ilFileSystemStorage.

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

55 {
56 return 'exc';
57 }

◆ getPathPrefix()

ilFSWebStorageExercise::getPathPrefix ( )
protected

Implementation of abstract method.

@access protected

Reimplemented from ilFileSystemStorage.

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

66 {
67 return 'ilExercise';
68 }

◆ init()

ilFSWebStorageExercise::init ( )

Append ass_<ass_id> to path (assignment id)

Reimplemented from ilFileSystemStorage.

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

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

References $ass_id.

◆ uploadAssignmentFiles()

ilFSWebStorageExercise::uploadAssignmentFiles (   $a_files)

Upload assignment files (e.g.

from assignment creation form)

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

131 {
132 if (is_array($a_files["name"])) {
133 foreach ($a_files["name"] as $k => $name) {
134 if ($name != "") {
135 $type = $a_files["type"][$k];
136 $tmp_name = $a_files["tmp_name"][$k];
137 $size = $a_files["size"][$k];
138 ilUtil::moveUploadedFile(
139 $tmp_name,
140 basename($name),
141 $this->path . DIRECTORY_SEPARATOR . basename($name),
142 false
143 );
144 }
145 }
146 }
147 }
$size
Definition: RandomTest.php:84
if($format !==null) $name
Definition: metadata.php:146
$type

References $name, $size, and $type.

Field Documentation

◆ $ass_id

ilFSWebStorageExercise::$ass_id
protected

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

Referenced by init().

◆ $log

ilFSWebStorageExercise::$log
protected

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


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