39 $logger = $DIC->logger()->root();
55 $userCertificate = $userCertificateRepository->fetchActiveCertificate($userId, $objectId);
57 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId .
'/' . $objectId;
58 if (
false === $this->filesystem->hasDir($dirPath)) {
59 $this->filesystem->createDir($dirPath);
62 $pdfGenerator =
new ilPdfGenerator($userCertificateRepository, $this->logger);
64 $pdfScalar = $pdfGenerator->generate($userCertificate->getId());
66 $completePath = $dirPath .
'/' . $objectId .
'_' . self::CERTIFICATE_FILENAME;
67 if ($this->filesystem->has($completePath)) {
68 $this->filesystem->delete($completePath);
71 $this->filesystem->write($completePath, $pdfScalar);
82 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId .
'/' . $objectId;
83 $fileName = $objectId .
'_' . self::CERTIFICATE_FILENAME;
85 $completePath = $dirPath .
'/' . $fileName;
86 if ($this->filesystem->has($completePath)) {
89 $userCertificate = $userCertificateRepository->fetchActiveCertificateForPresentation($userId, $objectId);
91 $downloadFilePath = CLIENT_DATA_DIR .
'/' . $completePath;
92 $delivery = new \ilFileDelivery($downloadFilePath);
94 $delivery->setConvertFileNameToAsci(
true);
107 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId;
109 if (
true === $this->filesystem->hasDir($dirPath)) {
110 $this->filesystem->deleteDir($dirPath);
122 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId;
124 $completePath = $dirPath .
'/' . $objectId .
'_' . self::CERTIFICATE_FILENAME;
126 if ($this->filesystem->has($completePath)) {
127 $this->filesystem->delete($completePath);
140 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId .
'/' . $objectId .
'/';
141 $fileName = $objectId .
'_' . self::CERTIFICATE_FILENAME;
142 $completePath = $dirPath . $fileName;
143 if ($this->filesystem->has($completePath)) {
144 return CLIENT_DATA_DIR .
'/' . $completePath;
147 throw new ilException(sprintf(
'Certificate File does not exist in "%"', $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, Logger $logger=null)
Class FlySystemFileAccessTest.
static getValidFilename($a_filename)
Get valid filename.