19declare(strict_types=1);
51 private readonly
int $objectId,
52 string $certificatePath,
53 private readonly
bool $hasAdditionalElements,
60 ?UiRenderer $ui_renderer =
null,
70 $this->httpWrapper =
$DIC->http()->wrapper();
72 $this->page_template =
$DIC->ui()->mainTemplate();
76 $this->irss =
$DIC->resourceStorage();
83 $placeholderDescriptionObject,
84 $logger ??
$DIC->logger()->cert(),
90 $logger ??
$DIC->logger()->cert()
109 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
111 $command = $this->
ctrl->getCmd() ??
'';
114 $form->setPreventDoubleSubmission(
false);
115 $form->setFormAction($this->
ctrl->getFormAction($certificateGUI,
'certificateEditor'));
116 $form->setTitle($this->
language->txt(
'cert_form_sec_availability'));
117 $form->setMultipart(
true);
118 $form->setTableWidth(
'100%');
119 $form->setId(
'certificate');
122 $form->addItem($active);
125 $import->setRequired(
false);
126 $import->setSuffixes([
'zip']);
129 if (!empty($_FILES[
'certificate_import'][
'name']) && $import->checkInput()) {
130 $result = $this->importAction->import(
131 $_FILES[
'certificate_import'][
'tmp_name'],
132 $_FILES[
'certificate_import'][
'name']
135 $this->page_template->setOnScreenMessage(
136 $this->page_template::MESSAGE_TYPE_SUCCESS,
137 $this->
language->txt(
'saved_successfully'),
140 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
142 $this->page_template->setOnScreenMessage(
143 $this->page_template::MESSAGE_TYPE_FAILURE,
144 $this->
language->txt(
'certificate_error_import'),
147 $this->
ctrl->redirect($certificateGUI,
'certificateEditor');
150 $form->addItem($import);
153 $formSection->setTitle($this->
language->txt(
'cert_form_sec_layout'));
154 $form->addItem($formSection);
157 $pageformats = $this->pageFormats->fetchPageFormats();
159 foreach ($pageformats as $format) {
160 $option =
new ilRadioOption($format[
'name'], $format[
'value']);
162 if (strcmp($format[
'value'],
'custom') === 0) {
164 $pageheight->setSize(6);
165 $pageheight->setValidationRegexp(
166 '/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is'
168 $pageheight->setInfo($this->
language->txt(
'certificate_unit_description'));
169 $pageheight->setRequired(
true);
170 $option->addSubItem($pageheight);
173 $pagewidth->setSize(6);
174 $pagewidth->setValidationRegexp(
175 '/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is'
177 $pagewidth->setInfo($this->
language->txt(
'certificate_unit_description'));
178 $pagewidth->setRequired(
true);
179 $option->addSubItem($pagewidth);
182 $pageformat->addOption($option);
185 $pageformat->setRequired(
true);
187 if (strcmp($command,
'certificateSave') === 0) {
188 $pageformat->checkInput();
191 $form->addItem($pageformat);
194 $bgimage->setRequired(
false);
195 $bgimage->setUseCache(
false);
197 $bgimage->setAllowDeletion(
true);
198 $bg_image_rid = $certificateTemplate->getBackgroundImageIdentification();
201 $this->global_certificate_settings->getBackgroundImageIdentification() instanceof
ResourceIdentification &&
202 $bg_image_rid === $this->global_certificate_settings->getBackgroundImageIdentification()->
serialize()
204 !$certificateTemplate->getBackgroundImageIdentification() ||
205 !$this->irss->manage()->find(
206 $certificateTemplate->getBackgroundImageIdentification()
209 $identification = $this->global_certificate_settings->getBackgroundImageIdentification();
210 $bgimage->setAllowDeletion(
false);
212 $identification = $this->irss->manage()->find($bg_image_rid);
215 $background_flavour = $this->irss->flavours()->get(
217 $this->tile_image_definition
219 $flavour_urls = $this->irss->consume()->flavourUrls($background_flavour);
220 foreach ($flavour_urls->getURLs(
true) as
$url) {
222 $bgimage->setImage(
$url);
226 $form->addItem($bgimage);
229 $this->
language->txt(
'certificate_card_tile_image'),
230 'certificate_card_tile_image'
232 $tile_image->setRequired(
false);
233 $tile_image->setUseCache(
false);
234 $tile_image->setSuffixes([
'svg']);
236 $allow_tile_image_deletion =
false;
238 $tile_image_identification = $certificateTemplate->getTileImageIdentification();
239 if (
'' !== $tile_image_identification) {
240 $identification = $this->irss->manage()->find($tile_image_identification);
242 $tile_image->setImage($this->irss->consume()->src($identification)->getSrc(
true));
243 $allow_tile_image_deletion =
true;
247 $tile_image->setAllowDeletion($allow_tile_image_deletion);
249 $form->addItem($tile_image);
252 $rect->setRequired(
true);
253 $rect->setUseUnits(
true);
254 $rect->setInfo($this->
language->txt(
'certificate_unit_description'));
256 if (strcmp($command,
'certificateSave') === 0) {
260 $form->addItem($rect);
263 $certificate->setRequired(
true);
264 $certificate->setRows(20);
265 $certificate->setCols(80);
267 $certificate->setInfo(
268 $this->
language->txt(
'certificate_text_info') . $this->placeholderDescriptionObject->createPlaceholderHtmlDescription()
271 $certificate->setUseRte(
true,
'3.4.7');
286 $certificate->setRteTags($tags);
288 if (strcmp($command,
'certificateSave') === 0) {
289 $certificate->checkInput();
292 $form->addItem($certificate);
294 if ($this->hasAdditionalElements) {
296 $formSection->setTitle($this->
language->txt(
'cert_form_sec_add_features'));
297 $form->addItem($formSection);
300 if ($this->
access->checkAccess(
303 $this->httpWrapper->query()->retrieve(
'ref_id', $this->refinery->kindlyTo()->int())
305 if ($certificateTemplate->isCurrentlyActive()) {
306 $preview_button = $this->ui_factory->button()->standard(
307 $this->
language->txt(
'certificate_preview'),
308 $this->ctrl->getLinkTarget($certificateGUI,
'certificatePreview')
310 $export_button = $this->ui_factory->button()->standard(
311 $this->
language->txt(
'certificate_export'),
312 $this->ctrl->getLinkTarget($certificateGUI,
'certificateExportFO')
314 $delete_button = $this->ui_factory->button()->standard(
316 $this->ctrl->getLinkTarget($certificateGUI,
'certificateDelete')
319 $this->
toolbar->addStickyItem($preview_button);
320 $this->
toolbar->addComponent($export_button);
321 $this->
toolbar->addComponent($delete_button);
323 $form->addCommandButton(
'certificateSave', $this->
language->txt(
'save'));
329 public function save(array $formFields): void
338 return $this->formFieldParser->fetchDefaultFormFields($content);
Builds a Color from either hex- or rgb values.
Indicates that a file is missing or not found.
Indicates general problems with the input or output operations.
Class ResourceIdentification.
GUI class to create PDF certificates.
Component logger with individual log levels by component id.
Class ilObjCertificateSettings.
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.
The filesystem interface provides the public interface for the Filesystem service API consumer.
An entity that renders components to a string output.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...