65 $language->loadLanguageModule(
'certificate');
69 if (null === $defaultPlaceholderValues) {
72 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
116 $this->
language->loadLanguageModule(
'certificate');
118 $object = $this->objectHelper->getInstanceByObjId($objId);
119 $points = $object->getPointsInPercent();
120 $txtPoints = number_format($points, 1, $this->
language->txt(
'lang_sep_decimal'), $this->
language->txt(
'lang_sep_thousand')) .
' %';
121 if (is_null($points)) {
122 $txtPoints = $this->
language->txt(
'certificate_points_notavailable');
125 $max_points = $object->getMaxPoints();
126 $txtMaxPoints = $max_points;
127 if (is_null($max_points)) {
128 $txtMaxPoints = $this->
language->txt(
'certificate_points_notavailable');
129 } elseif ($max_points != floor($max_points)) {
130 $txtMaxPoints = number_format($max_points, 1, $this->
language->txt(
'lang_sep_decimal'), $this->
language->txt(
'lang_sep_thousand'));
133 $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
135 $placeHolders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
137 $placeHolders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
138 $placeHolders[
'SCORM_POINTS'] = $txtPoints;
139 $placeHolders[
'SCORM_POINTS_MAX'] = $txtMaxPoints;
141 $placeHolders[
'DATE_COMPLETED'] =
'';
142 $placeHolders[
'DATETIME_COMPLETED'] =
'';
144 if ($completionDate !==
false &&
145 $completionDate !== null &&
146 $completionDate !==
'' 148 $placeHolders[
'DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
149 $placeHolders[
'DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
152 $olp = $this->objectLPHelper->getInstance($object->getId());
153 $collection = $olp->getCollectionInstance();
157 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
158 if ($collection->isAssignedEntry($item_id)) {
159 $placeHolders[
'SCO_T_' . $counter] = $sahs_item[
'title'];
160 $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id, $userId);
162 $placeHolders[
'SCO_P_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
163 if ($a_scores[
'raw'] !== null) {
164 $placeHolders[
'SCO_P_' . $counter] = number_format(
167 $this->
language->txt(
'lang_sep_decimal'),
168 $this->
language->txt(
'lang_sep_thousand')
172 $placeHolders[
'SCO_PM_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
173 if ($a_scores[
'max'] !== null) {
174 $placeHolders[
'SCO_PM_' . $counter] = number_format(
177 $this->
language->txt(
'lang_sep_decimal'),
178 $this->
language->txt(
'lang_sep_thousand')
182 $placeHolders[
'SCO_PP_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
183 if ($a_scores[
'scaled'] !== null) {
184 $placeHolders[
'SCO_PP_' . $counter] = number_format(
185 ($a_scores[
'scaled'] * 100),
187 $this->
language->txt(
'lang_sep_decimal'),
188 $this->
language->txt(
'lang_sep_thousand')
191 $placeHolders[
'SCO_PP_' . $counter] .=
' %';
199 return $placeHolders;
213 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
215 $object = $this->objectHelper->getInstanceByObjId($objId);
217 $placeholders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
219 $placeholders[
'SCORM_POINTS'] = number_format(
222 $this->
language->txt(
'lang_sep_decimal'),
223 $this->
language->txt(
'lang_sep_thousand')
226 $placeholders[
'SCORM_POINTS_MAX'] = number_format(
229 $this->
language->txt(
'lang_sep_decimal'),
230 $this->
language->txt(
'lang_sep_thousand')
233 $insert_tags = array();
234 foreach ($placeholders as $id => $caption) {
235 $insert_tags[$id] = $caption;
238 $olp = $this->objectLPHelper->getInstance($objId);
239 $collection = $olp->getCollectionInstance();
243 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
244 if ($collection->isAssignedEntry($item_id)) {
245 $insert_tags[
'SCO_T_' . $counter] = $sahs_item[
'title'];
247 $insert_tags[
'SCO_P_' . $counter] = number_format(
250 $this->
language->txt(
'lang_sep_decimal'),
251 $this->
language->txt(
'lang_sep_thousand')
254 $insert_tags[
'SCO_PM_' . $counter] = number_format(
257 $this->
language->txt(
'lang_sep_decimal'),
258 $this->
language->txt(
'lang_sep_thousand')
261 $insert_tags[
'SCO_PP_' . $counter] = number_format(
264 $this->
language->txt(
'lang_sep_decimal'),
265 $this->
language->txt(
'lang_sep_thousand')
Collection of basic placeholder values that can be used.
$defaultPlaceholderValuesObject
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
Just a wrapper class to create Unit Test for other classes.
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
__construct(ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ilLanguage $language=null, ilCertificateDateHelper $dateHelper=null, ilCertificateObjectHelper $objectHelper=null, ilCertificateUtilHelper $utilHelper=null, ilCertificateObjectLPHelper $objectLPHelper=null, ilCertificateLPStatusHelper $lpStatusHelper=null)