ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExportImportDirectory Class Reference

Import directory. More...

+ Inheritance diagram for ilExportImportDirectory:
+ Collaboration diagram for ilExportImportDirectory:

Public Member Functions

 hasFilesFor (int $user_id, string $type)
 
 getFilesFor (int $user_id)
 
 getAbsolutePathForHash (int $user_id, string $type, string $post_hash)
 
- Public Member Functions inherited from ilImportDirectory
 __construct (Filesystem $storage, ilLogger $logger)
 
 getRelativePath ()
 
 exists ()
 
 getAbsolutePath ()
 

Protected Member Functions

 getPathPrefix ()
 
- Protected Member Functions inherited from ilImportDirectory
 getPathPrefix ()
 

Private Attributes

const PATH_PREFIX = 'export'
 

Additional Inherited Members

- Protected Attributes inherited from ilImportDirectory
Filesystem $storage
 
ilLogger $logger
 

Detailed Description

Import directory.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 27 of file class.ilExportImportDirectory.php.

Member Function Documentation

◆ getAbsolutePathForHash()

ilExportImportDirectory::getAbsolutePathForHash ( int  $user_id,
string  $type,
string  $post_hash 
)

Definition at line 70 of file class.ilExportImportDirectory.php.

References ilFileUtils\getDataDir(), and getFilesFor().

70  : string
71  {
72  foreach ($this->getFilesFor($user_id, $type) as $hash => $file) {
73  if (strcmp($hash, $post_hash) === 0) {
74  $file_path = base64_decode($hash);
75  return ilFileUtils::getDataDir() . '/' . base64_decode($hash);
76  }
77  }
78  return '';
79  }
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:

◆ getFilesFor()

ilExportImportDirectory::getFilesFor ( int  $user_id)

Definition at line 41 of file class.ilExportImportDirectory.php.

References $user_id, ilImportDirectory\exists(), and ilImportDirectory\getRelativePath().

Referenced by getAbsolutePathForHash(), and hasFilesFor().

41  : array
42  {
43  if (!$this->exists()) {
44  return [];
45  }
46  $finder = $this->storage->finder()
47  ->in([$this->getRelativePath()])
48  ->files()
49  ->depth('< 1')
50  ->sortByName();
51  $files = [];
52  foreach ($finder as $file) {
53  $basename = basename($file->getPath());
54  $files[base64_encode($file->getPath())] = $basename;
55  }
56  if ($this->storage->hasDir($this->getRelativePath() . '/' . $user_id)) {
57  $finder = $this->storage->finder()->in([$this->getRelativePath() . '/' . $user_id])
58  ->depth('< 1')
59  ->files()
60  ->sortByName();
61  foreach ($finder as $file) {
62  $basename = basename($file->getPath());
63  $files[base64_encode($file->getPath())] = $basename;
64  }
65  }
66  asort($files);
67  return $files;
68  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathPrefix()

ilExportImportDirectory::getPathPrefix ( )
protected

Definition at line 31 of file class.ilExportImportDirectory.php.

31  : string
32  {
33  return self::PATH_PREFIX;
34  }

◆ hasFilesFor()

ilExportImportDirectory::hasFilesFor ( int  $user_id,
string  $type 
)

Definition at line 36 of file class.ilExportImportDirectory.php.

References getFilesFor().

36  : bool
37  {
38  return (bool) count($this->getFilesFor($user_id, $type));
39  }
+ Here is the call graph for this function:

Field Documentation

◆ PATH_PREFIX

const ilExportImportDirectory::PATH_PREFIX = 'export'
private

Definition at line 29 of file class.ilExportImportDirectory.php.


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