ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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

 $defaultPlaceHolderDescriptionObject
 
 $language
 
 $placeholder
 
 $object
 
 $learningProgressObject
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $language, $learningProgressObject, $object, ilObjectLP\getInstance(), language(), and ilUtil\prepareFormOutput().

47  {
48  global $DIC;
49 
50  $this->object = $object;
51 
52  if (null === $language) {
53  $language = $DIC->language();
54  $language->loadLanguageModule('certificate');
55  }
56  $this->language = $language;
57 
58  if (null === $defaultPlaceholderDescriptionObject) {
59  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
60  }
61  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
62 
63  if (null === $learningProgressObject) {
64  $learningProgressObject = ilObjectLP::getInstance($this->object->getId());
65  }
66  $this->learningProgressObject = $learningProgressObject;
67 
68  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
69 
70  $this->placeholder['SCORM_TITLE'] = $language->txt('certificate_ph_scormtitle');
71  $this->placeholder['SCORM_POINTS'] = $language->txt('certificate_ph_scormpoints');
72  $this->placeholder['SCORM_POINTS_MAX'] = $language->txt('certificate_ph_scormmaxpoints');
73  $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_date_completed'));
74  $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
75  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
loadLanguageModule($a_module)
$DIC
Definition: xapitoken.php:46
Collection of basic placeholder values that can be used.
language()
Definition: language.php:2
txt($a_topic, $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 getInstance($a_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
mixed - [PLACEHOLDER] => 'description'

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

References language().

84  : string
85  {
86  if (null === $template) {
87  $template = new ilTemplate('tpl.scorm_description.html', true, true, 'Services/Certificate');
88  }
89 
90  $template->setCurrentBlock('items');
91 
92  foreach ($this->placeholder as $id => $caption) {
93  $template->setVariable('ID', $id);
94  $template->setVariable('TXT', $caption);
95  $template->parseCurrentBlock();
96  }
97 
98  $template->setVariable('PH_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
99 
100  $collection = $this->learningProgressObject->getCollectionInstance();
101  if ($collection) {
102  $items = $collection->getPossibleItems();
103  }
104 
105  if (!$items) {
106  $template->setCurrentBlock('NO_SCO');
107  $template->setVariable('PH_NO_SCO', $this->language->txt('certificate_ph_no_sco'));
108  $template->parseCurrentBlock();
109  } else {
110  $template->setCurrentBlock('SCOS');
111  $template->setVariable('PH_SCOS', $this->language->txt('certificate_ph_scos'));
112  $template->parseCurrentBlock();
113  $template->setCurrentBlock('SCO_HEADER');
114  $template->setVariable('PH_TITLE_SCO', $this->language->txt('certificate_ph_title_sco'));
115  $template->setVariable('PH_SCO_TITLE', $this->language->txt('certificate_ph_sco_title'));
116  $template->setVariable('PH_SCO_POINTS_RAW', $this->language->txt('certificate_ph_sco_points_raw'));
117  $template->setVariable('PH_SCO_POINTS_MAX', $this->language->txt('certificate_ph_sco_points_max'));
118  $template->setVariable('PH_SCO_POINTS_SCALED', $this->language->txt('certificate_ph_sco_points_scaled'));
119  $template->parseCurrentBlock();
120  }
121 
122  if ($collection) {
123  $counter = 0;
124  foreach ($items as $item_id => $sahs_item) {
125  if ($collection->isAssignedEntry($item_id)) {
126  $template->setCurrentBlock('SCO');
127  $template->setVariable('SCO_TITLE', $sahs_item['title']);
128  $template->setVariable('PH_SCO_TITLE', '[SCO_T_' . $counter . ']');
129  $template->setVariable('PH_SCO_POINTS_RAW', '[SCO_P_' . $counter . ']');
130  $template->setVariable('PH_SCO_POINTS_MAX', '[SCO_PM_' . $counter . ']');
131  $template->setVariable('PH_SCO_POINTS_SCALED', '[SCO_PP_' . $counter . ']');
132  $template->parseCurrentBlock();
133  $counter++;
134  }
135  }
136  }
137 
138  return $template->get();
139  }
setVariable($variable, $value='')
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
language()
Definition: language.php:2
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
get($part="DEFAULT")
+ 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
mixed - [PLACEHOLDER] => 'description'

Implements ilCertificatePlaceholderDescription.

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

References $placeholder.

147  : array
148  {
149  return $this->placeholder;
150  }

Field Documentation

◆ $defaultPlaceHolderDescriptionObject

ilScormPlaceholderDescription::$defaultPlaceHolderDescriptionObject
private

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

◆ $language

ilScormPlaceholderDescription::$language
private

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

Referenced by __construct().

◆ $learningProgressObject

ilScormPlaceholderDescription::$learningProgressObject
private

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

Referenced by __construct().

◆ $object

ilScormPlaceholderDescription::$object
private

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

Referenced by __construct().

◆ $placeholder

ilScormPlaceholderDescription::$placeholder
private

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

Referenced by getPlaceholderDescriptions().


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