ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCoursePlaceholderValues Class Reference
+ Inheritance diagram for ilCoursePlaceholderValues:
+ Collaboration diagram for ilCoursePlaceholderValues:

Public Member Functions

 __construct (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

 $defaultPlaceholderValuesObject
 
 $language
 
 $objectHelper
 
 $participantsHelper
 
 $ilUtilHelper
 
 $dateHelper
 
 $lpStatusHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $dateHelper, $DIC, $ilUtilHelper, $language, $lpStatusHelper, $objectHelper, and $participantsHelper.

61  {
62  if (null === $language) {
63  global $DIC;
64  $language = $DIC->language();
65  }
66  $this->language = $language;
67 
68  if (null === $defaultPlaceholderValues) {
69  $defaultPlaceholderValues = new ilDefaultPlaceholderValues();
70  }
71 
72  if (null === $objectHelper) {
73  $objectHelper = new ilCertificateObjectHelper();
74  }
75  $this->objectHelper = $objectHelper;
76 
77  if (null === $participantsHelper) {
78  $participantsHelper = new ilCertificateParticipantsHelper();
79  }
80  $this->participantsHelper = $participantsHelper;
81 
82  if (null === $ilUtilHelper) {
83  $ilUtilHelper = new ilCertificateUtilHelper();
84  }
85  $this->ilUtilHelper = $ilUtilHelper;
86 
87  if (null === $dateHelper) {
88  $dateHelper = new ilCertificateDateHelper();
89  }
90  $this->dateHelper = $dateHelper;
91 
92  if (null === $lpStatusHelper) {
93  $lpStatusHelper = new ilCertificateLPStatusHelper();
94  }
95  $this->lpStatusHelper = $lpStatusHelper;
96 
97  $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
98  }
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.

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

Implements ilCertificatePlaceholderValues.

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

References hasCompletionDate().

126  : array
127  {
128  $courseObject = $this->objectHelper->getInstanceByObjId($objId);
129 
130  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
131 
132  $completionDate = $this->participantsHelper->getDateTimeOfPassed($objId, $userId);
133  if (!$this->hasCompletionDate($completionDate)) {
134  $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
135  }
136 
137  if ($this->hasCompletionDate($completionDate)) {
138  $placeholders['DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
139  $placeholders['DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
140  }
141 
142  $placeholders['COURSE_TITLE'] = $this->ilUtilHelper->prepareFormOutput($courseObject->getTitle());
143 
144  return $placeholders;
145  }
+ 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
mixed

Implements ilCertificatePlaceholderValues.

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

References ilUtil\prepareFormOutput().

157  {
158  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
159 
160  $object = $this->objectHelper->getInstanceByObjId($objId);
161 
162  $placeholders['COURSE_TITLE'] = ilUtil::prepareFormOutput($object->getTitle());
163 
164  return $placeholders;
165  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
+ Here is the call graph for this function:

◆ hasCompletionDate()

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

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

Referenced by getPlaceholderValues().

104  : bool
105  {
106  return (
107  $possibleDate !== false &&
108  $possibleDate !== null &&
109  $possibleDate !== ''
110  );
111  }
+ Here is the caller graph for this function:

Field Documentation

◆ $dateHelper

ilCoursePlaceholderValues::$dateHelper
private

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

Referenced by __construct().

◆ $defaultPlaceholderValuesObject

ilCoursePlaceholderValues::$defaultPlaceholderValuesObject
private

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

◆ $ilUtilHelper

ilCoursePlaceholderValues::$ilUtilHelper
private

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

Referenced by __construct().

◆ $language

ilCoursePlaceholderValues::$language
private

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

Referenced by __construct().

◆ $lpStatusHelper

ilCoursePlaceholderValues::$lpStatusHelper
private

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

Referenced by __construct().

◆ $objectHelper

ilCoursePlaceholderValues::$objectHelper
private

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

Referenced by __construct().

◆ $participantsHelper

ilCoursePlaceholderValues::$participantsHelper
private

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

Referenced by __construct().


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