ILIAS  release_7 Revision v7.30-3-g800a261c036
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
 
 $globalCertificateSettings
 

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 92 of file class.ilCertificateSettingsFormRepository.php.

108 {
109 global $DIC;
110
111 $this->objectId = $objectId;
112 $this->language = $language;
113 $this->controller = $controller;
114 $this->access = $access;
115 $this->toolbar = $toolbar;
116 $this->placeholderDescriptionObject = $placeholderDescriptionObject;
117 $this->certificatePath = $certificatePath;
118 $this->hasAdditionalElements = $hasAdditionalElements;
119 $this->globalCertificateSettings = new ilObjCertificateSettings();
120
121 $database = $DIC->database();
122
123
124 if (null === $logger) {
125 $logger = $logger = $DIC->logger()->cert();
126 }
127
128 if (null === $pageFormats) {
130 }
131 $this->pageFormats = $pageFormats;
132
133 if (null === $formFieldParser) {
135 }
136 $this->formFieldParser = $formFieldParser;
137
138 if (null === $importAction) {
140 (int) $objectId,
143 $logger,
144 $DIC->filesystem()->web()
145 );
146 }
147 $this->importAction = $importAction;
148
149 if (null === $templateRepository) {
151 }
152 $this->templateRepository = $templateRepository;
153
154 if (null === $filesystem) {
155 $filesystem = $DIC->filesystem()->web();
156 }
157
158 if (null === $backgroundImageFileService) {
159 $backgroundImageFileService = new ilCertificateBackgroundImageFileService(
161 $filesystem
162 );
163 }
164 $this->backGroundImageFileService = $backgroundImageFileService;
165 }
Class ilObjCertificateSettings.
global $DIC
Definition: goto.php:24
language()
Definition: language.php:2

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 179 of file class.ilCertificateSettingsFormRepository.php.

