141 {
142 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
143
144 $command = $this->
ctrl->getCmd();
145
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");
153
155 $form->addItem($active);
156
158 $import->setRequired(false);
159 $import->setSuffixes(["zip"]);
160
161
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"]
166 );
167 if ($result === false) {
168 $this->page_template->setOnScreenMessage(
169 $this->page_template::MESSAGE_TYPE_FAILURE,
170 $this->
language->txt(
'certificate_error_import'),
171 true
172 );
173 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
174 } else {
175 $this->page_template->setOnScreenMessage(
176 $this->page_template::MESSAGE_TYPE_SUCCESS,
177 $this->
language->txt(
'saved_successfully'),
178 true
179 );
180 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
181 }
182 }
183 $form->addItem($import);
184
186 $formSection->setTitle($this->
language->txt(
"cert_form_sec_layout"));
187 $form->addItem($formSection);
188
190 $pageformats = $this->pageFormats->fetchPageFormats();
191
192 foreach ($pageformats as
$format) {
194
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);
202
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);
209 }
210
211 $pageformat->addOption($option);
212 }
213
214 $pageformat->setRequired(true);
215
216 if (strcmp($command, "certificateSave") === 0) {
217 $pageformat->checkInput();
218 }
219
220 $form->addItem($pageformat);
221
223 $bgimage->setRequired(false);
224 $bgimage->setUseCache(false);
225
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);
233 }
234 } else {
236
237 $thumbnail_path = $this->backGroundImageFileService->getBackgroundImageThumbPath();
238
239 if (!is_file($thumbnail_path)) {
240
241 $thumbnail_path =
CLIENT_WEB_DIR . $certificateTemplate->getBackgroundImagePath() .
'.thumb.jpg';
242 if (!is_file($thumbnail_path)) {
243
244 $thumbnail_path = $this->global_certificate_settings->getDefaultBackgroundImageThumbPath();
245 if (!is_file($thumbnail_path)) {
246
247 $thumbnail_path = '';
248 }
249 }
250 $bgimage->setALlowDeletion(false);
251 }
253 $bgimage->setImage($imagePath);
254 }
255
256 $form->addItem($bgimage);
257
259 $this->
language->txt(
'certificate_card_thumbnail_image'),
260 'certificate_card_thumbnail_image'
261 );
262 $thumbnailImage->setRequired(false);
263 $thumbnailImage->setUseCache(false);
264 $thumbnailImage->setSuffixes(['svg']);
265
266 $allowThumbnailDeletion = false;
267
268 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
269 if ('' !== $cardThumbnailImagePath) {
270 $presentationThumbnailImagePath =
CLIENT_WEB_DIR . $cardThumbnailImagePath;
272 $allowThumbnailDeletion = true;
273 }
274
275 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
276
277 $form->addItem($thumbnailImage);
278
280 $rect->setRequired(true);
281 $rect->setUseUnits(true);
282 $rect->setInfo($this->
language->txt(
"certificate_unit_description"));
283
284 if (strcmp($command, "certificateSave") === 0) {
285 $rect->checkInput();
286 }
287
288 $form->addItem($rect);
289
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);
296
297 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
298
299 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
300
301 $certificate->setInfo($placeholderDescriptionInHtml);
302
303 $certificate->setUseRte(true, '3.4.7');
304
305 $tags = [
306 "br",
307 "em",
308 "font",
309 "li",
310 "ol",
311 "p",
312 "span",
313 "strong",
314 "u",
315 "ul"
316 ];
317
318 $certificate->setRteTags($tags);
319
320 if (strcmp($command, "certificateSave") === 0) {
321 $certificate->checkInput();
322 }
323
324 $form->addItem($certificate);
325
326 if (true === $this->hasAdditionalElements) {
328 $formSection->setTitle($this->
language->txt(
"cert_form_sec_add_features"));
329 $form->addItem($formSection);
330 }
331
332 if ($this->
access->checkAccess(
333 "write",
334 "",
335 $this->httpWrapper->query()->retrieve("ref_id", $this->refinery->kindlyTo()->int())
336 )) {
337 if ($certificateTemplate->isCurrentlyActive()) {
338 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($certificateGUI));
339
341 $preview->setCaption(
'certificate_preview');
342 $preview->setCommand(
'certificatePreview');
344
346 $export->setCaption('certificate_export');
347 $export->setCommand('certificateExportFO');
348 $this->
toolbar->addButtonInstance($export);
349
351 $delete->setCaption('delete');
352 $delete->setCommand('certificateDelete');
353 $this->
toolbar->addButtonInstance($delete);
354 }
355 $form->addCommandButton(
"certificateSave", $this->
language->txt(
"save"));
356 }
357
358 return $form;
359 }
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)