ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilCertificateTemplateDeleteAction.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
13
18
22 private $utilHelper;
23
28
33
41 public function __construct(
47 ) {
48 $this->templateRepository = $templateRepository;
49
50 $this->rootDirectory = $rootDirectory;
51
52 if (null === $utilHelper) {
54 }
55 $this->utilHelper = $utilHelper;
56
57 if (null === $objectHelper) {
59 }
60 $this->objectHelper = $objectHelper;
61
62 $this->iliasVersion = $iliasVersion;
63 }
64
72 public function delete($templateTemplateId, $objectId)
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}
An exception for terminatinating execution or to throw for unit testing.
__construct(ilCertificateTemplateRepository $templateRepository, string $rootDirectory=CLIENT_WEB_DIR, ilCertificateUtilHelper $utilHelper=null, ilCertificateObjectHelper $objectHelper=null, $iliasVersion=ILIAS_VERSION_NUMERIC)
Just a wrapper class to create Unit Test for other classes.
const CLIENT_WEB_DIR
Definition: constants.php:45
const ILIAS_VERSION_NUMERIC