40 $logger = $DIC->logger()->root();
56 $userCertificate = $userCertificateRepository->fetchActiveCertificate($userId, $objectId);
58 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId .
'/' . $objectId;
59 if (
false === $this->filesystem->hasDir($dirPath)) {
60 $this->filesystem->createDir($dirPath);
63 $pdfGenerator =
new ilPdfGenerator($userCertificateRepository, $this->logger);
65 $pdfScalar = $pdfGenerator->generate($userCertificate->getId());
67 $completePath = $dirPath .
'/' . $objectId .
'_' . self::CERTIFICATE_FILENAME;
68 if ($this->filesystem->has($completePath)) {
69 $this->filesystem->delete($completePath);
72 $this->filesystem->write($completePath, $pdfScalar);
83 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId .
'/' . $objectId;
84 $fileName = $objectId .
'_' . self::CERTIFICATE_FILENAME;
86 $completePath = $dirPath .
'/' . $fileName;
87 if ($this->filesystem->has($completePath)) {
90 $userCertificate = $userCertificateRepository->fetchActiveCertificateForPresentation($userId, $objectId);
92 $downloadFilePath = CLIENT_DATA_DIR .
'/' . $completePath;
93 $delivery = new \ilFileDelivery($downloadFilePath);
95 $delivery->setConvertFileNameToAsci(
true);
108 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId;
110 if (
true === $this->filesystem->hasDir($dirPath)) {
111 $this->filesystem->deleteDir($dirPath);
123 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId;
125 $completePath = $dirPath .
'/' . $objectId .
'_' . self::CERTIFICATE_FILENAME;
127 if ($this->filesystem->has($completePath)) {
128 $this->filesystem->delete($completePath);
141 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId .
'/' . $objectId .
'/';
142 $fileName = $objectId .
'_' . self::CERTIFICATE_FILENAME;
143 $completePath = $dirPath . $fileName;
144 if ($this->filesystem->has($completePath)) {
145 return CLIENT_DATA_DIR .
'/' . $completePath;
148 throw new ilException(sprintf(
'Certificate File does not exist in "%s"', $completePath));
Class ilPdfGeneratorConstantsTest.
deleteCertificateFile(int $userId, int $objectId)
deliverCertificate(int $userId, int $objectId)
const CERTIFICATE_FILENAME
const PERSISTENT_CERTIFICATES_DIRECTORY
deleteUserDirectory(int $userId)
createCertificateFile(int $userId, int $objectId)
createCertificateFilePath(int $userId, int $objectId)
__construct(Filesystem $filesystem=null, ilLogger $logger=null)
Component logger with individual log levels by component id.
Class FlySystemFileAccessTest.
static getValidFilename($a_filename)
Get valid filename.