ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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'
 
- 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 15 of file class.ilLearningSequenceFilesystem.php.

References ilFileSystemStorage\create(), and ilFileSystemStorage\getAbsolutePath().

16  {
17  parent::__construct(self::STORAGE_WEB, false, 0);
18  if (!is_dir($this->getAbsolutePath())) {
19  $this->create();
20  }
21  }
getAbsolutePath()
Get absolute path of storage directory.
+ Here is the call graph for this function:

Member Function Documentation

◆ delete_image()

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

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

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

46  {
47  if ($which === self::IMG_ABSTRACT) {
48  $delete = $settings->getAbstractImage();
49  $settings = $settings->withAbstractImage(null);
50  }
51  if ($which === self::IMG_EXTRO) {
52  $delete = $settings->getExtroImage();
53  $settings = $settings->withExtroImage(null);
54  }
55 
56  $this->deleteFile($delete);
57  return $settings;
58  }
deleteFile($a_abs_name)
Delete file.
+ Here is the call graph for this function:

◆ getPathPostfix()

ilLearningSequenceFilesystem::getPathPostfix ( )
protected

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

95  {
96  return 'Images';
97  }

◆ getPathPrefix()

ilLearningSequenceFilesystem::getPathPrefix ( )
protected

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

87  {
88  return 'LSO';
89  }

◆ getStoragePath()

ilLearningSequenceFilesystem::getStoragePath ( )
protected

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

References ilFileSystemStorage\getAbsolutePath().

Referenced by getStoragePathFor().

79  {
80  return $this->getAbsolutePath() . '/';
81  }
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 60 of file class.ilLearningSequenceFilesystem.php.

References getStoragePath().

Referenced by moveUploaded().

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

Referenced by moveUploaded().

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

◆ moveUploaded()

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

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

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

28  $target = $this->getStoragePathFor(
29  $which,
30  $settings->getObjId(),
31  $this->getSuffix($file_info['name'])
32  );
33  move_uploaded_file($file_info['tmp_name'], $target);
34 
35  if ($which === self::IMG_ABSTRACT) {
36  $settings = $settings->withAbstractImage($target);
37  }
38  if ($which === self::IMG_EXTRO) {
39  $settings = $settings->withExtroImage($target);
40  }
41  return $settings;
42  }
getStoragePathFor(string $which, int $obj_id, string $suffix)
Settings for an LSO (like abstract, extro)
$target
Definition: test.php:19
+ Here is the call graph for this function:

Field Documentation

◆ IMG_ABSTRACT

const ilLearningSequenceFilesystem::IMG_ABSTRACT = 'abstract'

◆ IMG_EXTRO

const ilLearningSequenceFilesystem::IMG_EXTRO = 'extro'

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