ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCertificateSettingsFormRepository Class Reference
+ Inheritance diagram for ilCertificateSettingsFormRepository:
+ Collaboration diagram for ilCertificateSettingsFormRepository:

Public Member Functions

 __construct (int $objectId, string $certificatePath, bool $hasAdditionalElements, ilLanguage $language, ilCtrl $controller, ilAccess $access, ilToolbarGUI $toolbar, ilCertificatePlaceholderDescription $placeholderDescriptionObject, ilPageFormats $pageFormats=null, ilFormFieldParser $formFieldParser=null, ilCertificateTemplateImportAction $importAction=null, ilLogger $logger=null, ilCertificateTemplateRepository $templateRepository=null, \ILIAS\Filesystem\Filesystem $filesystem=null, ilCertificateBackgroundImageFileService $backgroundImageFileService=null)
 
 createForm (ilCertificateGUI $certificateGUI)
 
 save (array $formFields)
 
 fetchFormFieldData (string $content)
 
 createForm (ilCertificateGUI $certificateGUI)
 
 save (array $formFields)
 
 fetchFormFieldData (string $content)
 

Private Attributes

 $objectId
 
 $language
 
 $controller
 
 $access
 
 $toolbar
 
 $placeholderDescriptionObject
 
 $pageFormats
 
 $formFieldParser
 
 $importAction
 
 $templateRepository
 
 $certificatePath
 
 $hasAdditionalElements
 
 $backGroundImageFileService
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateSettingsFormRepository::__construct ( int  $objectId,
string  $certificatePath,
bool  $hasAdditionalElements,
ilLanguage  $language,
ilCtrl  $controller,
ilAccess  $access,
ilToolbarGUI  $toolbar,
ilCertificatePlaceholderDescription  $placeholderDescriptionObject,
ilPageFormats  $pageFormats = null,
ilFormFieldParser  $formFieldParser = null,
ilCertificateTemplateImportAction  $importAction = null,
ilLogger  $logger = null,
ilCertificateTemplateRepository  $templateRepository = null,
\ILIAS\Filesystem\Filesystem  $filesystem = null,
ilCertificateBackgroundImageFileService  $backgroundImageFileService = null 
)
Parameters
integer$objectId
string$certificatePath
ilLanguage$language
ilCtrl$controller
ilAccess$access
ilToolbarGUI$toolbar
ilCertificatePlaceholderDescription$placeholderDescriptionObject
ilPageFormats | null$pageFormats
ilFormFieldParser | null$formFieldParser
ilCertificateTemplateImportAction | null$importAction
ilLogger | null$logger
ilCertificateTemplateRepository | null$templateRepository

Definition at line 88 of file class.ilCertificateSettingsFormRepository.php.

104 {
105 global $DIC;
106
107 $this->objectId = $objectId;
108 $this->language = $language;
109 $this->controller = $controller;
110 $this->access = $access;
111 $this->toolbar = $toolbar;
112 $this->placeholderDescriptionObject = $placeholderDescriptionObject;
113 $this->certificatePath = $certificatePath;
114 $this->hasAdditionalElements = $hasAdditionalElements;
115
116 $database = $DIC->database();
117
118
119 if (null === $logger) {
120 $logger = $logger = $DIC->logger()->cert();
121 }
122
123 if (null === $pageFormats) {
125 }
126 $this->pageFormats = $pageFormats;
127
128 if (null === $formFieldParser) {
130 }
131 $this->formFieldParser = $formFieldParser;
132
133 if (null === $importAction) {
135 (int) $objectId,
138 $logger,
139 $DIC->filesystem()->web()
140 );
141 }
142 $this->importAction = $importAction;
143
144 if (null === $templateRepository) {
146 }
147 $this->templateRepository = $templateRepository;
148
149 if (null === $filesystem) {
150 $filesystem = $DIC->filesystem()->web();
151 }
152
153 if (null === $backgroundImageFileService) {
154 $backgroundImageFileService = new ilCertificateBackgroundImageFileService(
156 $filesystem
157 );
158 }
159 $this->backGroundImageFileService = $backgroundImageFileService;
160 }
language()
Definition: language.php:2
$DIC
Definition: xapitoken.php:46

References $access, $certificatePath, $controller, $DIC, $formFieldParser, $hasAdditionalElements, $importAction, $language, $objectId, $pageFormats, $placeholderDescriptionObject, $templateRepository, $toolbar, and language().

+ Here is the call graph for this function:

