ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCoursePlaceholderValues Class Reference
+ Inheritance diagram for ilCoursePlaceholderValues:
+ Collaboration diagram for ilCoursePlaceholderValues:

Public Member Functions

 __construct (?ilObjectCustomUserFieldsPlaceholderValues $customUserFieldsPlaceholderValues=null, ?ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ?ilLanguage $language=null, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateParticipantsHelper $participantsHelper=null, ?ilCertificateUtilHelper $ilUtilHelper=null, ?ilCertificateDateHelper $dateHelper=null, ?ilCertificateLPStatusHelper $lpStatusHelper=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 Member Functions

 hasCompletionDate ($possibleDate)
 

Private Attributes

ilDefaultPlaceholderValues $defaultPlaceholderValuesObject
 
ilObjectCustomUserFieldsPlaceholderValues $customUserFieldsPlaceholderValuesObject
 
ilLanguage $language
 
ilCertificateObjectHelper $objectHelper
 
ilCertificateParticipantsHelper $participantsHelper
 
ilCertificateUtilHelper $ilUtilHelper
 
ilCertificateDateHelper $dateHelper
 
ilCertificateLPStatusHelper $lpStatusHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCoursePlaceholderValues::__construct ( ?ilObjectCustomUserFieldsPlaceholderValues  $customUserFieldsPlaceholderValues = null,
?ilDefaultPlaceholderValues  $defaultPlaceholderValues = null,
?ilLanguage  $language = null,
?ilCertificateObjectHelper  $objectHelper = null,
?ilCertificateParticipantsHelper  $participantsHelper = null,
?ilCertificateUtilHelper  $ilUtilHelper = null,
?ilCertificateDateHelper  $dateHelper = null,
?ilCertificateLPStatusHelper  $lpStatusHelper = null 
)

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

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

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

Member Function Documentation

◆ getPlaceholderValues()

ilCoursePlaceholderValues::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
ilInvalidCertificateException
ilObjectNotFoundException

Implements ilCertificatePlaceholderValues.

Definition at line 117 of file class.ilCoursePlaceholderValues.php.

References hasCompletionDate().

117  : array
118  {
119  $courseObject = $this->objectHelper->getInstanceByObjId($objId);
120 
121  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
122 
123  $customUserFieldsPlaceholders = $this->customUserFieldsPlaceholderValuesObject->getPlaceholderValues(
124  $userId,
125  $objId
126  );
127 
128  $placeholders = array_merge($placeholders, $customUserFieldsPlaceholders);
129 
130  $completionDate = $this->participantsHelper->getDateTimeOfPassed($objId, $userId);
131  if (!$this->hasCompletionDate($completionDate)) {
132  $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
133  }
134 
135  if ($this->hasCompletionDate($completionDate)) {
136  $placeholders['DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
137  $placeholders['DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
138  }
139 
140  $placeholders['COURSE_TITLE'] = $this->ilUtilHelper->prepareFormOutput($courseObject->getTitle());
141 
142  return $placeholders;
143  }
$objId
Definition: xapitoken.php:57
+ Here is the call graph for this function:

◆ getPlaceholderValuesForPreview()

ilCoursePlaceholderValues::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
Exceptions
ilDatabaseException
ilDateTimeException
ilException
ilObjectNotFoundException

Implements ilCertificatePlaceholderValues.

Definition at line 157 of file class.ilCoursePlaceholderValues.php.

References ilLegacyFormElementsUtil\prepareFormOutput().

157  : array
158  {
159  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
160 
161  $customUserFieldsPlaceholders = $this->customUserFieldsPlaceholderValuesObject->getPlaceholderValuesForPreview(
162  $userId,
163  $objId
164  );
165 
166  $placeholders = array_merge($placeholders, $customUserFieldsPlaceholders);
167 
168  $object = $this->objectHelper->getInstanceByObjId($objId);
169 
170  $placeholders['COURSE_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput($object->getTitle());
171 
172  return $placeholders;
173  }
$objId
Definition: xapitoken.php:57
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:

◆ hasCompletionDate()

ilCoursePlaceholderValues::hasCompletionDate (   $possibleDate)
private
Parameters
mixed$possibleDate
Returns
bool

Definition at line 93 of file class.ilCoursePlaceholderValues.php.

Referenced by getPlaceholderValues().

93  : bool
94  {
95  return (
96  $possibleDate !== false &&
97  $possibleDate !== null &&
98  $possibleDate !== ''
99  );
100  }
+ Here is the caller graph for this function:

Field Documentation

◆ $customUserFieldsPlaceholderValuesObject

ilObjectCustomUserFieldsPlaceholderValues ilCoursePlaceholderValues::$customUserFieldsPlaceholderValuesObject
private

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

◆ $dateHelper

ilCertificateDateHelper ilCoursePlaceholderValues::$dateHelper
private

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

Referenced by __construct().

◆ $defaultPlaceholderValuesObject

ilDefaultPlaceholderValues ilCoursePlaceholderValues::$defaultPlaceholderValuesObject
private

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

◆ $ilUtilHelper

ilCertificateUtilHelper ilCoursePlaceholderValues::$ilUtilHelper
private

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

Referenced by __construct().

◆ $language

ilLanguage ilCoursePlaceholderValues::$language
private

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

Referenced by __construct().

◆ $lpStatusHelper

ilCertificateLPStatusHelper ilCoursePlaceholderValues::$lpStatusHelper
private

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

Referenced by __construct().

◆ $objectHelper

ilCertificateObjectHelper ilCoursePlaceholderValues::$objectHelper
private

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

Referenced by __construct().

◆ $participantsHelper

ilCertificateParticipantsHelper ilCoursePlaceholderValues::$participantsHelper
private

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

Referenced by __construct().


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