ILIAS  release_8 Revision v8.24
class.ilCertificateTemplateDeleteAction.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27 private string $rootDirectory;
30 private string $iliasVersion;
31
32 public function __construct(
38 ) {
39 $this->templateRepository = $templateRepository;
40
41 $this->rootDirectory = $rootDirectory;
42
43 if (null === $utilHelper) {
45 }
46 $this->utilHelper = $utilHelper;
47
48 if (null === $objectHelper) {
50 }
51 $this->objectHelper = $objectHelper;
52
53 $this->iliasVersion = $iliasVersion;
54 }
55
56 public function delete(int $templateId, int $objectId): void
57 {
58 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($objectId);
59
60 $this->templateRepository->deleteTemplate($templateId, $objectId);
61
62 $version = $template->getVersion();
63 $certificateTemplate = new ilCertificateTemplate(
64 $objectId,
65 $this->objectHelper->lookupType($objectId),
66 '',
67 hash('sha256', ''),
68 '',
69 ($version + 1),
70 $this->iliasVersion,
71 time(),
72 false,
73 '',
74 ''
75 );
76
77 $this->templateRepository->save($certificateTemplate);
78 }
79}
$version
Definition: plugin.php:24
__construct(ilCertificateTemplateRepository $templateRepository, string $rootDirectory=CLIENT_WEB_DIR, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateObjectHelper $objectHelper=null, string $iliasVersion=ILIAS_VERSION_NUMERIC)
Just a wrapper class to create Unit Test for other classes.
const CLIENT_WEB_DIR
Definition: constants.php:47
const ILIAS_VERSION_NUMERIC