116 $database =
$DIC->database();
119 if (
null === $logger) {
120 $logger = $logger =
$DIC->logger()->cert();
139 $DIC->filesystem()->web()
149 if (
null === $filesystem) {
150 $filesystem =
$DIC->filesystem()->web();
153 if (
null === $backgroundImageFileService) {
159 $this->backGroundImageFileService = $backgroundImageFileService;
176 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
178 $command = $this->controller->getCmd();
181 $form->setPreventDoubleSubmission(
false);
182 $form->setFormAction($this->controller->getFormAction($certificateGUI));
183 $form->setTitle($this->
language->txt(
"cert_form_sec_availability"));
184 $form->setMultipart(
true);
185 $form->setTableWidth(
"100%");
186 $form->setId(
"certificate");
189 $form->addItem($active);
192 $import->setRequired(
false);
193 $import->setSuffixes(array(
"zip"));
196 if (strlen($_FILES[
"certificate_import"][
"name"])) {
197 if ($import->checkInput()) {
198 $result = $this->importAction->import($_FILES[
"certificate_import"][
"tmp_name"], $_FILES[
"certificate_import"][
"name"]);
200 $import->setAlert($this->
language->txt(
"certificate_error_import"));
202 $this->controller->redirect($certificateGUI,
"certificateEditor");
206 $form->addItem($import);
208 $formSection = new \ilFormSectionHeaderGUI();
209 $formSection->setTitle($this->
language->txt(
"cert_form_sec_layout"));
210 $form->addItem($formSection);
213 $pageformats = $this->pageFormats->fetchPageFormats();
215 foreach ($pageformats as
$format) {
218 if (strcmp(
$format[
"value"],
"custom") == 0) {
220 $pageheight->setSize(6);
221 $pageheight->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
222 $pageheight->setInfo($this->
language->txt(
"certificate_unit_description"));
223 $pageheight->setRequired(
true);
224 $option->addSubitem($pageheight);
227 $pagewidth->setSize(6);
228 $pagewidth->setValidationRegexp(
'/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
229 $pagewidth->setInfo($this->
language->txt(
"certificate_unit_description"));
230 $pagewidth->setRequired(
true);
231 $option->addSubitem($pagewidth);
234 $pageformat->addOption($option);
237 $pageformat->setRequired(
true);
239 if (strcmp($command,
"certificateSave") == 0) {
240 $pageformat->checkInput();
243 $form->addItem($pageformat);
246 $bgimage->setRequired(
false);
247 $bgimage->setUseCache(
false);
249 $bgimage->setALlowDeletion(
true);
250 if (!$this->backGroundImageFileService->hasBackgroundImage($certificateTemplate)) {
254 $bgimage->setImage($imagePath);
255 $bgimage->setALlowDeletion(
false);
260 $thumbnailPath = $this->backGroundImageFileService->getBackgroundImageThumbPath();
262 if (!file_exists($thumbnailPath)) {
264 $bgimage->setALlowDeletion(
false);
267 $bgimage->setImage($imagePath);
270 $form->addItem($bgimage);
272 $thumbnailImage =
new ilImageFileInputGUI($this->
language->txt(
'certificate_card_thumbnail_image'),
'certificate_card_thumbnail_image');
273 $thumbnailImage->setRequired(
false);
274 $thumbnailImage->setUseCache(
false);
275 $thumbnailImage->setSuffixes(array(
'svg'));
277 $allowThumbnailDeletion =
false;
279 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
280 if (
'' !== $cardThumbnailImagePath) {
281 $presentationThumbnailImagePath = CLIENT_WEB_DIR . $cardThumbnailImagePath;
283 $allowThumbnailDeletion =
true;
286 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
288 $form->addItem($thumbnailImage);
291 $rect->setRequired(
true);
292 $rect->setUseUnits(
true);
293 $rect->setInfo($this->
language->txt(
"certificate_unit_description"));
295 if (strcmp($command,
"certificateSave") == 0) {
299 $form->addItem($rect);
302 $certificate->removePlugin(
'ilimgupload');
303 $certificate->setRequired(
true);
304 $certificate->setRows(20);
305 $certificate->setCols(80);
307 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
309 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
311 $certificate->setInfo($placeholderDescriptionInHtml);
313 $certificate->setUseRte(
true,
'3.4.7');
328 $certificate->setRteTags($tags);
330 if (strcmp($command,
"certificateSave") == 0) {
331 $certificate->checkInput();
334 $form->addItem($certificate);
336 if (
true === $this->hasAdditionalElements) {
337 $formSection = new \ilFormSectionHeaderGUI();
338 $formSection->setTitle($this->
language->txt(
"cert_form_sec_add_features"));
339 $form->addItem($formSection);
342 if ($this->access->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
343 if ($certificateTemplate->isCurrentlyActive()) {
344 $this->toolbar->setFormAction($this->controller->getFormAction($certificateGUI));
347 $preview->setCaption(
'certificate_preview');
348 $preview->setCommand(
'certificatePreview');
349 $this->toolbar->addStickyItem(
$preview);
352 $export->setCaption(
'certificate_export');
353 $export->setCommand(
'certificateExportFO');
354 $this->toolbar->addButtonInstance($export);
357 $delete->setCaption(
'delete');
358 $delete->setCommand(
'certificateDelete');
359 $this->toolbar->addButtonInstance($delete);
361 $form->addCommandButton(
"certificateSave", $this->
language->txt(
"save"));
371 public function save(array $formFields)
381 return $this->formFieldParser->fetchDefaultFormFields($content);
An exception for terminatinating execution or to throw for unit testing.
GUI class to create PDF certificates.
This class provides processing control methods.
Component logger with individual log levels by component id.
static hasBackgroundImage()
Returns wheather or not a default background image exists.
static getBackgroundImageThumbPath()
Returns the filesystem path of the background image thumbnail.
static getBackgroundImageThumbPathWeb()
Returns the web path of the background image thumbnail.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static signFile($path_to_file)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
Class FlySystemFileAccessTest.
Class ChatMainBarProvider \MainMenu\Provider.