19declare(strict_types=1);
52 string $certificatePath,
68 $this->httpWrapper =
$DIC->http()->wrapper();
69 $this->page_template =
$DIC->ui()->mainTemplate();
80 $database =
$DIC->database();
82 if (
null === $logger) {
83 $logger = $logger =
$DIC->logger()->cert();
102 $DIC->filesystem()->web()
112 if (
null === $filesystem) {
113 $filesystem =
$DIC->filesystem()->web();
116 if (
null === $backgroundImageFileService) {
122 $this->backGroundImageFileService = $backgroundImageFileService;
137 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
139 $command = $this->
ctrl->getCmd();
142 $form->setPreventDoubleSubmission(
false);
143 $form->setFormAction($this->
ctrl->getFormAction($certificateGUI));
144 $form->setTitle($this->
language->txt(
"cert_form_sec_availability"));
145 $form->setMultipart(
true);
146 $form->setTableWidth(
"100%");
147 $form->setId(
"certificate");
150 $form->addItem($active);
153 $import->setRequired(
false);
154 $import->setSuffixes([
"zip"]);
157 if (!empty($_FILES[
"certificate_import"][
"name"]) && $import->checkInput()) {
158 $result = $this->importAction->import(
159 $_FILES[
"certificate_import"][
"tmp_name"],
160 $_FILES[
"certificate_import"][
"name"]
162 if ($result ===
false) {
163 $this->page_template->setOnScreenMessage(
164 $this->page_template::MESSAGE_TYPE_FAILURE,
165 $this->
language->txt(
'certificate_error_import'),
168 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
170 $this->page_template->setOnScreenMessage(
171 $this->page_template::MESSAGE_TYPE_SUCCESS,
172 $this->
language->txt(
'saved_successfully'),
175 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
178 $form->addItem($import);
181 $formSection->setTitle($this->
language->txt(
"cert_form_sec_layout"));
182 $form->addItem($formSection);
185 $pageformats = $this->pageFormats->fetchPageFormats();
187 foreach ($pageformats as
$format) {
190 if (strcmp(
$format[
"value"],
"custom") === 0) {
192 $pageheight->setSize(6);
193 $pageheight->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
194 $pageheight->setInfo($this->
language->txt(
"certificate_unit_description"));
195 $pageheight->setRequired(
true);
196 $option->addSubItem($pageheight);
199 $pagewidth->setSize(6);
200 $pagewidth->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
201 $pagewidth->setInfo($this->
language->txt(
"certificate_unit_description"));
202 $pagewidth->setRequired(
true);
203 $option->addSubItem($pagewidth);
206 $pageformat->addOption($option);
209 $pageformat->setRequired(
true);
211 if (strcmp($command,
"certificateSave") === 0) {
212 $pageformat->checkInput();
215 $form->addItem($pageformat);
218 $bgimage->setRequired(
false);
219 $bgimage->setUseCache(
false);
221 $bgimage->setAllowDeletion(
true);
222 if (!$this->backGroundImageFileService->hasBackgroundImage($certificateTemplate)) {
223 if ($this->global_certificate_settings->hasBackgroundImage()) {
226 $bgimage->setImage($imagePath);
227 $bgimage->setAllowDeletion(
false);
232 $thumbnail_path = $this->backGroundImageFileService->getBackgroundImageThumbPath();
234 if (!is_file($thumbnail_path)) {
236 $thumbnail_path =
CLIENT_WEB_DIR . $certificateTemplate->getBackgroundImagePath() .
'.thumb.jpg';
237 if (!is_file($thumbnail_path)) {
239 $thumbnail_path = $this->global_certificate_settings->getDefaultBackgroundImageThumbPath();
240 if (!is_file($thumbnail_path)) {
242 $thumbnail_path =
'';
245 $bgimage->setALlowDeletion(
false);
248 $bgimage->setImage($imagePath);
251 $form->addItem($bgimage);
254 $this->
language->txt(
'certificate_card_thumbnail_image'),
255 'certificate_card_thumbnail_image'
257 $thumbnailImage->setRequired(
false);
258 $thumbnailImage->setUseCache(
false);
259 $thumbnailImage->setSuffixes([
'svg']);
261 $allowThumbnailDeletion =
false;
263 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
264 if (
'' !== $cardThumbnailImagePath) {
265 $presentationThumbnailImagePath =
CLIENT_WEB_DIR . $cardThumbnailImagePath;
267 $allowThumbnailDeletion =
true;
270 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
272 $form->addItem($thumbnailImage);
275 $rect->setRequired(
true);
276 $rect->setUseUnits(
true);
277 $rect->setInfo($this->
language->txt(
"certificate_unit_description"));
279 if (strcmp($command,
"certificateSave") === 0) {
283 $form->addItem($rect);
286 $certificate->setInfo($this->
language->txt(
'certificate_text_info'));
287 $certificate->removePlugin(
'ilimgupload');
288 $certificate->setRequired(
true);
289 $certificate->setRows(20);
290 $certificate->setCols(80);
292 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
294 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
296 $certificate->setInfo($placeholderDescriptionInHtml);
298 $certificate->setUseRte(
true,
'3.4.7');
313 $certificate->setRteTags($tags);
315 if (strcmp($command,
"certificateSave") === 0) {
316 $certificate->checkInput();
319 $form->addItem($certificate);
321 if (
true === $this->hasAdditionalElements) {
323 $formSection->setTitle($this->
language->txt(
"cert_form_sec_add_features"));
324 $form->addItem($formSection);
327 if ($this->
access->checkAccess(
330 $this->httpWrapper->query()->retrieve(
"ref_id", $this->refinery->kindlyTo()->int())
332 if ($certificateTemplate->isCurrentlyActive()) {
333 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($certificateGUI));
336 $preview->setCaption(
'certificate_preview');
337 $preview->setCommand(
'certificatePreview');
341 $export->setCaption(
'certificate_export');
342 $export->setCommand(
'certificateExportFO');
343 $this->
toolbar->addButtonInstance($export);
346 $delete->setCaption(
'delete');
347 $delete->setCommand(
'certificateDelete');
348 $this->
toolbar->addButtonInstance($delete);
350 $form->addCommandButton(
"certificateSave", $this->
language->txt(
"save"));
356 public function save(array $formFields): void
366 return $this->formFieldParser->fetchDefaultFormFields($content);
Class FileAlreadyExistsException.
Class FileNotFoundException.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class to create PDF certificates.
Component logger with individual log levels by component id.
Class ilObjCertificateSettings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
static signFile(string $path_to_file)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...