19 declare(strict_types=1);
36 if (null === $language) {
38 $language = $DIC->language();
43 if (null === $defaultPlaceholderValues) {
47 if (null === $objectHelper) {
52 if (null === $participantsHelper) {
57 if (null === $ilUtilHelper) {
62 $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
80 $object = $this->objectHelper->getInstanceByObjId($objId);
81 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
82 $assignments = $object->getAssignmentsOfSingleProgramForUser($userId);
84 $type = $object->getSubType();
90 $latest_progress ? (
string) $latest_progress->getCurrentAmountOfPoints() :
'' 93 $latest_progress ? $latest_progress->getCompletionDate()->format(
'd.m.Y') :
'' 96 $latest_progress && $latest_progress->getValidityOfQualification() ?
97 $latest_progress->getValidityOfQualification()->format(
'd.m.Y') :
'' 112 $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
114 $object = $this->objectHelper->getInstanceByObjId($objId);
115 $type = $object->getSubType();
121 $placeholders[
'PRG_COMPLETION_DATE'] = $today;
122 $placeholders[
'PRG_EXPIRES_AT'] = $today;
123 return $placeholders;
128 if (count($assignments) === 0) {
131 $latest_progress = null;
133 if ($latest_successful) {
134 $latest_progress = $latest_successful->getProgressTree();
136 return $latest_progress;
141 $successful = array_filter(
143 fn ($ass) => $ass->getProgressTree()->isSuccessful()
145 if (count($successful) === 0) {
150 $unlimited = array_filter(
152 fn ($ass) => is_null($ass->getProgressTree()->getValidityOfQualification())
154 if (count($unlimited) > 0) {
155 $successful = $unlimited;
159 if ($a_dat > $b_dat) {
161 } elseif ($a_dat < $b_dat) {
169 $limited = array_filter(
171 fn ($ass) => !is_null($ass->getProgressTree()->getValidityOfQualification())
173 $successful = $limited;
177 if ($a_dat > $b_dat) {
179 } elseif ($a_dat < $b_dat) {
186 return array_shift($successful);
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)
getRelevantProgressFromAssignments(array $assignments)
loadLanguageModule(string $a_module)
Load language module.
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
ilCertificateUtilHelper $ilUtilHelper
getLatestSuccessfulAssignment(array $assignments)
ilDefaultPlaceholderValues $defaultPlaceholderValuesObject
ilCertificateObjectHelper $objectHelper
ilCertificateParticipantsHelper $participantsHelper
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
Just a wrapper class to create Unit Test for other classes.
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...