ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCertificateBackgroundImageFileService Class Reference
+ Collaboration diagram for ilCertificateBackgroundImageFileService:

Public Member Functions

 __construct (string $certificatePath, Filesystem $filesystem, string $webDirectory=CLIENT_WEB_DIR)
 
 hasBackgroundImage (ilCertificateTemplate $template)
 
 hasBackgroundImageThumbnail (ilCertificateTemplate $template)
 
 getBackgroundImageThumbPath ()
 
 getBackgroundImageDirectory (string $backgroundImagePath='')
 
 getBackgroundImageTempfilePath (string $extension)
 
 getValidBackgroundImageFileExtensions ()
 

Data Fields

const BACKGROUND_IMAGE_NAME = 'background.jpg'
 
const BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME = 'background_upload_tmp'
 
const BACKGROUND_THUMBNAIL_FILE_ENDING = '.thumb.jpg'
 
const PLACEHOLDER_CLIENT_WEB_DIRECTORY = '[CLIENT_WEB_DIR]'
 
const VALID_BACKGROUND_IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'gif', 'png']
 

Private Attributes

Filesystem $fileSystem
 
string $certificatePath
 
string $webDirectory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateBackgroundImageFileService::__construct ( string  $certificatePath,
Filesystem  $filesystem,
string  $webDirectory = CLIENT_WEB_DIR 
)

Definition at line 38 of file ilCertificateBackgroundImageFileService.php.

References $certificatePath, and $webDirectory.

42  {
43  $this->certificatePath = $certificatePath;
44  $this->fileSystem = $filesystem;
45  $this->webDirectory = $webDirectory;
46  }

Member Function Documentation

◆ getBackgroundImageDirectory()

ilCertificateBackgroundImageFileService::getBackgroundImageDirectory ( string  $backgroundImagePath = '')

Definition at line 81 of file ilCertificateBackgroundImageFileService.php.

81  : string
82  {
83  return str_replace(
84  [$this->webDirectory, '//'],
85  [self::PLACEHOLDER_CLIENT_WEB_DIRECTORY, '/'],
86  $backgroundImagePath
87  );
88  }

◆ getBackgroundImageTempfilePath()

ilCertificateBackgroundImageFileService::getBackgroundImageTempfilePath ( string  $extension)

Definition at line 90 of file ilCertificateBackgroundImageFileService.php.

90  : string
91  {
92  return implode('', [
93  $this->webDirectory,
94  $this->certificatePath,
95  self::BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME,
96  '.' . $extension
97  ]);
98  }

◆ getBackgroundImageThumbPath()

ilCertificateBackgroundImageFileService::getBackgroundImageThumbPath ( )

Definition at line 76 of file ilCertificateBackgroundImageFileService.php.

76  : string
77  {
78  return $this->webDirectory . $this->certificatePath . self::BACKGROUND_IMAGE_NAME . self::BACKGROUND_THUMBNAIL_FILE_ENDING;
79  }

◆ getValidBackgroundImageFileExtensions()

ilCertificateBackgroundImageFileService::getValidBackgroundImageFileExtensions ( )
Returns
list<string>

Definition at line 103 of file ilCertificateBackgroundImageFileService.php.

103  : array
104  {
105  return self::VALID_BACKGROUND_IMAGE_EXTENSIONS;
106  }

◆ hasBackgroundImage()

ilCertificateBackgroundImageFileService::hasBackgroundImage ( ilCertificateTemplate  $template)

Definition at line 48 of file ilCertificateBackgroundImageFileService.php.

References ilCertificateTemplate\getBackgroundImagePath().

48  : bool
49  {
50  $backgroundImagePath = $template->getBackgroundImagePath();
51  if ($backgroundImagePath === '') {
52  return false;
53  }
54 
55  if ($this->fileSystem->has($backgroundImagePath)) {
56  return true;
57  }
58 
59  return false;
60  }
+ Here is the call graph for this function:

◆ hasBackgroundImageThumbnail()

ilCertificateBackgroundImageFileService::hasBackgroundImageThumbnail ( ilCertificateTemplate  $template)

Definition at line 62 of file ilCertificateBackgroundImageFileService.php.

References ilCertificateTemplate\getThumbnailImagePath().

62  : bool
63  {
64  $backgroundImagePath = $template->getThumbnailImagePath();
65  if ($backgroundImagePath === '') {
66  return false;
67  }
68 
69  if ($this->fileSystem->has($backgroundImagePath)) {
70  return true;
71  }
72 
73  return false;
74  }
+ Here is the call graph for this function:

Field Documentation

◆ $certificatePath

string ilCertificateBackgroundImageFileService::$certificatePath
private

Definition at line 35 of file ilCertificateBackgroundImageFileService.php.

Referenced by __construct().

◆ $fileSystem

Filesystem ilCertificateBackgroundImageFileService::$fileSystem
private

Definition at line 34 of file ilCertificateBackgroundImageFileService.php.

◆ $webDirectory

string ilCertificateBackgroundImageFileService::$webDirectory
private

Definition at line 36 of file ilCertificateBackgroundImageFileService.php.

Referenced by __construct().

◆ BACKGROUND_IMAGE_NAME

const ilCertificateBackgroundImageFileService::BACKGROUND_IMAGE_NAME = 'background.jpg'

Definition at line 28 of file ilCertificateBackgroundImageFileService.php.

◆ BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME

const ilCertificateBackgroundImageFileService::BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME = 'background_upload_tmp'

◆ BACKGROUND_THUMBNAIL_FILE_ENDING

const ilCertificateBackgroundImageFileService::BACKGROUND_THUMBNAIL_FILE_ENDING = '.thumb.jpg'

◆ PLACEHOLDER_CLIENT_WEB_DIRECTORY

const ilCertificateBackgroundImageFileService::PLACEHOLDER_CLIENT_WEB_DIRECTORY = '[CLIENT_WEB_DIR]'

Definition at line 31 of file ilCertificateBackgroundImageFileService.php.

◆ VALID_BACKGROUND_IMAGE_EXTENSIONS

const ilCertificateBackgroundImageFileService::VALID_BACKGROUND_IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'gif', 'png']

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