ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
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.

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

References $certificatePath, and $webDirectory.

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 }

References BACKGROUND_THUMBNAIL_FILE_ENDING.

◆ getValidBackgroundImageFileExtensions()

ilCertificateBackgroundImageFileService::getValidBackgroundImageFileExtensions ( )

◆ hasBackgroundImage()

ilCertificateBackgroundImageFileService::hasBackgroundImage ( ilCertificateTemplate  $template)

Definition at line 48 of file ilCertificateBackgroundImageFileService.php.

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 }

References ilCertificateTemplate\getBackgroundImagePath().

+ Here is the call graph for this function:

◆ hasBackgroundImageThumbnail()

ilCertificateBackgroundImageFileService::hasBackgroundImageThumbnail ( ilCertificateTemplate  $template)

Definition at line 62 of file ilCertificateBackgroundImageFileService.php.

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 }

References ilCertificateTemplate\getThumbnailImagePath().

+ 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: