ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 getPathPostfix ()
 
- 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.

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

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

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

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)
+ Here is the call graph for this function:

◆ getPathPostfix()

ilLearningSequenceFilesystem::getPathPostfix ( )
protected

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

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

◆ getPathPrefix()

ilLearningSequenceFilesystem::getPathPrefix ( )
protected

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.

References ilFileSystemAbstractionStorage\getAbsolutePath().

Referenced by delete_image(), and getStoragePathFor().

93  : string
94  {
95  return $this->getAbsolutePath() . '/';
96  }
getAbsolutePath()
Calculates the full path on the filesystem.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStoragePathFor()

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

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

References getStoragePath().

Referenced by moveUploaded().

78  : string
79  {
80  return $this->getStoragePath()
81  . $which
82  . '_'
83  . $obj_id
84  . '.'
85  . $suffix;
86  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuffix()

ilLearningSequenceFilesystem::getSuffix ( string  $file_name)

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

Referenced by moveUploaded().

88  : string
89  {
90  return pathinfo($file_name, PATHINFO_EXTENSION);
91  }
+ Here is the caller graph for this function:

◆ moveUploaded()

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

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

References ilLearningSequenceSettings\getObjId(), getStoragePathFor(), getSuffix(), ilLearningSequenceSettings\withAbstractImage(), and ilLearningSequenceSettings\withExtroImage().

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)
Settings for an LSO (like abstract, extro)
+ Here is the call graph for this function:

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: