ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCertificateTemplateDeleteAction Class Reference
+ Inheritance diagram for ilCertificateTemplateDeleteAction:
+ Collaboration diagram for ilCertificateTemplateDeleteAction:

Public Member Functions

 __construct (ilCertificateTemplateRepository $templateRepository, string $rootDirectory=CLIENT_WEB_DIR, ilCertificateUtilHelper $utilHelper=null, ilCertificateObjectHelper $objectHelper=null, $iliasVersion=ILIAS_VERSION_NUMERIC)
 
 delete ($templateTemplateId, $objectId)
 
 delete ($templateId, $objectId)
 

Private Member Functions

 overwriteBackgroundImageThumbnail (ilCertificateTemplate $previousTemplate)
 

Private Attributes

 $templateRepository
 
 $rootDirectory
 
 $utilHelper
 
 $objectHelper
 
 $iliasVersion
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateTemplateDeleteAction::__construct ( ilCertificateTemplateRepository  $templateRepository,
string  $rootDirectory = CLIENT_WEB_DIR,
ilCertificateUtilHelper  $utilHelper = null,
ilCertificateObjectHelper  $objectHelper = null,
  $iliasVersion = ILIAS_VERSION_NUMERIC 
)
Parameters
ilCertificateTemplateRepository$templateRepository
string$rootDirectory
ilCertificateUtilHelper | null$utilHelper
ilCertificateObjectHelper | null$objectHelper
string$iliasVersion

Definition at line 41 of file class.ilCertificateTemplateDeleteAction.php.

References $iliasVersion, $objectHelper, $rootDirectory, $templateRepository, and $utilHelper.

Member Function Documentation

◆ delete()

ilCertificateTemplateDeleteAction::delete (   $templateTemplateId,
  $objectId 
)
Parameters
$templateTemplateId
$objectId
string$iliasVersion
Returns
mixed
Exceptions
ilDatabaseException

Implements ilCertificateDeleteAction.

Definition at line 72 of file class.ilCertificateTemplateDeleteAction.php.

73 {
74 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($objectId);
75
76 $this->templateRepository->deleteTemplate($templateTemplateId, $objectId);
77
78 $version = (int) $template->getVersion();
79 $certificateTemplate = new ilCertificateTemplate(
80 $objectId,
81 $this->objectHelper->lookupType($objectId),
82 '',
83 hash('sha256', ''),
84 '',
85 $version + 1,
86 $this->iliasVersion,
87 time(),
88 false,
89 '',
90 ''
91 );
92
93 $this->templateRepository->save($certificateTemplate);
94
95 $this->overwriteBackgroundImageThumbnail($certificateTemplate);
96 }
overwriteBackgroundImageThumbnail(ilCertificateTemplate $previousTemplate)

References overwriteBackgroundImageThumbnail().

+ Here is the call graph for this function:

◆ overwriteBackgroundImageThumbnail()

ilCertificateTemplateDeleteAction::overwriteBackgroundImageThumbnail ( ilCertificateTemplate  $previousTemplate)
private
Parameters
$previousTemplate

Definition at line 101 of file class.ilCertificateTemplateDeleteAction.php.

102 {
103 $relativePath = $previousTemplate->getBackgroundImagePath();
104
105 if (null === $relativePath || '' === $relativePath) {
106 $relativePath = '/certificates/default/background.jpg';
107 }
108
109 $pathInfo = pathinfo($relativePath);
110
111 $newFilePath = $pathInfo['dirname'] . '/background.jpg.thumb.jpg';
112
113 $this->utilHelper->convertImage(
114 $this->rootDirectory . $relativePath,
115 $this->rootDirectory . $newFilePath,
116 'JPEG',
117 100
118 );
119 }

References ilCertificateTemplate\getBackgroundImagePath().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $iliasVersion

ilCertificateTemplateDeleteAction::$iliasVersion
private

Definition at line 32 of file class.ilCertificateTemplateDeleteAction.php.

Referenced by __construct().

◆ $objectHelper

ilCertificateTemplateDeleteAction::$objectHelper
private

Definition at line 27 of file class.ilCertificateTemplateDeleteAction.php.

Referenced by __construct().

◆ $rootDirectory

ilCertificateTemplateDeleteAction::$rootDirectory
private

Definition at line 17 of file class.ilCertificateTemplateDeleteAction.php.

Referenced by __construct().

◆ $templateRepository

ilCertificateTemplateDeleteAction::$templateRepository
private

Definition at line 12 of file class.ilCertificateTemplateDeleteAction.php.

Referenced by __construct().

◆ $utilHelper

ilCertificateTemplateDeleteAction::$utilHelper
private

Definition at line 22 of file class.ilCertificateTemplateDeleteAction.php.

Referenced by __construct().


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