19declare(strict_types=1);
52 string $certificatePath,
69 $this->httpWrapper =
$DIC->http()->wrapper();
70 $this->page_template =
$DIC->ui()->mainTemplate();
81 $database =
$DIC->database();
83 if (
null === $logger) {
84 $logger = $logger =
$DIC->logger()->cert();
97 if (
null === $web_fs) {
98 $web_fs =
$DIC->filesystem()->web();
100 if (
null === $tmp_fs) {
101 $tmp_fs =
$DIC->filesystem()->temp();
121 if (
null === $backgroundImageFileService) {
127 $this->backGroundImageFileService = $backgroundImageFileService;
142 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
144 $command = $this->
ctrl->getCmd();
147 $form->setPreventDoubleSubmission(
false);
148 $form->setFormAction($this->
ctrl->getFormAction($certificateGUI));
149 $form->setTitle($this->
language->txt(
"cert_form_sec_availability"));
150 $form->setMultipart(
true);
151 $form->setTableWidth(
"100%");
152 $form->setId(
"certificate");
155 $form->addItem($active);
158 $import->setRequired(
false);
159 $import->setSuffixes([
"zip"]);
162 if (!empty($_FILES[
"certificate_import"][
"name"]) && $import->checkInput()) {
163 $result = $this->importAction->import(
164 $_FILES[
"certificate_import"][
"tmp_name"],
165 $_FILES[
"certificate_import"][
"name"]
167 if ($result ===
false) {
168 $this->page_template->setOnScreenMessage(
169 $this->page_template::MESSAGE_TYPE_FAILURE,
170 $this->
language->txt(
'certificate_error_import'),
173 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
175 $this->page_template->setOnScreenMessage(
176 $this->page_template::MESSAGE_TYPE_SUCCESS,
177 $this->
language->txt(
'saved_successfully'),
180 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
183 $form->addItem($import);
186 $formSection->setTitle($this->
language->txt(
"cert_form_sec_layout"));
187 $form->addItem($formSection);
190 $pageformats = $this->pageFormats->fetchPageFormats();
192 foreach ($pageformats as
$format) {
195 if (strcmp(
$format[
"value"],
"custom") === 0) {
197 $pageheight->setSize(6);
198 $pageheight->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
199 $pageheight->setInfo($this->
language->txt(
"certificate_unit_description"));
200 $pageheight->setRequired(
true);
201 $option->addSubItem($pageheight);
204 $pagewidth->setSize(6);
205 $pagewidth->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
206 $pagewidth->setInfo($this->
language->txt(
"certificate_unit_description"));
207 $pagewidth->setRequired(
true);
208 $option->addSubItem($pagewidth);
211 $pageformat->addOption($option);
214 $pageformat->setRequired(
true);
216 if (strcmp($command,
"certificateSave") === 0) {
217 $pageformat->checkInput();
220 $form->addItem($pageformat);
223 $bgimage->setRequired(
false);
224 $bgimage->setUseCache(
false);
226 $bgimage->setAllowDeletion(
true);
227 if (!$this->backGroundImageFileService->hasBackgroundImage($certificateTemplate)) {
228 if ($this->global_certificate_settings->hasBackgroundImage()) {
231 $bgimage->setImage($imagePath);
232 $bgimage->setAllowDeletion(
false);
237 $thumbnail_path = $this->backGroundImageFileService->getBackgroundImageThumbPath();
239 if (!is_file($thumbnail_path)) {
241 $thumbnail_path =
CLIENT_WEB_DIR . $certificateTemplate->getBackgroundImagePath() .
'.thumb.jpg';
242 if (!is_file($thumbnail_path)) {
244 $thumbnail_path = $this->global_certificate_settings->getDefaultBackgroundImageThumbPath();
245 if (!is_file($thumbnail_path)) {
247 $thumbnail_path =
'';
250 $bgimage->setALlowDeletion(
false);
253 $bgimage->setImage($imagePath);
256 $form->addItem($bgimage);
259 $this->
language->txt(
'certificate_card_thumbnail_image'),
260 'certificate_card_thumbnail_image'
262 $thumbnailImage->setRequired(
false);
263 $thumbnailImage->setUseCache(
false);
264 $thumbnailImage->setSuffixes([
'svg']);
266 $allowThumbnailDeletion =
false;
268 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
269 if (
'' !== $cardThumbnailImagePath) {
270 $presentationThumbnailImagePath =
CLIENT_WEB_DIR . $cardThumbnailImagePath;
272 $allowThumbnailDeletion =
true;
275 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
277 $form->addItem($thumbnailImage);
280 $rect->setRequired(
true);
281 $rect->setUseUnits(
true);
282 $rect->setInfo($this->
language->txt(
"certificate_unit_description"));
284 if (strcmp($command,
"certificateSave") === 0) {
288 $form->addItem($rect);
291 $certificate->setInfo($this->
language->txt(
'certificate_text_info'));
292 $certificate->removePlugin(
'ilimgupload');
293 $certificate->setRequired(
true);
294 $certificate->setRows(20);
295 $certificate->setCols(80);
297 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
299 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
301 $certificate->setInfo($placeholderDescriptionInHtml);
303 $certificate->setUseRte(
true,
'3.4.7');
318 $certificate->setRteTags($tags);
320 if (strcmp($command,
"certificateSave") === 0) {
321 $certificate->checkInput();
324 $form->addItem($certificate);
326 if (
true === $this->hasAdditionalElements) {
328 $formSection->setTitle($this->
language->txt(
"cert_form_sec_add_features"));
329 $form->addItem($formSection);
332 if ($this->
access->checkAccess(
335 $this->httpWrapper->query()->retrieve(
"ref_id", $this->refinery->kindlyTo()->int())
337 if ($certificateTemplate->isCurrentlyActive()) {
338 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($certificateGUI));
341 $preview->setCaption(
'certificate_preview');
342 $preview->setCommand(
'certificatePreview');
346 $export->setCaption(
'certificate_export');
347 $export->setCommand(
'certificateExportFO');
348 $this->
toolbar->addButtonInstance($export);
351 $delete->setCaption(
'delete');
352 $delete->setCommand(
'certificateDelete');
353 $this->
toolbar->addButtonInstance($delete);
355 $form->addCommandButton(
"certificateSave", $this->
language->txt(
"save"));
361 public function save(array $formFields): void
371 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...