ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues Class Reference
+ Inheritance diagram for ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues:
+ Collaboration diagram for ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues:

Public Member Functions

 __construct (?\ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ?\ilLanguage $language=null, ?\ilCertificateObjectHelper $objectHelper=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

readonly ilDefaultPlaceholderValues $defaultPlaceholderValuesObject
 
readonly ilCertificateObjectHelper $objectHelper
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues::__construct ( ?\ilDefaultPlaceholderValues  $defaultPlaceholderValues = null,
?\ilLanguage  $language = null,
?\ilCertificateObjectHelper  $objectHelper = null 
)

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

References $DIC, ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues\$objectHelper, and null.

32  {
33  if (null === $language) {
34  global $DIC;
35  $language = $DIC->language();
36  $language->loadLanguageModule('certificate');
37  }
38 
39  if (null === $defaultPlaceholderValues) {
40  $defaultPlaceholderValues = new \ilDefaultPlaceholderValues();
41  }
42 
43  if (null === $objectHelper) {
44  $objectHelper = new \ilCertificateObjectHelper();
45  }
46  $this->objectHelper = $objectHelper;
47 
48  $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
49  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26

Member Function Documentation

◆ getPlaceholderValues()

ILIAS\StudyProgramme\Certificate\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.

Exceptions

Implements ilCertificatePlaceholderValues.

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

References $ass_id, and ilLegacyFormElementsUtil\prepareFormOutput().

61  : array
62  {
63  $object = $this->objectHelper->getInstanceByObjId($objId);
64  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
65 
66  $latest_progress = false;
67  $ass_id = $object->getCertificateRelevantAssignmentIds($userId);
68  if ($ass_id !== []) {
69  $latest_progress = $object->getSpecificAssignment(current($ass_id))->getProgressTree();
70  }
71 
72  $type = $object->getSubType();
73  $placeholders['PRG_TITLE'] = \ilLegacyFormElementsUtil::prepareFormOutput($object->getTitle());
74  $placeholders['PRG_DESCRIPTION'] = \ilLegacyFormElementsUtil::prepareFormOutput($object->getDescription());
75  $placeholders['PRG_TYPE'] = \ilLegacyFormElementsUtil::prepareFormOutput($type ? $type->getTitle() : '');
76  $placeholders['PRG_POINTS'] = \ilLegacyFormElementsUtil::prepareFormOutput(
77  $latest_progress ? (string) $latest_progress->getCurrentAmountOfPoints() : ''
78  );
79  $placeholders['PRG_COMPLETION_DATE'] = \ilLegacyFormElementsUtil::prepareFormOutput(
80  $latest_progress && $latest_progress->getCompletionDate() instanceof \DateTimeImmutable ? $latest_progress->getCompletionDate(
81  )->format('d.m.Y') : ''
82  );
83  $placeholders['PRG_EXPIRES_AT'] = \ilLegacyFormElementsUtil::prepareFormOutput(
84  $latest_progress && $latest_progress->getValidityOfQualification(
85  ) instanceof \DateTimeImmutable ? $latest_progress->getValidityOfQualification()->format('d.m.Y') : ''
86  );
87  return $placeholders;
88  }
$objId
Definition: xapitoken.php:57
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:

◆ getPlaceholderValuesForPreview()

ILIAS\StudyProgramme\Certificate\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.

Implements ilCertificatePlaceholderValues.

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

References ilLegacyFormElementsUtil\prepareFormOutput().

95  : array
96  {
97  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
98 
99  $object = $this->objectHelper->getInstanceByObjId($objId);
100  $type = $object->getSubType();
101  $today = \ilLegacyFormElementsUtil::prepareFormOutput((new \DateTime())->format('d.m.Y'));
102  $placeholders['PRG_TITLE'] = \ilLegacyFormElementsUtil::prepareFormOutput($object->getTitle());
103  $placeholders['PRG_DESCRIPTION'] = \ilLegacyFormElementsUtil::prepareFormOutput($object->getDescription());
104  $placeholders['PRG_TYPE'] = \ilLegacyFormElementsUtil::prepareFormOutput($type ? $type->getTitle() : '');
105  $placeholders['PRG_POINTS'] = \ilLegacyFormElementsUtil::prepareFormOutput((string) $object->getPoints());
106  $placeholders['PRG_COMPLETION_DATE'] = $today;
107  $placeholders['PRG_EXPIRES_AT'] = $today;
108  return $placeholders;
109  }
$objId
Definition: xapitoken.php:57
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:

Field Documentation

◆ $defaultPlaceholderValuesObject

readonly ilDefaultPlaceholderValues ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues::$defaultPlaceholderValuesObject
private

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

◆ $objectHelper

readonly ilCertificateObjectHelper ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues::$objectHelper
private

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