ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 @inheritDoc More...
 
 getAbsolutePath ()
 @inheritDoc More...
 
 exists ()
 
 getAbsolutePath ()
 

Protected Member Functions

 getPathPrefix ()
 
 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.

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)

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

+ Here is the call graph for this function:

◆ getFilesFor()

ilExportImportDirectory::getFilesFor ( int  $user_id)

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

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 }

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

Referenced by getAbsolutePathForHash(), and hasFilesFor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathPrefix()

ilExportImportDirectory::getPathPrefix ( )
protected

Reimplemented from ilImportDirectory.

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

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

References PATH_PREFIX.

◆ hasFilesFor()

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

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

36 : bool
37 {
38 return (bool) count($this->getFilesFor($user_id, $type));
39 }

References getFilesFor().

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

Referenced by getPathPrefix().


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