ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCertificateBackgroundImageFileService Class Reference
+ Collaboration diagram for ilCertificateBackgroundImageFileService:

Public Member Functions

 __construct (string $certificatePath, \ILIAS\Filesystem\Filesystem $filesystem, $webDirectory=CLIENT_WEB_DIR)
 
 hasBackgroundImage (ilCertificateTemplate $template)
 Checks for the background image of the certificate. More...
 
 hasBackgroundImageThumbnail (ilCertificateTemplate $template)
 
 getBackgroundImageThumbPath ()
 Returns the filesystem path of the background image thumbnail. More...
 
 getBackgroundImageDirectory ($backgroundImagePath='')
 Returns the filesystem path of the background image. More...
 
 getBackgroundImageTempfilePath ()
 Returns the filesystem path of the background image temp file during upload. More...
 

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]'
 

Private Attributes

 $fileSystem
 
 $certificatePath
 
 $webDirectory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 34 of file ilCertificateBackgroundImageFileService.php.

References $certificatePath, and $webDirectory.

38  {
39  $this->certificatePath = $certificatePath;
40  $this->fileSystem = $filesystem;
41  $this->webDirectory = $webDirectory;
42  }

Member Function Documentation

◆ getBackgroundImageDirectory()

ilCertificateBackgroundImageFileService::getBackgroundImageDirectory (   $backgroundImagePath = '')

Returns the filesystem path of the background image.

Parameters
string$backgroundImagePath
Returns
string The filesystem path of the background image

Definition at line 95 of file ilCertificateBackgroundImageFileService.php.

96  {
97  return str_replace(
98  array($this->webDirectory, '//'),
99  array(self::PLACEHOLDER_CLIENT_WEB_DIRECTORY, '/'),
100  $backgroundImagePath
101  );
102  }

◆ getBackgroundImageTempfilePath()

ilCertificateBackgroundImageFileService::getBackgroundImageTempfilePath ( )

Returns the filesystem path of the background image temp file during upload.

Returns
string The filesystem path of the background image temp file

Definition at line 109 of file ilCertificateBackgroundImageFileService.php.

110  {
111  return $this->webDirectory . $this->certificatePath . self::BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME;
112  }

◆ getBackgroundImageThumbPath()

ilCertificateBackgroundImageFileService::getBackgroundImageThumbPath ( )

Returns the filesystem path of the background image thumbnail.

Returns
string The filesystem path of the background image thumbnail

Definition at line 85 of file ilCertificateBackgroundImageFileService.php.

86  {
87  return $this->webDirectory . $this->certificatePath . self::BACKGROUND_IMAGE_NAME . self::BACKGROUND_THUMBNAIL_FILE_ENDING;
88  }

◆ hasBackgroundImage()

ilCertificateBackgroundImageFileService::hasBackgroundImage ( ilCertificateTemplate  $template)

Checks for the background image of the certificate.

Parameters
ilCertificateTemplate$template
Returns
boolean Returns TRUE if the certificate has a background image, FALSE otherwise

Definition at line 49 of file ilCertificateBackgroundImageFileService.php.

References ilCertificateTemplate\getBackgroundImagePath().

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

◆ hasBackgroundImageThumbnail()

ilCertificateBackgroundImageFileService::hasBackgroundImageThumbnail ( ilCertificateTemplate  $template)
Parameters
ilCertificateTemplate$template
Returns
bool

Definition at line 67 of file ilCertificateBackgroundImageFileService.php.

References ilCertificateTemplate\getThumbnailImagePath().

68  {
69  $backgroundImagePath = $template->getThumbnailImagePath();
70  if ($backgroundImagePath === '') {
71  return false;
72  }
73 
74  if ($this->fileSystem->has($backgroundImagePath)) {
75  return true;
76  }
77 
78  return false;
79  }
+ Here is the call graph for this function:

Field Documentation

◆ $certificatePath

ilCertificateBackgroundImageFileService::$certificatePath
private

Definition at line 22 of file ilCertificateBackgroundImageFileService.php.

Referenced by __construct().

◆ $fileSystem

ilCertificateBackgroundImageFileService::$fileSystem
private

Definition at line 17 of file ilCertificateBackgroundImageFileService.php.

◆ $webDirectory

ilCertificateBackgroundImageFileService::$webDirectory
private

Definition at line 27 of file ilCertificateBackgroundImageFileService.php.

Referenced by __construct().

◆ BACKGROUND_IMAGE_NAME

const ilCertificateBackgroundImageFileService::BACKGROUND_IMAGE_NAME = 'background.jpg'

Definition at line 9 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 12 of file ilCertificateBackgroundImageFileService.php.


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