ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CertificateResourceHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Certificate;
22
29
31{
32 public function __construct(
33 private readonly ilUserCertificateRepository $user_certificate_repo,
34 private readonly ilCertificateTemplateDatabaseRepository $certificate_template_repo,
35 private readonly IRSS $irss,
36 private readonly ilObjCertificateSettings $global_certificate_settings,
37 private readonly ilCertificateTemplateStakeholder $stakeholder
38 ) {
39 }
40
41 public function handleResourceChange(ResourceIdentification $background_image): void
42 {
43 if (
44 !$this->user_certificate_repo->isResourceUsed($background_image->serialize()) &&
45 !$this->certificate_template_repo->isResourceUsed($background_image->serialize()) &&
46 (
47 $this->global_certificate_settings->getBackgroundImageIdentification() === null ||
48 (
49 $this->global_certificate_settings
50 ->getBackgroundImageIdentification() instanceof ResourceIdentification &&
51 $this->global_certificate_settings
52 ->getBackgroundImageIdentification()->serialize() !== $background_image->serialize()
53 )
54 )
55 ) {
56 $this->irss->manage()->remove($background_image, $this->stakeholder);
57 }
58 }
59}
__construct(private readonly ilUserCertificateRepository $user_certificate_repo, private readonly ilCertificateTemplateDatabaseRepository $certificate_template_repo, private readonly IRSS $irss, private readonly ilObjCertificateSettings $global_certificate_settings, private readonly ilCertificateTemplateStakeholder $stakeholder)
handleResourceChange(ResourceIdentification $background_image)
Class ilObjCertificateSettings.