19 declare(strict_types=1);
42 if (
null === $objectHelper) {
55 public function cloneCertificate(
61 $oldType = $oldObject->
getType();
62 $newType = $newObject->
getType();
64 if ($oldType !== $newType) {
66 'The types "%s" and "%s" for cloning does not match',
72 $certificatePath = $this->pathFactory->create($newObject);
74 $templates = $this->templateRepository->fetchCertificateTemplatesByObjId($oldObject->
getId());
77 foreach ($templates as $template) {
80 $this->objectHelper->lookupType($newObject->
getId()),
81 $template->getCertificateContent(),
82 $template->getCertificateHash(),
83 $template->getTemplateValues(),
84 $template->getVersion(),
87 $template->isCurrentlyActive(),
88 $template->getBackgroundImagePath(),
89 $template->getTileImagePath(),
90 $template->getBackgroundImageIdentification(),
91 $template->getTileImageIdentification()
94 $this->templateRepository->save($newTemplate);
99 $this->database->replace(
101 [
'obj_id' => [
'integer', $newObject->
getId()]],
109 $sql =
'SELECT 1 FROM il_certificate WHERE obj_id = ' . $this->database->quote($objectId,
'integer');
111 return (
bool) $this->database->fetchAssoc($this->database->query($sql));
__construct(private readonly ilDBInterface $database, private readonly ilCertificatePathFactory $pathFactory, private readonly ilCertificateTemplateRepository $templateRepository, ?ilCertificateObjectHelper $objectHelper=null, ?ilObjCertificateSettings $global_certificate_settings=null,)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const ILIAS_VERSION_NUMERIC
readonly ilCertificateObjectHelper $objectHelper
readonly Filesystem $fileSystem