19 declare(strict_types=1);
32 private readonly
int $objectId,
33 private readonly
string $certificatePath,
35 private readonly
string $installationId =
IL_INST_ID 41 $typeInFileName =
'not_defined';
42 if (
'crs' === $iliasType) {
43 $typeInFileName =
'course';
44 } elseif (
'tst' === $iliasType) {
45 $typeInFileName =
'test';
46 } elseif (
'exc' === $iliasType) {
47 $typeInFileName =
'exc';
48 } elseif (
'sahs' === $iliasType) {
49 $typeInFileName =
'scorm';
58 $certificateId = $this->objectId;
60 $directory = $this->webDirectory . $this->certificatePath . time() .
61 '__' . $this->installationId .
'__' . $type .
'__' . $certificateId .
'__certificate/';
75 $fh = fopen($dir . $filename,
'wb');
76 fwrite($fh, $pdfdata);
78 $this->files_added_to_archive =
true;
86 if (!$this->files_added_to_archive) {
87 throw new IOException(
'No files added to archive directory');
91 ) .
'__' . $this->installationId .
'__' . $this->typeInFileName .
'__' . $this->objectId .
'__certificates.zip';
92 $zipFilePath = $this->webDirectory . $this->certificatePath . $zipFile;
Indicates general problems with the input or output operations.
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
__construct(private readonly int $objectId, private readonly string $certificatePath, private readonly string $webDirectory=CLIENT_WEB_DIR, private readonly string $installationId=IL_INST_ID)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static _lookupType(int $id, bool $reference=false)
bool $files_added_to_archive