ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilScormPlaceholderDescription Class Reference
+ Inheritance diagram for ilScormPlaceholderDescription:
+ Collaboration diagram for ilScormPlaceholderDescription:

Public Member Functions

 __construct (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

ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
 
ilLanguage $language
 
array $placeholder
 
ilObject $object
 
ilObjectLP $learningProgressObject
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

35  {
36  global $DIC;
37 
38  $this->object = $object;
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(
48  $language,
49  $userDefinedFieldPlaceHolderDescriptionObject
50  );
51  }
52  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
53 
54  if (null === $learningProgressObject) {
56  }
57  $this->learningProgressObject = $learningProgressObject;
58 
59  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
60 
61  $this->placeholder['SCORM_TITLE'] = $language->txt('certificate_ph_scormtitle');
62  $this->placeholder['SCORM_POINTS'] = $language->txt('certificate_ph_scormpoints');
63  $this->placeholder['SCORM_POINTS_MAX'] = $language->txt('certificate_ph_scormmaxpoints');
64  $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
65  $language->txt('certificate_ph_date_completed')
66  );
67  $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
68  $language->txt('certificate_ph_datetime_completed')
69  );
70  }
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)
global $DIC
Definition: feed.php:28
Collection of basic placeholder values that can be used.
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 78 of file class.ilScormPlaceholderDescription.php.

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

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

References $placeholder.

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

Field Documentation

◆ $defaultPlaceHolderDescriptionObject

ilDefaultPlaceholderDescription ilScormPlaceholderDescription::$defaultPlaceHolderDescriptionObject
private

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

◆ $language

ilLanguage ilScormPlaceholderDescription::$language
private

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

Referenced by __construct().

◆ $learningProgressObject

ilObjectLP ilScormPlaceholderDescription::$learningProgressObject
private

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

Referenced by __construct().

◆ $object

ilObject ilScormPlaceholderDescription::$object
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: