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 
17  private $rootDirectory;
18 
22  private $utilHelper;
23 
27  private $objectHelper;
28 
32  private $iliasVersion;
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,
87  time(),
88  false,
89  '',
90  ''
91  );
92 
93  $this->templateRepository->save($certificateTemplate);
94  }
95 }
const ILIAS_VERSION_NUMERIC
__construct(ilCertificateTemplateRepository $templateRepository, string $rootDirectory=CLIENT_WEB_DIR, ilCertificateUtilHelper $utilHelper=null, ilCertificateObjectHelper $objectHelper=null, $iliasVersion=ILIAS_VERSION_NUMERIC)
const CLIENT_WEB_DIR
Definition: constants.php:45
Just a wrapper class to create Unit Test for other classes.