ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 

Private Attributes

 $language
 
 $defaultPlaceholderValuesObject
 
 $lpMarksHelper
 
 $objectHelper
 
 $exerciseMembersHelper
 
 $lpStatusHelper
 
 $utilHelper
 
 $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 
)
Parameters
ilDefaultPlaceholderValues | null$defaultPlaceholderValues
ilLanguage | null$language
ilCertificateObjectHelper | null$objectHelper
ilCertificateLPMarksHelper | null$lpMarksHelper
ilCertificateExerciseMembersHelper | null$exerciseMembersHelper
ilCertificateLPStatusHelper | null$lpStatusHelper
ilCertificateUtilHelper | null$utilHelper
ilCertificateDateHelper | null$dateHelper

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

References $dateHelper, $DIC, $exerciseMembersHelper, $language, $lpMarksHelper, $lpStatusHelper, $objectHelper, and $utilHelper.

68  {
69  if (null === $language) {
70  global $DIC;
71  $language = $DIC->language();
72  }
73  $language->loadLanguageModule('exercise');
74  $language->loadLanguageModule('exc');
75 
76  $this->language = $language;
77 
78  if (null === $defaultPlaceholderValues) {
79  $defaultPlaceholderValues = new ilDefaultPlaceholderValues();
80  }
81  $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
82 
83  if (null === $objectHelper) {
84  $objectHelper = new ilCertificateObjectHelper();
85  }
86  $this->objectHelper = $objectHelper;
87 
88  if (null === $lpMarksHelper) {
89  $lpMarksHelper = new ilCertificateLPMarksHelper();
90  }
91  $this->lpMarksHelper = $lpMarksHelper;
92 
93  if (null === $exerciseMembersHelper) {
94  $exerciseMembersHelper = new ilCertificateExerciseMembersHelper();
95  }
96  $this->exerciseMembersHelper = $exerciseMembersHelper;
97 
98  if (null === $lpStatusHelper) {
99  $lpStatusHelper = new ilCertificateLPStatusHelper();
100  }
101  $this->lpStatusHelper = $lpStatusHelper;
102 
103  if (null === $utilHelper) {
104  $utilHelper = new ilCertificateUtilHelper();
105  }
106  $this->utilHelper = $utilHelper;
107 
108  if (null === $dateHelper) {
109  $dateHelper = new ilCertificateDateHelper();
110  }
111  $this->dateHelper = $dateHelper;
112  }
Collection of basic placeholder values that can be used.
global $DIC
Definition: saml.php:7
Just a wrapper class to create Unit Test for other classes.
loadLanguageModule($a_module)

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
$userId
$objId
Returns
mixed - [PLACEHOLDER] => 'actual value'
Exceptions
ilDateTimeException
ilException

Implements ilCertificatePlaceholderValues.

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

128  : array
129  {
130  $exerciseObject = $this->objectHelper->getInstanceByObjId($objId);
131 
132  $mark = (string) $this->lpMarksHelper->lookUpMark($userId, $objId);
133  $status = $this->exerciseMembersHelper->lookUpStatus($objId, $userId);
134 
135  $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
136 
137  $placeHolders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
138 
139  $placeHolders['RESULT_PASSED'] = $this->utilHelper->prepareFormOutput($this->language->txt('exc_' . $status));
140  $placeHolders['RESULT_MARK'] = $this->utilHelper->prepareFormOutput($mark);
141  $placeHolders['EXERCISE_TITLE'] = $this->utilHelper->prepareFormOutput($exerciseObject->getTitle());
142  $placeHolders['DATE_COMPLETED'] = '';
143  $placeHolders['DATETIME_COMPLETED'] = '';
144 
145  if ($completionDate !== false &&
146  $completionDate !== null &&
147  $completionDate !== ''
148  ) {
149  $placeHolders['DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
150  $placeHolders['DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
151  }
152 
153  return $placeHolders;
154  }

◆ 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 165 of file class.ilExercisePlaceholderValues.php.

165  : array
166  {
167  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
168 
169  $object = $this->objectHelper->getInstanceByObjId($objId);
170 
171  $placeholders['RESULT_PASSED'] = $this->utilHelper->prepareFormOutput($this->language->txt('certificate_var_result_passed'));
172  $placeholders['RESULT_MARK'] = $this->utilHelper->prepareFormOutput($this->language->txt('certificate_var_result_mark_short'));
173  $placeholders['EXERCISE_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
174 
175  return $placeholders;
176  }

Field Documentation

◆ $dateHelper

ilExercisePlaceholderValues::$dateHelper
private

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

Referenced by __construct().

◆ $defaultPlaceholderValuesObject

ilExercisePlaceholderValues::$defaultPlaceholderValuesObject
private

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

◆ $exerciseMembersHelper

ilExercisePlaceholderValues::$exerciseMembersHelper
private

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

Referenced by __construct().

◆ $language

ilExercisePlaceholderValues::$language
private

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

Referenced by __construct().

◆ $lpMarksHelper

ilExercisePlaceholderValues::$lpMarksHelper
private

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

Referenced by __construct().

◆ $lpStatusHelper

ilExercisePlaceholderValues::$lpStatusHelper
private

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

Referenced by __construct().

◆ $objectHelper

ilExercisePlaceholderValues::$objectHelper
private

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

Referenced by __construct().

◆ $utilHelper

ilExercisePlaceholderValues::$utilHelper
private

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

Referenced by __construct().


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