19 declare(strict_types=1);
30 private readonly
int $objectId,
31 private readonly
string $certificatePath,
33 private readonly
string $installionId =
IL_INST_ID 39 $typeInFileName =
'not_defined';
40 if (
'crs' === $iliasType) {
41 $typeInFileName =
'course';
42 } elseif (
'tst' === $iliasType) {
43 $typeInFileName =
'test';
44 } elseif (
'exc' === $iliasType) {
45 $typeInFileName =
'exc';
46 } elseif (
'sahs' === $iliasType) {
47 $typeInFileName =
'scorm';
56 $certificateId = $this->objectId;
58 $directory = $this->webDirectory . $this->certificatePath . time() .
'__' . $this->installionId .
'__' . $type .
'__' . $certificateId .
'__certificate/';
72 $fh = fopen($dir . $filename,
'wb');
73 fwrite($fh, $pdfdata);
75 $this->files_added_to_archive =
true;
83 if (!$this->files_added_to_archive) {
84 throw new \ILIAS\Filesystem\Exception\IOException(
'No files added to archive directory');
87 $zipFile = time() .
'__' . $this->installionId .
'__' . $this->typeInFileName .
'__' . $this->objectId .
'__certificates.zip';
88 $zipFilePath = $this->webDirectory . $this->certificatePath . $zipFile;
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
addPDFtoArchiveDirectory(string $pdfdata, string $dir, string $filename)
Adds PDF data as a file to a given directory.
zipCertificatesInArchiveDirectory(string $dir, bool $deliver=true)
readonly string $typeInFileName
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static zip(string $a_dir, string $a_file, bool $compress_content=false)
__construct(private readonly int $objectId, private readonly string $certificatePath, private readonly string $webDirectory=CLIENT_WEB_DIR, private readonly string $installionId=IL_INST_ID)
static _lookupType(int $id, bool $reference=false)
bool $files_added_to_archive