ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilStudyProgrammePlaceholderValues Class Reference
+ Inheritance diagram for ilStudyProgrammePlaceholderValues:
+ Collaboration diagram for ilStudyProgrammePlaceholderValues:

Public Member Functions

 __construct (ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ilLanguage $language=null, ilCertificateObjectHelper $objectHelper=null, ilCertificateParticipantsHelper $participantsHelper=null, ilCertificateUtilHelper $ilUtilHelper=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

 $defaultPlaceholderValuesObject
 
 $language
 
 $objectHelper
 
 $participantsHelper
 
 $ilUtilHelper
 

Detailed Description

Definition at line 4 of file class.ilStudyProgrammePlaceholderValues.php.

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammePlaceholderValues::__construct ( ilDefaultPlaceholderValues  $defaultPlaceholderValues = null,
ilLanguage  $language = null,
ilCertificateObjectHelper  $objectHelper = null,
ilCertificateParticipantsHelper  $participantsHelper = null,
ilCertificateUtilHelper  $ilUtilHelper = null 
)
Parameters
ilDefaultPlaceholderValues$defaultPlaceholderValues
ilLanguage | null$language
ilCertificateObjectHelper | null$objectHelper
ilCertificateParticipantsHelper | null$participantsHelper
ilCertificateUtilHelper$ilUtilHelper
ilCertificateDateHelper | null$ilDateHelper

Definition at line 39 of file class.ilStudyProgrammePlaceholderValues.php.

45 {
46 if (null === $language) {
47 global $DIC;
48 $language = $DIC->language();
49 $language->loadLanguageModule('certificate');
50 }
51 $this->language = $language;
52
53 if (null === $defaultPlaceholderValues) {
54 $defaultPlaceholderValues = new ilDefaultPlaceholderValues();
55 }
56
57 if (null === $objectHelper) {
59 }
60 $this->objectHelper = $objectHelper;
61
62 if (null === $participantsHelper) {
64 }
65 $this->participantsHelper = $participantsHelper;
66
67 if (null === $ilUtilHelper) {
69 }
70 $this->ilUtilHelper = $ilUtilHelper;
71
72 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
73 }
Just a wrapper class to create Unit Test for other classes.
Collection of basic placeholder values that can be used.
language()
Definition: language.php:2
$DIC
Definition: xapitoken.php:46

References $DIC, $ilUtilHelper, $language, $objectHelper, $participantsHelper, and language().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPlaceholderValues()

ilStudyProgrammePlaceholderValues::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 88 of file class.ilStudyProgrammePlaceholderValues.php.

88 : array
89 {
90 $object = $this->objectHelper->getInstanceByObjId($objId);
91
92 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
93 $latest_progress = array_reduce(
94 $object->getProgressesOf($userId),
95 function ($one, $other) {
96 if ($one !== null && $one->isSuccessful() && $other !== null && $other->isSuccessful()) {
97 return
98 $one->getCompletionDate()->format('Y-m-d H:i:s') > $other->getCompletionDate()->format('Y-m-d H:i:s') ?
99 $one :
100 $other;
101 }
102 if ($one !== null && $one->isSuccessful()) {
103 return $one;
104 }
105 if ($other !== null && $other->isSuccessful()) {
106 return $other;
107 }
108 return null;
109 }
110 );
111 $type = $object->getSubType();
112 $placeholders['PRG_TITLE'] = ilUtil::prepareFormOutput($object->getTitle());
113 $placeholders['PRG_DESCRIPTION'] = ilUtil::prepareFormOutput($object->getDescription());
114 $placeholders['PRG_TYPE'] = ilUtil::prepareFormOutput($type ? $type->getTitle() : '');
115 $placeholders['PRG_POINTS'] = ilUtil::prepareFormOutput($object->getPoints());
116 $placeholders['PRG_COMPLETION_DATE'] = ilUtil::prepareFormOutput($latest_progress->getCompletionDate() instanceof \DateTime ? $latest_progress->getCompletionDate()->format('d.m.Y') : '');
117 $placeholders['PRG_EXPIRES_AT'] = ilUtil::prepareFormOutput($latest_progress->getValidityOfQualification() instanceof \DateTime ? $latest_progress->getValidityOfQualification()->format('d.m.Y') : '');
118 return $placeholders;
119 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
$type
$objId
Definition: xapitoken.php:41

References $objId, $type, if, and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getPlaceholderValuesForPreview()

ilStudyProgrammePlaceholderValues::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 130 of file class.ilStudyProgrammePlaceholderValues.php.

131 {
132 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
133
134 $object = $this->objectHelper->getInstanceByObjId($objId);
135 $type = $object->getSubType();
136 $today = ilUtil::prepareFormOutput((new DateTime())->format('d.m.Y'));
137 $placeholders['PRG_TITLE'] = ilUtil::prepareFormOutput($object->getTitle());
138 $placeholders['PRG_DESCRIPTION'] = ilUtil::prepareFormOutput($object->getDescription());
139 $placeholders['PRG_TYPE'] = ilUtil::prepareFormOutput($type ? $type->getTitle() : '');
140 $placeholders['PRG_POINTS'] = ilUtil::prepareFormOutput($object->getPoints());
141 $placeholders['PRG_COMPLETION_DATE'] = $today;
142 $placeholders['PRG_EXPIRES_AT'] = $today;
143 return $placeholders;
144 }

References $objId, $type, and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

Field Documentation

◆ $defaultPlaceholderValuesObject

ilStudyProgrammePlaceholderValues::$defaultPlaceholderValuesObject
private

Definition at line 9 of file class.ilStudyProgrammePlaceholderValues.php.

◆ $ilUtilHelper

ilStudyProgrammePlaceholderValues::$ilUtilHelper
private

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

Referenced by __construct().

◆ $language

ilStudyProgrammePlaceholderValues::$language
private

Definition at line 14 of file class.ilStudyProgrammePlaceholderValues.php.

Referenced by __construct().

◆ $objectHelper

ilStudyProgrammePlaceholderValues::$objectHelper
private

Definition at line 19 of file class.ilStudyProgrammePlaceholderValues.php.

Referenced by __construct().

◆ $participantsHelper

ilStudyProgrammePlaceholderValues::$participantsHelper
private

Definition at line 24 of file class.ilStudyProgrammePlaceholderValues.php.

Referenced by __construct().


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