ILIAS  release_8 Revision v8.24
ilExercisePlaceholderValues Class Reference
+ Inheritance diagram for ilExercisePlaceholderValues:
+ Collaboration diagram for ilExercisePlaceholderValues:

Public Member Functions

 __construct (?ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ?ilLanguage $language=null, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateLPMarksHelper $lpMarksHelper=null, ?ilCertificateExerciseMembersHelper $exerciseMembersHelper=null, ?ilCertificateLPStatusHelper $lpStatusHelper=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateDateHelper $dateHelper=null)
 
 getPlaceholderValues (int $userId, int $objId)
 This method MUST return an array that contains the actual data for the given user of the given object. More...
 
 getPlaceholderValuesForPreview (int $userId, int $objId)
 This method is different then the 'getPlaceholderValues' method, this method is used to create a placeholder value array containing dummy values that is used to create a preview certificate. More...
 
 getPlaceholderValues (int $userId, int $objId)
 This method MUST return an array that contains the actual data for the given user of the given object. More...
 
 getPlaceholderValuesForPreview (int $userId, int $objId)
 This method is different then the 'getPlaceholderValues' method, this method is used to create a placeholder value array containing dummy values that is used to create a preview certificate. More...
 

Private Attributes

ilLanguage $language
 
ilDefaultPlaceholderValues $defaultPlaceholderValuesObject
 
ilCertificateLPMarksHelper $lpMarksHelper
 
ilCertificateObjectHelper $objectHelper
 
ilCertificateExerciseMembersHelper $exerciseMembersHelper
 
ilCertificateLPStatusHelper $lpStatusHelper
 
ilCertificateUtilHelper $utilHelper
 
ilCertificateDateHelper $dateHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExercisePlaceholderValues::__construct ( ?ilDefaultPlaceholderValues  $defaultPlaceholderValues = null,
?ilLanguage  $language = null,
?ilCertificateObjectHelper  $objectHelper = null,
?ilCertificateLPMarksHelper  $lpMarksHelper = null,
?ilCertificateExerciseMembersHelper  $exerciseMembersHelper = null,
?ilCertificateLPStatusHelper  $lpStatusHelper = null,
?ilCertificateUtilHelper  $utilHelper = null,
?ilCertificateDateHelper  $dateHelper = null 
)

Definition at line 35 of file class.ilExercisePlaceholderValues.php.

44 {
45 if (null === $language) {
46 global $DIC;
47 $language = $DIC->language();
48 $language->loadLanguageModule('certificate');
49 }
50 $language->loadLanguageModule('exercise');
52
53 $this->language = $language;
54
55 if (null === $defaultPlaceholderValues) {
56 $defaultPlaceholderValues = new ilDefaultPlaceholderValues();
57 }
58 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
59
60 if (null === $objectHelper) {
62 }
63 $this->objectHelper = $objectHelper;
64
65 if (null === $lpMarksHelper) {
67 }
68 $this->lpMarksHelper = $lpMarksHelper;
69
70 if (null === $exerciseMembersHelper) {
72 }
73 $this->exerciseMembersHelper = $exerciseMembersHelper;
74
75 if (null === $lpStatusHelper) {
77 }
78 $this->lpStatusHelper = $lpStatusHelper;
79
80 if (null === $utilHelper) {
82 }
83 $this->utilHelper = $utilHelper;
84
85 if (null === $dateHelper) {
87 }
88 $this->dateHelper = $dateHelper;
89 }
Just a wrapper class to create Unit Test for other classes.
Collection of basic placeholder values that can be used.
ilCertificateExerciseMembersHelper $exerciseMembersHelper
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28

References $dateHelper, $DIC, $exerciseMembersHelper, $language, $lpMarksHelper, $lpStatusHelper, $objectHelper, $utilHelper, ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ilLanguage\loadLanguageModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPlaceholderValues()

ilExercisePlaceholderValues::getPlaceholderValues ( int  $userId,
int  $objId 
)

This method MUST return an array that contains the actual data for the given user of the given object.

ilInvalidCertificateException MUST be thrown if the data could not be determined or the user did NOT achieve the certificate.

