ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilStudyProgrammePlaceholderValues Class Reference
+ Inheritance diagram for ilStudyProgrammePlaceholderValues:
+ Collaboration diagram for 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 21 of file class.ilStudyProgrammePlaceholderValues.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, and $objectHelper.

30  {
31  if (null === $language) {
32  global $DIC;
33  $language = $DIC->language();
34  $language->loadLanguageModule('certificate');
35  }
36 
37  if (null === $defaultPlaceholderValues) {
38  $defaultPlaceholderValues = new ilDefaultPlaceholderValues();
39  }
40 
41  if (null === $objectHelper) {
43  }
44  $this->objectHelper = $objectHelper;
45 
46  $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
47  }
Collection of basic placeholder values that can be used.
global $DIC
Definition: feed.php:28

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.

Exceptions
ilDatabaseException
ilException
ilObjectNotFoundException

Implements ilCertificatePlaceholderValues.

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

References ilLegacyFormElementsUtil\prepareFormOutput().

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

Implements ilCertificatePlaceholderValues.

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

References ilLegacyFormElementsUtil\prepareFormOutput().

93  : array
94  {
95  $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
96 
97  $object = $this->objectHelper->getInstanceByObjId($objId);
98  $type = $object->getSubType();
99  $today = ilLegacyFormElementsUtil::prepareFormOutput((new DateTime())->format('d.m.Y'));
100  $placeholders['PRG_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput($object->getTitle());
101  $placeholders['PRG_DESCRIPTION'] = ilLegacyFormElementsUtil::prepareFormOutput($object->getDescription());
102  $placeholders['PRG_TYPE'] = ilLegacyFormElementsUtil::prepareFormOutput($type ? $type->getTitle() : '');
103  $placeholders['PRG_POINTS'] = ilLegacyFormElementsUtil::prepareFormOutput((string) $object->getPoints());
104  $placeholders['PRG_COMPLETION_DATE'] = $today;
105  $placeholders['PRG_EXPIRES_AT'] = $today;
106  return $placeholders;
107  }
$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 ilStudyProgrammePlaceholderValues::$defaultPlaceholderValuesObject
private

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

◆ $objectHelper

readonly ilCertificateObjectHelper ilStudyProgrammePlaceholderValues::$objectHelper
private

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

Referenced by __construct().


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