ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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)
 
 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
 createPlaceholderHtmlDescription ()
 

Private Attributes

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

Detailed Description

Definition at line 21 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 
)

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

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

34  {
35  global $DIC;
36 
37  if (null === $language) {
38  $language = $DIC->language();
39  $language->loadLanguageModule('certificate');
40  }
41  $this->language = $language;
42 
43  if (null === $defaultPlaceholderDescriptionObject) {
44  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription(
45  $language,
46  $userDefinedFieldPlaceHolderDescriptionObject
47  );
48  }
49  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
50 
51  if (null === $learningProgressObject) {
53  }
54  $this->learningProgressObject = $learningProgressObject;
55 
56  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
57 
58  $this->placeholder['SCORM_TITLE'] = $language->txt('certificate_ph_scormtitle');
59  $this->placeholder['SCORM_POINTS'] = $language->txt('certificate_ph_scormpoints');
60  $this->placeholder['SCORM_POINTS_MAX'] = $language->txt('certificate_ph_scormmaxpoints');
61  $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
62  $language->txt('certificate_ph_date_completed')
63  );
64  $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
65  $language->txt('certificate_ph_datetime_completed')
66  );
67  }
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...
loadLanguageModule(string $a_module)
Load language module.
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
static getInstance(int $obj_id)
+ 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 75 of file class.ilScormPlaceholderDescription.php.

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

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

References $placeholder.

137  : array
138  {
139  return $this->placeholder;
140  }

Field Documentation

◆ $defaultPlaceHolderDescriptionObject

readonly ilDefaultPlaceholderDescription ilScormPlaceholderDescription::$defaultPlaceHolderDescriptionObject
private

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

◆ $language

readonly ilLanguage ilScormPlaceholderDescription::$language
private

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

Referenced by __construct().

◆ $learningProgressObject

readonly ilObjectLP ilScormPlaceholderDescription::$learningProgressObject
private

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

Referenced by __construct().

◆ $placeholder

array ilScormPlaceholderDescription::$placeholder
private

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

Referenced by getPlaceholderDescriptions().


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