ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables 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 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 ()
 
 getPathPostfix ()
 
- 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.

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

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

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

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

◆ getPathPostfix()

ilLearningSequenceFilesystem::getPathPostfix ( )
protected

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

97  {
98  return self::PATH_POST;
99  }

◆ getPathPrefix()

ilLearningSequenceFilesystem::getPathPrefix ( )
protected

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

89  {
90  return self::PATH_PRE;
91  }

◆ getStoragePath()

ilLearningSequenceFilesystem::getStoragePath ( )
protected

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

References ilFileSystemStorage\getAbsolutePath().

Referenced by getStoragePathFor().

81  {
82  return $this->getAbsolutePath() . '/';
83  }
getAbsolutePath()
Get absolute path of storage directory.
+ 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 62 of file class.ilLearningSequenceFilesystem.php.

References getStoragePath().

Referenced by moveUploaded().

63  {
64  return $this->getStoragePath()
65  . $which
66  . '_'
67  . (string) $obj_id
68  . '.'
69  . $suffix;
70  }
+ 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 72 of file class.ilLearningSequenceFilesystem.php.

Referenced by moveUploaded().

72  : string
73  {
74  return pathinfo($file_name, PATHINFO_EXTENSION);
75  }
+ Here is the caller graph for this function:

◆ moveUploaded()

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

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

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

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

◆ PATH_PRE

const ilLearningSequenceFilesystem::PATH_PRE = 'LSO'

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