ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilFSStorageExc5242 Class Reference
+ Collaboration diagram for ilFSStorageExc5242:

Public Member Functions

 __construct ($a_container_id=0, $a_ass_id=0)
 Constructor. More...
 
 getFiles ()
 Get assignment files. More...
 

Static Public Member Functions

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

const FACTOR = 100
 
const MAX_EXPONENT = 3
 

Protected Member Functions

 init ()
 Read path info. More...
 
 getPathPostfix ()
 Implementation of abstract method. More...
 
 getPathPrefix ()
 Implementation of abstract method. More...
 

Protected Attributes

 $path
 

Private Attributes

 $container_id
 
 $path_conversion = false
 

Detailed Description

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
intexercise id

Definition at line 47 of file class.ilFSStorageExc5242.php.

References init().

48  {
49  $this->ass_id = $a_ass_id;
50 
51  $this->path_conversion = true;
52  $this->container_id = $a_container_id;
53 
54  // Get path info
55  $this->init();
56  }
+ Here is the call graph for this function:

Member Function Documentation

◆ _createPathFromId()

static ilFSStorageExc5242::_createPathFromId (   $a_container_id,
  $a_name 
)
static

Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.

Parameters
intcontainer id
stringname

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

References $i, $path, and array.

65  {
66  $path = array();
67  $found = false;
68  $num = $a_container_id;
69  for ($i = self::MAX_EXPONENT; $i > 0;$i--) {
70  $factor = pow(self::FACTOR, $i);
71  if (($tmp = (int) ($num / $factor)) or $found) {
72  $path[] = $tmp;
73  $num = $num % $factor;
74  $found = true;
75  }
76  }
77 
78  if (count($path)) {
79  $path_string = (implode('/', $path) . '/');
80  }
81  return $path_string . $a_name . '_' . $a_container_id;
82  }
Create styles array
The data for the language used.
$i
Definition: disco.tpl.php:19

◆ getFiles()

ilFSStorageExc5242::getFiles ( )

Get assignment files.

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

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

131  {
132  $files = array();
133  if (!is_dir($this->path)) {
134  return $files;
135  }
136 
137  $dp = opendir($this->path);
138  while ($file = readdir($dp)) {
139  if (!is_dir($this->path . '/' . $file)) {
140  $files[] = array(
141  'name' => $file,
142  'size' => filesize($this->path . '/' . $file),
143  'ctime' => filectime($this->path . '/' . $file),
144  'fullpath' => $this->path . '/' . $file);
145  }
146  }
147  closedir($dp);
148  $files = ilUtil::sortArray($files, "name", "asc");
149  return $files;
150  }
$files
Definition: add-vimline.php:18
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
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:

◆ getPathPostfix()

ilFSStorageExc5242::getPathPostfix ( )
protected

Implementation of abstract method.

protected

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

Referenced by init().

113  {
114  return 'exc';
115  }
+ Here is the caller graph for this function:

◆ getPathPrefix()

ilFSStorageExc5242::getPathPrefix ( )
protected

Implementation of abstract method.

protected

Definition at line 123 of file class.ilFSStorageExc5242.php.

Referenced by init().

124  {
125  return 'ilExercise';
126  }
+ Here is the caller graph for this function:

◆ init()

ilFSStorageExc5242::init ( )
protected

Read path info.

private

Definition at line 89 of file class.ilFSStorageExc5242.php.

References getPathPostfix(), getPathPrefix(), and ilUtil\removeTrailingPathSeparators().

Referenced by __construct().

90  {
91  $this->path = CLIENT_DATA_DIR;
92 
93  $this->path = ilUtil::removeTrailingPathSeparators($this->path);
94  $this->path .= '/';
95 
96  // Append path prefix
97  $this->path .= ($this->getPathPrefix() . '/');
98 
99  $this->path .= self::_createPathFromId($this->container_id, $this->getPathPostfix());
100 
101  $this->path.= "/ass_" . $this->ass_id;
102 
103  return true;
104  }
getPathPrefix()
Implementation of abstract method.
getPathPostfix()
Implementation of abstract method.
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $container_id

ilFSStorageExc5242::$container_id
private

Definition at line 37 of file class.ilFSStorageExc5242.php.

◆ $path

ilFSStorageExc5242::$path
protected

Definition at line 40 of file class.ilFSStorageExc5242.php.

Referenced by _createPathFromId().

◆ $path_conversion

ilFSStorageExc5242::$path_conversion = false
private

Definition at line 38 of file class.ilFSStorageExc5242.php.

◆ FACTOR

const ilFSStorageExc5242::FACTOR = 100

Definition at line 34 of file class.ilFSStorageExc5242.php.

◆ MAX_EXPONENT

const ilFSStorageExc5242::MAX_EXPONENT = 3

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


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