Parameters
int$userId
int$objId
Returns
array - [PLACEHOLDER] => 'actual value'
Exceptions
ilDatabaseException
ilDateTimeException
ilException
ilObjectNotFoundException

Implements ilCertificatePlaceholderValues.

Definition at line 105 of file class.ilExercisePlaceholderValues.php.

105 : array
106 {
107 $exerciseObject = $this->objectHelper->getInstanceByObjId($objId);
108
109 $mark = $this->lpMarksHelper->lookUpMark($userId, $objId);
110 $status = $this->exerciseMembersHelper->lookUpStatus($objId, $userId);
111
112 $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
113
114 $placeHolders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
115
116 if ($status !== null) {
117 $placeHolders['RESULT_PASSED'] = $this->utilHelper->prepareFormOutput($this->language->txt('exc_' . $status));
118 }
119
120 $placeHolders['RESULT_MARK'] = $this->utilHelper->prepareFormOutput($mark);
121 $placeHolders['EXERCISE_TITLE'] = $this->utilHelper->prepareFormOutput($exerciseObject->getTitle());
122 $placeHolders['DATE_COMPLETED'] = '';
123 $placeHolders['DATETIME_COMPLETED'] = '';
124
125 if ($completionDate !== '') {
126 $placeHolders['DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
127 $placeHolders['DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
128 }
129
130 return $placeHolders;
131 }
$objId
Definition: xapitoken.php:57

References $objId, and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ getPlaceholderValuesForPreview()

ilExercisePlaceholderValues::getPlaceholderValuesForPreview ( int  $userId,
int  $objId 
)

This method is different then the 'getPlaceholderValues' method, this method is used to create a placeholder value array containing dummy values that is used to create a preview certificate.

Parameters
int$userId
int$objId
Returns
array

Implements ilCertificatePlaceholderValues.

Definition at line 141 of file class.ilExercisePlaceholderValues.php.

141 : array
142 {
143 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
144
145 $object = $this->objectHelper->getInstanceByObjId($objId);
146
147 $placeholders['RESULT_PASSED'] = $this->utilHelper->prepareFormOutput($this->language->txt('certificate_var_result_passed'));
148 $placeholders['RESULT_MARK'] = $this->utilHelper->prepareFormOutput($this->language->txt('certificate_var_result_mark_short'));
149 $placeholders['EXERCISE_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
150
151 return $placeholders;
152 }

References $objId, and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

Field Documentation

◆ $dateHelper

ilCertificateDateHelper ilExercisePlaceholderValues::$dateHelper
private

Definition at line 33 of file class.ilExercisePlaceholderValues.php.

Referenced by __construct().

◆ $defaultPlaceholderValuesObject

ilDefaultPlaceholderValues ilExercisePlaceholderValues::$defaultPlaceholderValuesObject
private

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

◆ $exerciseMembersHelper

ilCertificateExerciseMembersHelper ilExercisePlaceholderValues::$exerciseMembersHelper
private

Definition at line 30 of file class.ilExercisePlaceholderValues.php.

Referenced by __construct().

◆ $language

ilLanguage ilExercisePlaceholderValues::$language
private

Definition at line 26 of file class.ilExercisePlaceholderValues.php.

Referenced by __construct().

◆ $lpMarksHelper

ilCertificateLPMarksHelper ilExercisePlaceholderValues::$lpMarksHelper
private

Definition at line 28 of file class.ilExercisePlaceholderValues.php.

Referenced by __construct().

◆ $lpStatusHelper

ilCertificateLPStatusHelper ilExercisePlaceholderValues::$lpStatusHelper
private

Definition at line 31 of file class.ilExercisePlaceholderValues.php.

Referenced by __construct().

◆ $objectHelper

ilCertificateObjectHelper ilExercisePlaceholderValues::$objectHelper
private

Definition at line 29 of file class.ilExercisePlaceholderValues.php.

Referenced by __construct().

◆ $utilHelper

ilCertificateUtilHelper ilExercisePlaceholderValues::$utilHelper
private

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

Referenced by __construct().


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