ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilScormPlaceholderDescription Class Reference
+ Inheritance diagram for ilScormPlaceholderDescription:
+ Collaboration diagram for ilScormPlaceholderDescription:

Public Member Functions

 __construct (private readonly ilObject $object, ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilObjectLP $learningProgressObject=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null, ?Profile $profile=null)
 
 createPlaceholderHtmlDescription (?ilTemplate $template=null)
 This methods MUST return an array containing an array with the the description as array value. More...
 
 getPlaceholderDescriptions ()
 This method MUST return an array containing an array with the the description as array value. More...
 
- Public Member Functions inherited from ilCertificatePlaceholderDescription
 getPlaceholderDescriptions ()
 This method MUST return an array containing an array with the the description as array value. More...
 
 createPlaceholderHtmlDescription ()
 

Private Attributes

readonly ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
 
readonly ilLanguage $language
 
array $placeholder
 
readonly ilObjectLP $learningProgressObject
 

Detailed Description

Definition at line 23 of file class.ilScormPlaceholderDescription.php.

Constructor & Destructor Documentation

◆ __construct()

ilScormPlaceholderDescription::__construct ( private readonly ilObject  $object,
?ilDefaultPlaceholderDescription  $defaultPlaceholderDescriptionObject = null,
?ilLanguage  $language = null,
?ilObjectLP  $learningProgressObject = null,
?ilUserDefinedFieldsPlaceholderDescription  $userDefinedFieldPlaceHolderDescriptionObject = null,
?Profile  $profile = null 
)

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

37 {
38 global $DIC;
39
40 if (null === $language) {
41 $language = $DIC->language();
42 $language->loadLanguageModule('certificate');
43 }
44 $this->language = $language;
45
46 if (null === $defaultPlaceholderDescriptionObject) {
47 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription(
49 $profile ?? $DIC['user']->getProfile(),
50 $userDefinedFieldPlaceHolderDescriptionObject
51 );
52 }
53 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
54
55 if (null === $learningProgressObject) {
57 }
58 $this->learningProgressObject = $learningProgressObject;
59
60 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
61
62 $this->placeholder['SCORM_TITLE'] = $language->txt('certificate_ph_scormtitle');
63 $this->placeholder['SCORM_POINTS'] = $language->txt('certificate_ph_scormpoints');
64 $this->placeholder['SCORM_POINTS_MAX'] = $language->txt('certificate_ph_scormmaxpoints');
65 $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
66 $language->txt('certificate_ph_date_completed')
67 );
68 $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
69 $language->txt('certificate_ph_datetime_completed')
70 );
71 }
Collection of basic placeholder values that can be used.
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
static getInstance(int $obj_id)
global $DIC
Definition: shib_login.php:26

References $DIC, $language, $learningProgressObject, ilObjectLP\getInstance(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ilLanguage\loadLanguageModule(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilLanguage\txt().

+ Here is the call graph for this function:

Member Function Documentation

◆ createPlaceholderHtmlDescription()

ilScormPlaceholderDescription::createPlaceholderHtmlDescription ( ?ilTemplate  $template = null)

This methods MUST return an array containing an array with the the description as array value.

Parameters
ilTemplate | null$template
Returns
string - [PLACEHOLDER] => 'description'

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

79 : string
80 {
81 if (null === $template) {
82 $template = new ilTemplate('tpl.scorm_description.html', true, true, 'components/ILIAS/Certificate');
83 }
84
85 $template->setCurrentBlock('items');
86
87 foreach ($this->placeholder as $id => $caption) {
88 $template->setVariable('ID', $id);
89 $template->setVariable('TXT', $caption);
90 $template->parseCurrentBlock();
91 }
92
93 $template->setVariable('PH_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
94
95 $collection = $this->learningProgressObject->getCollectionInstance();
96 $items = [];
97 if ($collection !== null) {
98 $items = $collection->getPossibleItems();
99 }
100
101 if ($items) {
102 $template->setCurrentBlock('SCOS');
103 $template->setVariable('PH_SCOS', $this->language->txt('certificate_ph_scos'));
104 $template->parseCurrentBlock();
105 $template->setCurrentBlock('SCO_HEADER');
106 $template->setVariable('PH_TITLE_SCO', $this->language->txt('certificate_ph_title_sco'));
107 $template->setVariable('PH_SCO_TITLE', $this->language->txt('certificate_ph_sco_title'));
108 $template->setVariable('PH_SCO_POINTS_RAW', $this->language->txt('certificate_ph_sco_points_raw'));
109 $template->setVariable('PH_SCO_POINTS_MAX', $this->language->txt('certificate_ph_sco_points_max'));
110 $template->setVariable('PH_SCO_POINTS_SCALED', $this->language->txt('certificate_ph_sco_points_scaled'));
111 } else {
112 $template->setCurrentBlock('NO_SCO');
113 $template->setVariable('PH_NO_SCO', $this->language->txt('certificate_ph_no_sco'));
114 }
115 $template->parseCurrentBlock();
116
117 if ($collection !== null) {
118 $counter = 0;
119 foreach ($items as $item_id => $sahs_item) {
120 if ($collection->isAssignedEntry($item_id)) {
121 $template->setCurrentBlock('SCO');
122 $template->setVariable('SCO_TITLE', $sahs_item['title']);
123 $template->setVariable('PH_SCO_TITLE', '[SCO_T_' . $counter . ']');
124 $template->setVariable('PH_SCO_POINTS_RAW', '[SCO_P_' . $counter . ']');
125 $template->setVariable('PH_SCO_POINTS_MAX', '[SCO_PM_' . $counter . ']');
126 $template->setVariable('PH_SCO_POINTS_SCALED', '[SCO_PP_' . $counter . ']');
127 $template->parseCurrentBlock();
128 $counter++;
129 }
130 }
131 }
132
133 return $template->get();
134 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
special template class to simplify handling of ITX/PEAR
$counter

References $counter, $id, and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ getPlaceholderDescriptions()

ilScormPlaceholderDescription::getPlaceholderDescriptions ( )

This method MUST return an array containing an array with the the description as array value.

Returns
array - [PLACEHOLDER] => 'description'

Implements ilCertificatePlaceholderDescription.

Definition at line 141 of file class.ilScormPlaceholderDescription.php.

141 : array
142 {
143 return $this->placeholder;
144 }

References $placeholder.

Field Documentation

◆ $defaultPlaceHolderDescriptionObject

readonly ilDefaultPlaceholderDescription ilScormPlaceholderDescription::$defaultPlaceHolderDescriptionObject
private

Definition at line 25 of file class.ilScormPlaceholderDescription.php.

◆ $language

readonly ilLanguage ilScormPlaceholderDescription::$language
private

Definition at line 26 of file class.ilScormPlaceholderDescription.php.

Referenced by __construct().

◆ $learningProgressObject

readonly ilObjectLP ilScormPlaceholderDescription::$learningProgressObject
private

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

Referenced by __construct().

◆ $placeholder

array ilScormPlaceholderDescription::$placeholder
private

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

Referenced by getPlaceholderDescriptions().


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