75 if (null === $defaultPlaceholderValues) {
78 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
128 $testObject = $this->objectHelper->getInstanceByObjId($objId);
130 $active_id = $testObject->getActiveIdOfUser($userId);
131 $pass = $this->testObjectHelper->getResultPass($active_id);
133 $result_array = &$testObject->getTestResult($active_id);
135 $result_array = &$testObject->getTestResult($active_id,
$pass);
138 $passed = $this->
language->txt(
'certificate_failed');
139 if ($result_array[
'test'][
'passed']) {
140 $passed = $this->
language->txt(
'certificate_passed');
144 if ($result_array[
'test'][
'total_max_points']) {
145 $percentage = ($result_array[
'test'][
'total_reached_points'] / $result_array[
'test'][
'total_max_points']) * 100;
148 $mark_obj = $testObject->getMarkSchema()->getMatchingMark($percentage);
149 $user_data = $this->userObjectHelper->lookupFields($userId);
151 $completionDate =
false;
152 if ($user_data[
'usr_id'] > 0) {
153 $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
156 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
158 $placeholders[
'RESULT_PASSED'] = $this->utilHelper->prepareFormOutput($passed);
159 $placeholders[
'RESULT_POINTS'] = $this->utilHelper->prepareFormOutput($result_array[
'test'][
'total_reached_points']);
160 $placeholders[
'RESULT_PERCENT'] = sprintf(
'%2.2f', $percentage) .
'%';
161 $placeholders[
'MAX_POINTS'] = $this->utilHelper->prepareFormOutput($result_array[
'test'][
'total_max_points']);
162 $placeholders[
'RESULT_MARK_SHORT'] = $this->utilHelper->prepareFormOutput($mark_obj->getShortName());
163 $placeholders[
'RESULT_MARK_LONG'] = $this->utilHelper->prepareFormOutput($mark_obj->getOfficialName());
164 $placeholders[
'TEST_TITLE'] = $this->utilHelper->prepareFormOutput($testObject->getTitle());
165 $placeholders[
'DATE_COMPLETED'] =
'';
166 $placeholders[
'DATETIME_COMPLETED'] =
'';
168 if ($completionDate !==
false &&
169 $completionDate !== null &&
170 $completionDate !==
'' 172 $placeholders[
'DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
173 $placeholders[
'DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
176 return $placeholders;
190 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
192 $object = $this->objectHelper->getInstanceByObjId($objId);
194 $placeholders[
'RESULT_PASSED'] = $this->utilHelper->prepareFormOutput($this->
language->txt(
'certificate_var_result_passed'));
195 $placeholders[
'RESULT_POINTS'] = $this->utilHelper->prepareFormOutput($this->
language->txt(
'certificate_var_result_points'));
196 $placeholders[
'RESULT_PERCENT'] = $this->utilHelper->prepareFormOutput($this->
language->txt(
'certificate_var_result_percent'));
197 $placeholders[
'MAX_POINTS'] = $this->utilHelper->prepareFormOutput($this->
language->txt(
'certificate_var_max_points'));
198 $placeholders[
'RESULT_MARK_SHORT'] = $this->utilHelper->prepareFormOutput($this->
language->txt(
'certificate_var_result_mark_short'));
199 $placeholders[
'RESULT_MARK_LONG'] = $this->utilHelper->prepareFormOutput($this->
language->txt(
'certificate_var_result_mark_long'));
200 $placeholders[
'TEST_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
202 return $placeholders;
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
Collection of basic placeholder values that can be used.
__construct(ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ilLanguage $language=null, ilCertificateObjectHelper $objectHelper=null, ilCertificateTestObjectHelper $testObjectHelper=null, ilCertificateUserObjectHelper $userObjectHelper=null, ilCertificateLPStatusHelper $lpStatusHelper=null, ilCertificateUtilHelper $utilHelper=null, ilCertificateDateHelper $dateHelper=null)
Just a wrapper class to create Unit Test for other classes.
$defaultPlaceholderValuesObject
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...