ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLearningSequenceFilesystem Class Reference

Storage of images in settings. More...

+ Inheritance diagram for ilLearningSequenceFilesystem:
+ Collaboration diagram for ilLearningSequenceFilesystem:

Public Member Functions

 __construct ()
 
 moveUploaded (string $which, array $file_info, ilLearningSequenceSettings $settings)
 
 delete_image (string $which, ilLearningSequenceSettings $settings)
 
 getStoragePathFor (string $which, int $obj_id, string $suffix)
 
 getSuffix (string $file_name)
 
- Public Member Functions inherited from ilFileSystemAbstractionStorage
 __construct (private int $storage_type, private bool $path_conversion, private int $container_id)
 Constructor. More...
 
 fileExists (string $a_absolute_path)
 
 getContainerId ()
 
 writeToFile (string $a_data, $a_absolute_path)
 
 copyFile (string $a_from, string $a_to)
 
 create ()
 
 getAbsolutePath ()
 Calculates the full path on the filesystem. More...
 
 delete ()
 
 deleteDirectory (string $a_abs_name)
 
 deleteFile (string $a_abs_name)
 
 appendToPath (string $a_appendix)
 
 getStorageType ()
 
 getPath ()
 

Data Fields

const IMG_ABSTRACT = 'abstract'
 
const IMG_EXTRO = 'extro'
 
const PATH_PRE = 'LSO'
 
const PATH_POST = 'Images'
 
- Data Fields inherited from ilFileSystemAbstractionStorage
const STORAGE_WEB = 1
 
const STORAGE_DATA = 2
 
const STORAGE_SECURED = 3
 

Protected Member Functions

 getStoragePath ()
 
 getPathPrefix ()
 Get path prefix.Prefix that will be prepended to the path No trailing slash. E.g ilFiles for files More...
 
 getPathPostfix ()
 Get directory name.E.g for files => file Only relative path, no trailing slash '_<obj_id>' will be appended automatically More...
 
- Protected Member Functions inherited from ilFileSystemAbstractionStorage
 getLegacyFullAbsolutePath (string $relative_path)
 
 getFileSystemService ()
 
 getPathPrefix ()
 Get path prefix. More...
 
 getPathPostfix ()
 Get directory name. More...
 
 getLegacyAbsolutePath ()
 Calculates the absolute filesystem storage location. More...
 
 init ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFileSystemAbstractionStorage
static createPathFromId (int $a_container_id, string $a_name)
 
static _copyDirectory (string $a_sdir, string $a_tdir)
 
- Protected Attributes inherited from ilFileSystemAbstractionStorage
string $path = null
 
Filesystems $file_system_service
 

Detailed Description

Storage of images in settings.

Definition at line 24 of file class.ilLearningSequenceFilesystem.php.

Constructor & Destructor Documentation

◆ __construct()

ilLearningSequenceFilesystem::__construct ( )

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

32 {
33 parent::__construct(self::STORAGE_WEB, false, 0);
34 if (!is_dir($this->getAbsolutePath())) {
35 $this->create();
36 }
37 }
getAbsolutePath()
Calculates the full path on the filesystem.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), ilFileSystemAbstractionStorage\create(), and ilFileSystemAbstractionStorage\getAbsolutePath().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete_image()

ilLearningSequenceFilesystem::delete_image ( string  $which,
ilLearningSequenceSettings  $settings 
)

Definition at line 61 of file class.ilLearningSequenceFilesystem.php.

62 {
63 $delete = '';
64 if ($which === self::IMG_ABSTRACT) {
65 $delete = $settings->getAbstractImage();
66 $settings = $settings->withAbstractImage();
67 }
68 if ($which === self::IMG_EXTRO) {
69 $delete = $settings->getExtroImage();
70 $settings = $settings->withExtroImage();
71 }
72 if ($delete !== '' && str_starts_with($delete, $this->getStoragePath())) {
73 $this->deleteFile($delete);
74 }
75 return $settings;
76 }
Settings for an LSO (like abstract, extro)

References ilLearningSequenceSettings\getAbstractImage(), ilLearningSequenceSettings\getExtroImage(), ilLearningSequenceSettings\withAbstractImage(), and ilLearningSequenceSettings\withExtroImage().

+ Here is the call graph for this function:

◆ getPathPostfix()

ilLearningSequenceFilesystem::getPathPostfix ( )
protected

Get directory name.E.g for files => file Only relative path, no trailing slash '_<obj_id>' will be appended automatically

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 109 of file class.ilLearningSequenceFilesystem.php.

109 : string
110 {
111 return self::PATH_POST;
112 }

◆ getPathPrefix()

ilLearningSequenceFilesystem::getPathPrefix ( )
protected

Get path prefix.Prefix that will be prepended to the path No trailing slash. E.g ilFiles for files

Reimplemented from ilFileSystemAbstractionStorage.

Definition at line 101 of file class.ilLearningSequenceFilesystem.php.

101 : string
102 {
103 return self::PATH_PRE;
104 }

◆ getStoragePath()

ilLearningSequenceFilesystem::getStoragePath ( )
protected

Definition at line 93 of file class.ilLearningSequenceFilesystem.php.

93 : string
94 {
95 return $this->getAbsolutePath() . '/';
96 }

◆ getStoragePathFor()

ilLearningSequenceFilesystem::getStoragePathFor ( string  $which,
int  $obj_id,
string  $suffix 
)

Definition at line 78 of file class.ilLearningSequenceFilesystem.php.

78 : string
79 {
80 return $this->getStoragePath()
81 . $which
82 . '_'
83 . $obj_id
84 . '.'
85 . $suffix;
86 }

◆ getSuffix()

ilLearningSequenceFilesystem::getSuffix ( string  $file_name)

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

88 : string
89 {
90 return pathinfo($file_name, PATHINFO_EXTENSION);
91 }

◆ moveUploaded()

ilLearningSequenceFilesystem::moveUploaded ( string  $which,
array  $file_info,
ilLearningSequenceSettings  $settings 
)

Definition at line 39 of file class.ilLearningSequenceFilesystem.php.

44 $target = $this->getStoragePathFor(
45 $which,
46 $settings->getObjId(),
47 $this->getSuffix($file_info['name'])
48 );
49 move_uploaded_file($file_info['tmp_name'], $target);
50
51 if ($which === self::IMG_ABSTRACT) {
52 $settings = $settings->withAbstractImage($target);
53 }
54 if ($which === self::IMG_EXTRO) {
55 $settings = $settings->withExtroImage($target);
56 }
57 return $settings;
58 }
getStoragePathFor(string $which, int $obj_id, string $suffix)

Field Documentation

◆ IMG_ABSTRACT

const ilLearningSequenceFilesystem::IMG_ABSTRACT = 'abstract'

◆ IMG_EXTRO

const ilLearningSequenceFilesystem::IMG_EXTRO = 'extro'

◆ PATH_POST

const ilLearningSequenceFilesystem::PATH_POST = 'Images'

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

◆ PATH_PRE

const ilLearningSequenceFilesystem::PATH_PRE = 'LSO'

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