68 if (null === $defaultPlaceholderValues) {
71 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
115 $this->
language->loadLanguageModule(
'certificate');
117 $object = $this->objectHelper->getInstanceByObjId($objId);
118 $points = $object->getPointsInPercent();
119 $txtPoints = number_format($points, 1, $this->
language->txt(
'lang_sep_decimal'), $this->
language->txt(
'lang_sep_thousand')) .
' %';
120 if (is_null($points)) {
121 $txtPoints = $this->
language->txt(
'certificate_points_notavailable');
124 $max_points = $object->getMaxPoints();
125 $txtMaxPoints = $max_points;
126 if (is_null($max_points)) {
127 $txtMaxPoints = $this->
language->txt(
'certificate_points_notavailable');
128 } elseif ($max_points != floor($max_points)) {
129 $txtMaxPoints = number_format($max_points, 1, $this->
language->txt(
'lang_sep_decimal'), $this->
language->txt(
'lang_sep_thousand'));
132 $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
134 $placeHolders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
136 $placeHolders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
137 $placeHolders[
'SCORM_POINTS'] = $txtPoints;
138 $placeHolders[
'SCORM_POINTS_MAX'] = $txtMaxPoints;
140 $placeHolders[
'DATE_COMPLETED'] =
'';
141 $placeHolders[
'DATETIME_COMPLETED'] =
'';
143 if ($completionDate !==
false &&
144 $completionDate !== null &&
145 $completionDate !==
'' 147 $placeHolders[
'DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
148 $placeHolders[
'DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
151 $olp = $this->objectLPHelper->getInstance($object->getId());
152 $collection = $olp->getCollectionInstance();
156 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
157 if ($collection->isAssignedEntry($item_id)) {
158 $placeHolders[
'SCO_T_' . $counter] = $sahs_item[
'title'];
159 $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id, $userId);
161 $placeHolders[
'SCO_P_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
162 if ($a_scores[
'raw'] !== null) {
163 $placeHolders[
'SCO_P_' . $counter] = number_format(
166 $this->
language->txt(
'lang_sep_decimal'),
167 $this->
language->txt(
'lang_sep_thousand')
171 $placeHolders[
'SCO_PM_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
172 if ($a_scores[
'max'] !== null) {
173 $placeHolders[
'SCO_PM_' . $counter] = number_format(
176 $this->
language->txt(
'lang_sep_decimal'),
177 $this->
language->txt(
'lang_sep_thousand')
181 $placeHolders[
'SCO_PP_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
182 if ($a_scores[
'scaled'] !== null) {
183 $placeHolders[
'SCO_PP_' . $counter] = number_format(
184 ($a_scores[
'scaled'] * 100),
186 $this->
language->txt(
'lang_sep_decimal'),
187 $this->
language->txt(
'lang_sep_thousand')
190 $placeHolders[
'SCO_PP_' . $counter] .=
' %';
198 return $placeHolders;
212 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
214 $object = $this->objectHelper->getInstanceByObjId($objId);
216 $placeholders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
218 $placeholders[
'SCORM_POINTS'] = number_format(
221 $this->
language->txt(
'lang_sep_decimal'),
222 $this->
language->txt(
'lang_sep_thousand')
225 $placeholders[
'SCORM_POINTS_MAX'] = number_format(
228 $this->
language->txt(
'lang_sep_decimal'),
229 $this->
language->txt(
'lang_sep_thousand')
232 $insert_tags = array();
233 foreach ($placeholders as
$id => $caption) {
234 $insert_tags[
$id] = $caption;
237 $olp = $this->objectLPHelper->getInstance($objId);
238 $collection = $olp->getCollectionInstance();
242 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
243 if ($collection->isAssignedEntry($item_id)) {
244 $insert_tags[
'SCO_T_' . $counter] = $sahs_item[
'title'];
246 $insert_tags[
'SCO_P_' . $counter] = number_format(
249 $this->
language->txt(
'lang_sep_decimal'),
250 $this->
language->txt(
'lang_sep_thousand')
253 $insert_tags[
'SCO_PM_' . $counter] = number_format(
256 $this->
language->txt(
'lang_sep_decimal'),
257 $this->
language->txt(
'lang_sep_thousand')
260 $insert_tags[
'SCO_PP_' . $counter] = number_format(
263 $this->
language->txt(
'lang_sep_decimal'),
264 $this->
language->txt(
'lang_sep_thousand')
Collection of basic placeholder values that can be used.
if(!array_key_exists('StateId', $_REQUEST)) $id
$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)