Member Function Documentation

◆ createForm()

ilCertificateSettingsFormRepository::createForm ( ilCertificateGUI  $certificateGUI)
Parameters
ilCertificateGUI$certificateGUI
ilCertificate$certificateObject
string$certificatePath
Returns
ilPropertyFormGUI
Exceptions

ILIAS\Filesystem\Exception\FileAlreadyExistsException

Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions

ILIAS\Filesystem\Exception\IOException

Exceptions
ilDatabaseException
ilException
ilWACException

Implements ilCertificateFormRepository.

Definition at line 174 of file class.ilCertificateSettingsFormRepository.php.

175 {
176 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
177
178 $command = $this->controller->getCmd();
179
180 $form = new ilPropertyFormGUI();
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");
187
188 $active = new ilCheckboxInputGUI($this->language->txt("active"), "active");
189 $form->addItem($active);
190
191 $import = new ilFileInputGUI($this->language->txt("import"), "certificate_import");
192 $import->setRequired(false);
193 $import->setSuffixes(array("zip"));
194
195 // handle the certificate import
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"]);
199 if ($result == false) {
200 $import->setAlert($this->language->txt("certificate_error_import"));
201 } else {
202 $this->controller->redirect($certificateGUI, "certificateEditor");
203 }
204 }
205 }
206 $form->addItem($import);
207
208 $formSection = new \ilFormSectionHeaderGUI();
209 $formSection->setTitle($this->language->txt("cert_form_sec_layout"));
210 $form->addItem($formSection);
211
212 $pageformat = new ilRadioGroupInputGUI($this->language->txt("certificate_page_format"), "pageformat");
213 $pageformats = $this->pageFormats->fetchPageFormats();
214
215 foreach ($pageformats as $format) {
216 $option = new ilRadioOption($format["name"], $format["value"]);
217
218 if (strcmp($format["value"], "custom") == 0) {
219 $pageheight = new ilTextInputGUI($this->language->txt("certificate_pageheight"), "pageheight");
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);
225
226 $pagewidth = new ilTextInputGUI($this->language->txt("certificate_pagewidth"), "pagewidth");
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);
232 }
233
234 $pageformat->addOption($option);
235 }
236
237 $pageformat->setRequired(true);
238
239 if (strcmp($command, "certificateSave") == 0) {
240 $pageformat->checkInput();
241 }
242
243 $form->addItem($pageformat);
244
245 $bgimage = new ilImageFileInputGUI($this->language->txt("certificate_background_image"), "background");
246 $bgimage->setRequired(false);
247 $bgimage->setUseCache(false);
248
249 $bgimage->setALlowDeletion(true);
250 if (!$this->backGroundImageFileService->hasBackgroundImage($certificateTemplate)) {
254 $bgimage->setImage($imagePath);
255 $bgimage->setALlowDeletion(false);
256 }
257 } else {
259
260 $thumbnailPath = $this->backGroundImageFileService->getBackgroundImageThumbPath();
261
262 if (!file_exists($thumbnailPath)) {
264 $bgimage->setALlowDeletion(false);
265 }
266 $imagePath = ilWACSignedPath::signFile($thumbnailPath);
267 $bgimage->setImage($imagePath);
268 }
269
270 $form->addItem($bgimage);
271
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'));
276
277 $allowThumbnailDeletion = false;
278
279 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
280 if ('' !== $cardThumbnailImagePath) {
281 $presentationThumbnailImagePath = CLIENT_WEB_DIR . $cardThumbnailImagePath;
282 $thumbnailImage->setImage(ilWACSignedPath::signFile($presentationThumbnailImagePath));
283 $allowThumbnailDeletion = true;
284 }
285
286 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
287
288 $form->addItem($thumbnailImage);
289
290 $rect = new ilCSSRectInputGUI($this->language->txt("certificate_margin_body"), "margin_body");
291 $rect->setRequired(true);
292 $rect->setUseUnits(true);
293 $rect->setInfo($this->language->txt("certificate_unit_description"));
294
295 if (strcmp($command, "certificateSave") == 0) {
296 $rect->checkInput();
297 }
298
299 $form->addItem($rect);
300
301 $certificate = new ilTextAreaInputGUI($this->language->txt("certificate_text"), "certificate_text");
302 $certificate->removePlugin('ilimgupload');
303 $certificate->setRequired(true);
304 $certificate->setRows(20);
305 $certificate->setCols(80);
306
307 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
308
309 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
310
311 $certificate->setInfo($placeholderDescriptionInHtml);
312
313 $certificate->setUseRte(true, '3.4.7');
314
315 $tags = array(
316 "br",
317 "em",
318 "font",
319 "li",
320 "ol",
321 "p",
322 "span",
323 "strong",
324 "u",
325 "ul"
326 );
327
328 $certificate->setRteTags($tags);
329
330 if (strcmp($command, "certificateSave") == 0) {
331 $certificate->checkInput();
332 }
333
334 $form->addItem($certificate);
335
336 if (true === $this->hasAdditionalElements) {
337 $formSection = new \ilFormSectionHeaderGUI();
338 $formSection->setTitle($this->language->txt("cert_form_sec_add_features"));
339 $form->addItem($formSection);
340 }
341
342 if ($this->access->checkAccess("write", "", $_GET["ref_id"])) {
343 if ($certificateTemplate->isCurrentlyActive()) {
344 $this->toolbar->setFormAction($this->controller->getFormAction($certificateGUI));
345
347 $preview->setCaption('certificate_preview');
348 $preview->setCommand('certificatePreview');
349 $this->toolbar->addStickyItem($preview);
350
351 $export = ilSubmitButton::getInstance();
352 $export->setCaption('certificate_export');
353 $export->setCommand('certificateExportFO');
354 $this->toolbar->addButtonInstance($export);
355
356 $delete = ilSubmitButton::getInstance();
357 $delete->setCaption('delete');
358 $delete->setCommand('certificateDelete');
359 $this->toolbar->addButtonInstance($delete);
360 }
361 $form->addCommandButton("certificateSave", $this->language->txt("save"));
362 }
363
364 return $form;
365 }
$result
$_GET["client_id"]
This class represents a text property in a property form.
This class represents a checkbox property in a property form.
This class represents a file property in a property form.
This class represents an image file property in a property form.
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 a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
static getInstance()
Factory.
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)
$format
Definition: metadata.php:218
$preview

