◆ __construct()
ilPortfolioCertificateFileService::__construct |
( |
Filesystem |
$filesystem = null , |
|
|
Logger |
$logger = null |
|
) |
| |
◆ createCertificateFile()
ilPortfolioCertificateFileService::createCertificateFile |
( |
int |
$userId, |
|
|
int |
$objectId |
|
) |
| |
- Parameters
-
- Exceptions
-
Definition at line 51 of file class.ilPortfolioCertificateFileService.php.
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);
Class ilPdfGeneratorConstantsTest.
◆ createCertificateFilePath()
ilPortfolioCertificateFileService::createCertificateFilePath |
( |
int |
$userId, |
|
|
int |
$objectId |
|
) |
| |
- Parameters
-
- Returns
- string
- Exceptions
-
Definition at line 138 of file class.ilPortfolioCertificateFileService.php.
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));
◆ deleteCertificateFile()
ilPortfolioCertificateFileService::deleteCertificateFile |
( |
int |
$userId, |
|
|
int |
$objectId |
|
) |
| |
- Parameters
-
- Exceptions
-
Definition at line 120 of file class.ilPortfolioCertificateFileService.php.
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);
◆ deleteUserDirectory()
ilPortfolioCertificateFileService::deleteUserDirectory |
( |
int |
$userId | ) |
|
- Parameters
-
- Exceptions
-
Definition at line 105 of file class.ilPortfolioCertificateFileService.php.
107 $dirPath = self::PERSISTENT_CERTIFICATES_DIRECTORY . $userId;
109 if (
true === $this->filesystem->hasDir($dirPath)) {
110 $this->filesystem->deleteDir($dirPath);
◆ deliverCertificate()
ilPortfolioCertificateFileService::deliverCertificate |
( |
int |
$userId, |
|
|
int |
$objectId |
|
) |
| |
- Parameters
-
- Exceptions
-
Definition at line 80 of file class.ilPortfolioCertificateFileService.php.
References ilMimeTypeUtil\APPLICATION__PDF, and ilFileUtils\getValidFilename().
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);
static getValidFilename($a_filename)
Get valid filename.
◆ $filesystem
ilPortfolioCertificateFileService::$filesystem |
|
private |
◆ $logger
ilPortfolioCertificateFileService::$logger |
|
private |
◆ CERTIFICATE_FILENAME
const ilPortfolioCertificateFileService::CERTIFICATE_FILENAME = 'certificate.pdf' |
◆ PERSISTENT_CERTIFICATES_DIRECTORY
const ilPortfolioCertificateFileService::PERSISTENT_CERTIFICATES_DIRECTORY = 'PersistentCertificates/' |
The documentation for this class was generated from the following file: