49 $language->loadLanguageModule(
'certificate');
53 if (
null === $defaultPlaceholderValues) {
72 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
90 $object = $this->objectHelper->getInstanceByObjId(
$objId);
91 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId,
$objId);
92 $latest_progress = array_reduce(
93 $object->getProgressesOf($userId),
94 function ($one, $other) {
95 if ($one !==
null && $one->isSuccessful() && $other !==
null && $other->isSuccessful()) {
97 $one->getCompletionDate()->format(
'Y-m-d H:i:s') > $other->getCompletionDate()->format(
'Y-m-d H:i:s') ?
101 if ($one !==
null && $one->isSuccessful()) {
104 if ($other !==
null && $other->isSuccessful()) {
111 if (!$latest_progress) {
112 throw new \ilInvalidCertificateException(
'PRG: no valid progress for user ' . $userId .
' while generating certificate');
115 $type = $object->getSubType();
120 $placeholders[
'PRG_COMPLETION_DATE'] =
ilUtil::prepareFormOutput($latest_progress->getCompletionDate() instanceof \DateTimeImmutable ? $latest_progress->getCompletionDate()->format(
'd.m.Y') :
'');
121 $placeholders[
'PRG_EXPIRES_AT'] =
ilUtil::prepareFormOutput($latest_progress->getValidityOfQualification() instanceof \DateTimeImmutable ? $latest_progress->getValidityOfQualification()->format(
'd.m.Y') :
'');
122 return $placeholders;
136 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId,
$objId);
138 $object = $this->objectHelper->getInstanceByObjId(
$objId);
139 $type = $object->getSubType();
145 $placeholders[
'PRG_COMPLETION_DATE'] = $today;
146 $placeholders[
'PRG_EXPIRES_AT'] = $today;
147 return $placeholders;
An exception for terminatinating execution or to throw for unit testing.
Just a wrapper class to create Unit Test for other classes.
Collection of basic placeholder values that can be used.
__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...
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
$defaultPlaceholderValuesObject
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