References $_GET, $format, $preview, $result, ilObjCertificateSettingsAccess\getBackgroundImageThumbPath(), ilObjCertificateSettingsAccess\getBackgroundImageThumbPathWeb(), ilSubmitButton\getInstance(), ilObjCertificateSettingsAccess\hasBackgroundImage(), language(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().

+ Here is the call graph for this function:

◆ fetchFormFieldData()

ilCertificateSettingsFormRepository::fetchFormFieldData ( string  $content)
Parameters
string$content
Returns
array|mixed

Implements ilCertificateFormRepository.

Definition at line 379 of file class.ilCertificateSettingsFormRepository.php.

380 {
381 return $this->formFieldParser->fetchDefaultFormFields($content);
382 }

◆ save()

ilCertificateSettingsFormRepository::save ( array  $formFields)
Parameters
array$formFields
Returns
mixed|void

Implements ilCertificateFormRepository.

Definition at line 371 of file class.ilCertificateSettingsFormRepository.php.

372 {
373 }

Field Documentation

◆ $access

ilCertificateSettingsFormRepository::$access
private

Definition at line 27 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $backGroundImageFileService

ilCertificateSettingsFormRepository::$backGroundImageFileService
private

◆ $certificatePath

ilCertificateSettingsFormRepository::$certificatePath
private

Definition at line 62 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $controller

ilCertificateSettingsFormRepository::$controller
private

Definition at line 22 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $formFieldParser

ilCertificateSettingsFormRepository::$formFieldParser
private

Definition at line 47 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $hasAdditionalElements

ilCertificateSettingsFormRepository::$hasAdditionalElements
private

Definition at line 67 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $importAction

ilCertificateSettingsFormRepository::$importAction
private

Definition at line 52 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $language

ilCertificateSettingsFormRepository::$language
private

Definition at line 17 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $objectId

ilCertificateSettingsFormRepository::$objectId
private

Definition at line 12 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $pageFormats

ilCertificateSettingsFormRepository::$pageFormats
private

Definition at line 42 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $placeholderDescriptionObject

ilCertificateSettingsFormRepository::$placeholderDescriptionObject
private

Definition at line 37 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $templateRepository

ilCertificateSettingsFormRepository::$templateRepository
private

Definition at line 57 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().

◆ $toolbar

ilCertificateSettingsFormRepository::$toolbar
private

Definition at line 32 of file class.ilCertificateSettingsFormRepository.php.

Referenced by __construct().


The documentation for this class was generated from the following file: