136 {
137 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
138
139 $command = $this->
ctrl->getCmd();
140
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");
148
150 $form->addItem($active);
151
153 $import->setRequired(false);
154 $import->setSuffixes(["zip"]);
155
156
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"]
161 );
162 if ($result === false) {
163 $this->page_template->setOnScreenMessage(
164 $this->page_template::MESSAGE_TYPE_FAILURE,
165 $this->
language->txt(
'certificate_error_import'),
166 true
167 );
168 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
169 } else {
170 $this->page_template->setOnScreenMessage(
171 $this->page_template::MESSAGE_TYPE_SUCCESS,
172 $this->
language->txt(
'saved_successfully'),
173 true
174 );
175 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
176 }
177 }
178 $form->addItem($import);
179
181 $formSection->setTitle($this->
language->txt(
"cert_form_sec_layout"));
182 $form->addItem($formSection);
183
185 $pageformats = $this->pageFormats->fetchPageFormats();
186
187 foreach ($pageformats as
$format) {
189
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);
197
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);
204 }
205
206 $pageformat->addOption($option);
207 }
208
209 $pageformat->setRequired(true);
210
211 if (strcmp($command, "certificateSave") === 0) {
212 $pageformat->checkInput();
213 }
214
215 $form->addItem($pageformat);
216
218 $bgimage->setRequired(false);
219 $bgimage->setUseCache(false);
220
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);
228 }
229 } else {
231
232 $thumbnail_path = $this->backGroundImageFileService->getBackgroundImageThumbPath();
233
234 if (!is_file($thumbnail_path)) {
235
236 $thumbnail_path =
CLIENT_WEB_DIR . $certificateTemplate->getBackgroundImagePath() .
'.thumb.jpg';
237 if (!is_file($thumbnail_path)) {
238
239 $thumbnail_path = $this->global_certificate_settings->getDefaultBackgroundImageThumbPath();
240 if (!is_file($thumbnail_path)) {
241
242 $thumbnail_path = '';
243 }
244 }
245 $bgimage->setALlowDeletion(false);
246 }
248 $bgimage->setImage($imagePath);
249 }
250
251 $form->addItem($bgimage);
252
254 $this->
language->txt(
'certificate_card_thumbnail_image'),
255 'certificate_card_thumbnail_image'
256 );
257 $thumbnailImage->setRequired(false);
258 $thumbnailImage->setUseCache(false);
259 $thumbnailImage->setSuffixes(['svg']);
260
261 $allowThumbnailDeletion = false;
262
263 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
264 if ('' !== $cardThumbnailImagePath) {
265 $presentationThumbnailImagePath =
CLIENT_WEB_DIR . $cardThumbnailImagePath;
267 $allowThumbnailDeletion = true;
268 }
269
270 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
271
272 $form->addItem($thumbnailImage);
273
275 $rect->setRequired(true);
276 $rect->setUseUnits(true);
277 $rect->setInfo($this->
language->txt(
"certificate_unit_description"));
278
279 if (strcmp($command, "certificateSave") === 0) {
280 $rect->checkInput();
281 }
282
283 $form->addItem($rect);
284
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);
291
292 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
293
294 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
295
296 $certificate->setInfo($placeholderDescriptionInHtml);
297
298 $certificate->setUseRte(true, '3.4.7');
299
300 $tags = [
301 "br",
302 "em",
303 "font",
304 "li",
305 "ol",
306 "p",
307 "span",
308 "strong",
309 "u",
310 "ul"
311 ];
312
313 $certificate->setRteTags($tags);
314
315 if (strcmp($command, "certificateSave") === 0) {
316 $certificate->checkInput();
317 }
318
319 $form->addItem($certificate);
320
321 if (true === $this->hasAdditionalElements) {
323 $formSection->setTitle($this->
language->txt(
"cert_form_sec_add_features"));
324 $form->addItem($formSection);
325 }
326
327 if ($this->
access->checkAccess(
328 "write",
329 "",
330 $this->httpWrapper->query()->retrieve("ref_id", $this->refinery->kindlyTo()->int())
331 )) {
332 if ($certificateTemplate->isCurrentlyActive()) {
333 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($certificateGUI));
334
336 $preview->setCaption(
'certificate_preview');
337 $preview->setCommand(
'certificatePreview');
339
341 $export->setCaption('certificate_export');
342 $export->setCommand('certificateExportFO');
343 $this->
toolbar->addButtonInstance($export);
344
346 $delete->setCaption('delete');
347 $delete->setCommand('certificateDelete');
348 $this->
toolbar->addButtonInstance($delete);
349 }
350 $form->addCommandButton(
"certificateSave", $this->
language->txt(
"save"));
351 }
352
353 return $form;
354 }
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)