19 declare(strict_types=1);
40 if (
null === $language) {
42 $language = $DIC->language();
43 $language->loadLanguageModule(
'certificate');
47 if (
null === $defaultPlaceholderValues) {
50 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
52 if (
null === $dateHelper) {
57 if (
null === $objectHelper) {
62 if (
null === $utilHelper) {
67 if (
null === $objectLPHelper) {
72 if (
null === $lpStatusHelper) {
91 $this->
language->loadLanguageModule(
'certificate');
93 $object = $this->objectHelper->getInstanceByObjId($objId);
94 $points = $object->getPointsInPercent();
95 if (is_null($points)) {
96 $txtPoints = $this->
language->txt(
'certificate_points_notavailable');
98 $txtPoints = number_format(
101 $this->
language->txt(
'lang_sep_decimal'),
102 $this->
language->txt(
'lang_sep_thousand')
106 $max_points = $object->getMaxPoints();
107 $txtMaxPoints = (string) $max_points;
108 if (is_null($max_points)) {
109 $txtMaxPoints = $this->
language->txt(
'certificate_points_notavailable');
110 } elseif ($max_points != floor($max_points)) {
111 $txtMaxPoints = number_format(
114 $this->
language->txt(
'lang_sep_decimal'),
115 $this->
language->txt(
'lang_sep_thousand')
119 $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
121 $placeHolders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
123 $placeHolders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
124 $placeHolders[
'SCORM_POINTS'] = $txtPoints;
125 $placeHolders[
'SCORM_POINTS_MAX'] = $txtMaxPoints;
127 $placeHolders[
'DATE_COMPLETED'] =
'';
128 $placeHolders[
'DATETIME_COMPLETED'] =
'';
130 if ($completionDate !==
'') {
132 $user = $this->objectHelper->getInstanceByObjId($userId);
133 $placeHolders[
'DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate, $user);
134 $placeHolders[
'DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate, $user);
137 $olp = $this->objectLPHelper->getInstance($object->getId());
138 $collection = $olp->getCollectionInstance();
140 if ($collection !==
null) {
142 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
143 if ($collection->isAssignedEntry($item_id)) {
144 $placeHolders[
'SCO_T_' . $counter] = $sahs_item[
'title'];
145 $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id, $userId);
147 $placeHolders[
'SCO_P_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
148 if ($a_scores[
'raw'] !==
null) {
149 $placeHolders[
'SCO_P_' . $counter] = number_format(
150 (
float) $a_scores[
'raw'],
152 $this->
language->txt(
'lang_sep_decimal'),
153 $this->
language->txt(
'lang_sep_thousand')
157 $placeHolders[
'SCO_PM_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
158 if ($a_scores[
'max'] !==
null) {
159 $placeHolders[
'SCO_PM_' . $counter] = number_format(
160 (
float) $a_scores[
'max'],
162 $this->
language->txt(
'lang_sep_decimal'),
163 $this->
language->txt(
'lang_sep_thousand')
167 $placeHolders[
'SCO_PP_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
168 if ($a_scores[
'scaled'] !==
null) {
169 $placeHolders[
'SCO_PP_' . $counter] = number_format(
170 (
float) ($a_scores[
'scaled'] * 100),
172 $this->
language->txt(
'lang_sep_decimal'),
173 $this->
language->txt(
'lang_sep_thousand')
176 $placeHolders[
'SCO_PP_' . $counter] .=
' %';
184 return $placeHolders;
194 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
196 $object = $this->objectHelper->getInstanceByObjId($objId);
198 $placeholders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
200 $placeholders[
'SCORM_POINTS'] = number_format(
203 $this->
language->txt(
'lang_sep_decimal'),
204 $this->
language->txt(
'lang_sep_thousand')
207 $placeholders[
'SCORM_POINTS_MAX'] = number_format(
210 $this->
language->txt(
'lang_sep_decimal'),
211 $this->
language->txt(
'lang_sep_thousand')
215 foreach ($placeholders as
$id => $caption) {
216 $insert_tags[
$id] = $caption;
219 $olp = $this->objectLPHelper->getInstance($objId);
220 $collection = $olp->getCollectionInstance();
222 if ($collection !==
null) {
224 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
225 if ($collection->isAssignedEntry($item_id)) {
226 $insert_tags[
'SCO_T_' . $counter] = $sahs_item[
'title'];
228 $insert_tags[
'SCO_P_' . $counter] = number_format(
231 $this->
language->txt(
'lang_sep_decimal'),
232 $this->
language->txt(
'lang_sep_thousand')
235 $insert_tags[
'SCO_PM_' . $counter] = number_format(
238 $this->
language->txt(
'lang_sep_decimal'),
239 $this->
language->txt(
'lang_sep_thousand')
242 $insert_tags[
'SCO_PP_' . $counter] = number_format(
245 $this->
language->txt(
'lang_sep_decimal'),
246 $this->
language->txt(
'lang_sep_thousand')
readonly ilCertificateObjectLPHelper $objectLPHelper
readonly ilCertificateLPStatusHelper $lpStatusHelper
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
readonly ilDefaultPlaceholderValues $defaultPlaceholderValuesObject
readonly ilCertificateUtilHelper $utilHelper
readonly ilCertificateDateHelper $dateHelper
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
readonly ilLanguage $language
readonly ilCertificateObjectHelper $objectHelper
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
language()
description: > Example for rendring a language glyph.
__construct(?ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ?ilLanguage $language=null, ?ilCertificateDateHelper $dateHelper=null, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateObjectLPHelper $objectLPHelper=null, ?ilCertificateLPStatusHelper $lpStatusHelper=null)