ILIAS  release_8 Revision v8.24
ilCertificateSettingsScormFormRepository Class Reference
+ Inheritance diagram for ilCertificateSettingsScormFormRepository:
+ Collaboration diagram for ilCertificateSettingsScormFormRepository:

Public Member Functions

 __construct (ilObject $object, string $certificatePath, bool $hasAdditionalElements, ilLanguage $language, ilCtrlInterface $ctrl, ilAccess $access, ilToolbarGUI $toolbar, ilCertificatePlaceholderDescription $placeholderDescriptionObject, ?ilCertificateSettingsFormRepository $settingsFormRepository=null, ?ilSetting $setting=null)
 
 createForm (ilCertificateGUI $certificateGUI)
 
 save (array $formFields)
 
 fetchFormFieldData (string $content)
 
 createForm (ilCertificateGUI $certificateGUI)
 
 save (array $formFields)
 
 fetchFormFieldData (string $content)
 

Private Attributes

ilObject $object
 
ilLanguage $language
 
ilCertificateSettingsFormRepository $settingsFormFactory
 
ilSetting $setting
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateSettingsScormFormRepository::__construct ( ilObject  $object,
string  $certificatePath,
bool  $hasAdditionalElements,
ilLanguage  $language,
ilCtrlInterface  $ctrl,
ilAccess  $access,
ilToolbarGUI  $toolbar,
ilCertificatePlaceholderDescription  $placeholderDescriptionObject,
?ilCertificateSettingsFormRepository  $settingsFormRepository = null,
?ilSetting  $setting = null 
)

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

43 {
44 $this->object = $object;
45
46 $this->language = $language;
47
48 if (null === $settingsFormRepository) {
49 $settingsFormRepository = new ilCertificateSettingsFormRepository(
50 $object->getId(),
51 $certificatePath,
52 $hasAdditionalElements,
54 $ctrl,
55 $access,
56 $toolbar,
57 $placeholderDescriptionObject
58 );
59 }
60
61 $this->settingsFormFactory = $settingsFormRepository;
62
63 if (null === $setting) {
64 $setting = new ilSetting('scorm');
65 }
66 $this->setting = $setting;
67 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $language, $object, $setting, ilObject\getId(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

Member Function Documentation

◆ createForm()

ilCertificateSettingsScormFormRepository::createForm ( ilCertificateGUI  $certificateGUI)
Parameters
ilCertificateGUI$certificateGUI
Returns
ilPropertyFormGUI
Exceptions
FileAlreadyExistsException
FileNotFoundException
IOException
ilDatabaseException
ilException
ilWACException

Implements ilCertificateFormRepository.

Definition at line 79 of file class.ilCertificateSettingsScormFormRepository.php.

80 {
81 $form = $this->settingsFormFactory->createForm($certificateGUI);
82
83 $short_name = new ilTextInputGUI($this->language->txt('certificate_short_name'), 'short_name');
84 $short_name->setRequired(true);
85 $short_name->setValue(ilStr::subStr($this->object->getTitle(), 0, 30));
86 $short_name->setSize(30);
87
88 $short_name_value = $this->setting->get(
89 'certificate_short_name_' . $this->object->getId(),
90 ''
91 );
92
93 $infoText = $this->language->txt('certificate_short_name_description');
94 if ($short_name_value !== '') {
95 $short_name->setInfo(str_replace(
96 '[SHORT_TITLE]',
97 $short_name_value,
98 $infoText
99 ));
100 } else {
101 $short_name->setInfo($infoText);
102 }
103
104 $form->addItem($short_name);
105
106 return $form;
107 }
This class represents a property form user interface.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
This class represents a text property in a property form.

References ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\object(), and ilStr\subStr().

+ Here is the call graph for this function:

◆ fetchFormFieldData()

ilCertificateSettingsScormFormRepository::fetchFormFieldData ( string  $content)

Implements ilCertificateFormRepository.

Definition at line 115 of file class.ilCertificateSettingsScormFormRepository.php.

115 : array
116 {
117 $formFields = $this->settingsFormFactory->fetchFormFieldData($content);
118 $formFields['certificate_enabled_scorm'] = $this->setting->get(
119 'certificate_' . $this->object->getId(),
120 (string) ($formFields['certificate_enabled_scorm'] ?? '0')
121 );
122 $formFields['short_name'] = $this->setting->get(
123 'certificate_short_name_' . $this->object->getId(),
124 (string) ($formFields['short_name'] ?? '')
125 );
126
127 return $formFields;
128 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ save()

ilCertificateSettingsScormFormRepository::save ( array  $formFields)

Implements ilCertificateFormRepository.

Definition at line 109 of file class.ilCertificateSettingsScormFormRepository.php.

109 : void
110 {
111 $this->setting->set('certificate_' . $this->object->getId(), (string) ($formFields['certificate_enabled_scorm'] ?? '0'));
112 $this->setting->set('certificate_short_name_' . $this->object->getId(), (string) ($formFields['short_name'] ?? ''));
113 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

Field Documentation

◆ $language

ilLanguage ilCertificateSettingsScormFormRepository::$language
private

Definition at line 28 of file class.ilCertificateSettingsScormFormRepository.php.

Referenced by __construct().

◆ $object

ilObject ilCertificateSettingsScormFormRepository::$object
private

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

Referenced by __construct().

◆ $setting

ilSetting ilCertificateSettingsScormFormRepository::$setting
private

Definition at line 30 of file class.ilCertificateSettingsScormFormRepository.php.

Referenced by __construct().

◆ $settingsFormFactory

ilCertificateSettingsFormRepository ilCertificateSettingsScormFormRepository::$settingsFormFactory
private

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