19declare(strict_types=1);
30 private ?IRSS $irss =
null,
37 $this->irss = $irss ??
$DIC->resourceStorage();
55 public function generate(
int $userCertificateId): string
57 $certificate = $this->
repository->fetchCertificate($userCertificateId);
79 $certificate = $this->
repository->fetchActiveCertificateForPresentation($userId,
$objId);
83 throw new ilException(sprintf(
'The usr_id "%s" does NOT reference a user', $userId));
86 return $this->filename_factory->create($certificate);
94 'Delegating certificate PDF generation for certificate id {certificate_id} (user {user_id} and object {object_id}) to ilServer',
98 'object_id' => $certificate->
getObjId()
105 $background_src = $this->irss->consume()->src($background_rid)->getSrc(
true);
107 $content = str_replace(
108 [
'[BACKGROUND_IMAGE]'],
114 $pdf_base64 = $this->rpc->ilFO2PDF(
'RPCTransformationHandler', $content);
116 $size = strlen(base64_decode($pdf_base64->scalar,
true));
118 'Received generated PDF with size {size} bytes for certificate id {certificate_id} (user {user_id} and object {object_id}) from ilServer',
123 'object_id' => $certificate->
getObjId()
128 return $pdf_base64->scalar;
Class ResourceIdentification.
Base class for ILIAS Exception handling.
Component logger with individual log levels by component id.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
createPDFScalar(ilUserCertificate $certificate)
generate(int $userCertificateId)
__construct(private readonly ilUserCertificateRepository $repository, private ?IRSS $irss=null, private ?ilCertificateRpcClientFactoryHelper $rpc=null, private ?ilCertificatePdfFileNameFactory $filename_factory=null, ?ilLanguage $lng=null)
generateCurrentActiveCertificate(int $userId, int $objId)
generateFileName(int $userId, int $objId)
withLogger(ilLogger $logger)
getBackgroundImageIdentification()