ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 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)
 

Data Fields

const IMG_ABSTRACT = 'abstract'
 
const IMG_EXTRO = 'extro'
 
const PATH_PRE = 'LSO'
 
const PATH_POST = 'Images'
 
- 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"
 

Protected Member Functions

 getStoragePath ()
 
 getPathPrefix ()
 Get path prefix.Prefix that will be prepended to the path No trailing slash. E.g ilFiles for files@abstract @access protected
Returns
string path prefix e.g files
More...
 
 getPathPostfix ()
 Get directory name.E.g for files => file Only relative path, no trailing slash '_<obj_id>' will be appended automatically@abstract @access protected
Returns
string directory name
More...
 
- Protected Member Functions inherited from ilFileSystemStorage
 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...
 

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...
 
- Protected Attributes inherited from ilFileSystemStorage
 $path
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLearningSequenceFilesystem::__construct ( )

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

18 {
19 parent::__construct(self::STORAGE_WEB, false, 0);
20 if (!is_dir($this->getAbsolutePath())) {
21 $this->create();
22 }
23 }
getAbsolutePath()
Get absolute path of storage directory.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ delete_image()

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

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

48 {
49 if ($which === self::IMG_ABSTRACT) {
50 $delete = $settings->getAbstractImage();
51 $settings = $settings->withAbstractImage(null);
52 }
53 if ($which === self::IMG_EXTRO) {
54 $delete = $settings->getExtroImage();
55 $settings = $settings->withExtroImage(null);
56 }
57
58 $this->deleteFile($delete);
59 return $settings;
60 }
deleteFile($a_abs_name)
Delete file.

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@abstract @access protected

Returns
string directory name

Reimplemented from ilFileSystemStorage.

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

◆ getPathPrefix()

ilLearningSequenceFilesystem::getPathPrefix ( )
protected

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

Returns
string path prefix e.g files

Reimplemented from ilFileSystemStorage.

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

◆ getStoragePath()

ilLearningSequenceFilesystem::getStoragePath ( )
protected

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

81 {
82 return $this->getAbsolutePath() . '/';
83 }

◆ getStoragePathFor()

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

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

63 {
64 return $this->getStoragePath()
65 . $which
66 . '_'
67 . (string) $obj_id
68 . '.'
69 . $suffix;
70 }

◆ getSuffix()

ilLearningSequenceFilesystem::getSuffix ( string  $file_name)

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

72 : string
73 {
74 return pathinfo($file_name, PATHINFO_EXTENSION);
75 }

◆ moveUploaded()

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

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

30 $target = $this->getStoragePathFor(
31 $which,
32 $settings->getObjId(),
33 $this->getSuffix($file_info['name'])
34 );
35 move_uploaded_file($file_info['tmp_name'], $target);
36
37 if ($which === self::IMG_ABSTRACT) {
38 $settings = $settings->withAbstractImage($target);
39 }
40 if ($which === self::IMG_EXTRO) {
41 $settings = $settings->withExtroImage($target);
42 }
43 return $settings;
44 }
getStoragePathFor(string $which, int $obj_id, string $suffix)
Settings for an LSO (like abstract, extro)

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 15 of file class.ilLearningSequenceFilesystem.php.

◆ PATH_PRE

const ilLearningSequenceFilesystem::PATH_PRE = 'LSO'

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