180 {
181 $certificateTemplate = $this->templateRepository->fetchCurrentlyUsedCertificate($this->objectId);
182
183 $command = $this->controller->getCmd();
184
185 $form = new ilPropertyFormGUI();
186 $form->setPreventDoubleSubmission(false);
187 $form->setFormAction($this->controller->getFormAction($certificateGUI));
188 $form->setTitle($this->language->txt("cert_form_sec_availability"));
189 $form->setMultipart(true);
190 $form->setTableWidth("100%");
191 $form->setId("certificate");
192
193 $active = new ilCheckboxInputGUI($this->language->txt("active"), "active");
194 $form->addItem($active);
195
196 $import = new ilFileInputGUI($this->language->txt("import"), "certificate_import");
197 $import->setRequired(false);
198 $import->setSuffixes(array("zip"));
199
200 // handle the certificate import
201 if (strlen($_FILES["certificate_import"]["name"])) {
202 if ($import->checkInput()) {
203 $result = $this->importAction->import($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]);
204 if ($result == false) {
205 $import->setAlert($this->language->txt("certificate_error_import"));
206 } else {
207 $this->controller->redirect($certificateGUI, "certificateEditor");
208 }
209 }
210 }
211 $form->addItem($import);
212
213 $formSection = new \ilFormSectionHeaderGUI();
214 $formSection->setTitle($this->language->txt("cert_form_sec_layout"));
215 $form->addItem($formSection);
216
217 $pageformat = new ilRadioGroupInputGUI($this->language->txt("certificate_page_format"), "pageformat");
218 $pageformats = $this->pageFormats->fetchPageFormats();
219
220 foreach ($pageformats as $format) {
221 $option = new ilRadioOption($format["name"], $format["value"]);
222
223 if (strcmp($format["value"], "custom") == 0) {
224 $pageheight = new ilTextInputGUI($this->language->txt("certificate_pageheight"), "pageheight");
225 $pageheight->setSize(6);
226 $pageheight->setValidationRegexp('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
227 $pageheight->setInfo($this->language->txt("certificate_unit_description"));
228 $pageheight->setRequired(true);
229 $option->addSubitem($pageheight);
230
231 $pagewidth = new ilTextInputGUI($this->language->txt("certificate_pagewidth"), "pagewidth");
232 $pagewidth->setSize(6);
233 $pagewidth->setValidationRegexp('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*)))(cm|mm|in|pt|pc|px|em)$/is');
234 $pagewidth->setInfo($this->language->txt("certificate_unit_description"));
235 $pagewidth->setRequired(true);
236 $option->addSubitem($pagewidth);
237 }
238
239 $pageformat->addOption($option);
240 }
241
242 $pageformat->setRequired(true);
243
244 if (strcmp($command, "certificateSave") == 0) {
245 $pageformat->checkInput();
246 }
247
248 $form->addItem($pageformat);
249
250 $bgimage = new ilImageFileInputGUI($this->language->txt("certificate_background_image"), "background");
251 $bgimage->setRequired(false);
252 $bgimage->setUseCache(false);
253
254 $bgimage->setALlowDeletion(true);
255 if (!$this->backGroundImageFileService->hasBackgroundImage($certificateTemplate)) {
256 if ($this->globalCertificateSettings->hasBackgroundImage()) {
258 $imagePath = ilWACSignedPath::signFile($this->globalCertificateSettings->getBackgroundImageThumbPathWeb());
259 $bgimage->setImage($imagePath);
260 $bgimage->setALlowDeletion(false);
261 }
262 } else {
264
265 $thumbnailPath = $this->backGroundImageFileService->getBackgroundImageThumbPath();
266
267 if (!is_file($thumbnailPath)) {
268 //Trying if it uses default image path
269 $thumbnailPath = CLIENT_WEB_DIR . $certificateTemplate->getBackgroundImagePath() . '.thumb.jpg';
270 if (!is_file($thumbnailPath)) {
271 //Trying to use global default image
272 $thumbnailPath = $this->globalCertificateSettings->getDefaultBackgroundImageThumbPath();
273 if (!is_file($thumbnailPath)) {
274 //No image global default configured
275 $thumbnailPath = '';
276 }
277 }
278 $bgimage->setALlowDeletion(false);
279 }
280 $imagePath = ilWACSignedPath::signFile($thumbnailPath);
281 $bgimage->setImage($imagePath);
282 }
283
284 $form->addItem($bgimage);
285
286 $thumbnailImage = new ilImageFileInputGUI($this->language->txt('certificate_card_thumbnail_image'), 'certificate_card_thumbnail_image');
287 $thumbnailImage->setRequired(false);
288 $thumbnailImage->setUseCache(false);
289 $thumbnailImage->setSuffixes(array('svg'));
290
291 $allowThumbnailDeletion = false;
292
293 $cardThumbnailImagePath = $certificateTemplate->getThumbnailImagePath();
294 if ('' !== $cardThumbnailImagePath) {
295 $presentationThumbnailImagePath = CLIENT_WEB_DIR . $cardThumbnailImagePath;
296 $thumbnailImage->setImage(ilWACSignedPath::signFile($presentationThumbnailImagePath));
297 $allowThumbnailDeletion = true;
298 }
299
300 $thumbnailImage->setAllowDeletion($allowThumbnailDeletion);
301
302 $form->addItem($thumbnailImage);
303
304 $rect = new ilCSSRectInputGUI($this->language->txt("certificate_margin_body"), "margin_body");
305 $rect->setRequired(true);
306 $rect->setUseUnits(true);
307 $rect->setInfo($this->language->txt("certificate_unit_description"));
308
309 if (strcmp($command, "certificateSave") == 0) {
310 $rect->checkInput();
311 }
312
313 $form->addItem($rect);
314
315 $certificate = new ilTextAreaInputGUI($this->language->txt("certificate_text"), "certificate_text");
316 $certificate->removePlugin('ilimgupload');
317 $certificate->setRequired(true);
318 $certificate->setRows(20);
319 $certificate->setCols(80);
320
321 $placeholderHtmlDescription = $this->placeholderDescriptionObject->createPlaceholderHtmlDescription();
322
323 $placeholderDescriptionInHtml = $placeholderHtmlDescription;
324
325 $certificate->setInfo($placeholderDescriptionInHtml);
326
327 $certificate->setUseRte(true, '3.4.7');
328
329 $tags = array(
330 "br",
331 "em",
332 "font",
333 "li",
334 "ol",
335 "p",
336 "span",
337 "strong",
338 "u",
339 "ul"
340 );
341
342 $certificate->setRteTags($tags);
343
344 if (strcmp($command, "certificateSave") == 0) {
345 $certificate->checkInput();
346 }
347
348 $form->addItem($certificate);
349
350 if (true === $this->hasAdditionalElements) {
351 $formSection = new \ilFormSectionHeaderGUI();
352 $formSection->setTitle($this->language->txt("cert_form_sec_add_features"));
353 $form->addItem($formSection);
354 }
355
356 if ($this->access->checkAccess("write", "", $_GET["ref_id"])) {
357 if ($certificateTemplate->isCurrentlyActive()) {
358 $this->toolbar->setFormAction($this->controller->getFormAction($certificateGUI));
359
361 $preview->setCaption('certificate_preview');
362 $preview->setCommand('certificatePreview');
363 $this->toolbar->addStickyItem($preview);
364
365 $export = ilSubmitButton::getInstance();
366 $export->setCaption('certificate_export');
367 $export->setCommand('certificateExportFO');
368 $this->toolbar->addButtonInstance($export);
369
370 $delete = ilSubmitButton::getInstance();
371 $delete->setCaption('delete');
372 $delete->setCommand('certificateDelete');
373 $this->toolbar->addButtonInstance($delete);
374 }
375 $form->addCommandButton("certificateSave", $this->language->txt("save"));
376 }
377
378 return $form;
379 }
$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.
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)
const CLIENT_WEB_DIR
Definition: constants.php:45
$preview
Definition: imgupload.php:55
$format
Definition: metadata.php:218

References $_GET, $format, $preview, $result, CLIENT_WEB_DIR, ilSubmitButton\getInstance(), 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 393 of file class.ilCertificateSettingsFormRepository.php.

394 {
395 return $this->formFieldParser->fetchDefaultFormFields($content);
396 }

◆ save()

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

Implements ilCertificateFormRepository.

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

386 {
387 }

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().

◆ $globalCertificateSettings

ilCertificateSettingsFormRepository::$globalCertificateSettings
private

◆ $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: