19 declare(strict_types=1);
    25     public const ID = 
'prg_context_manual';
    28     private const TITLE = 
'STUDY_PROGRAMME_TITLE';
    30     private const TYPE = 
'STUDY_PROGRAMME_TYPE';
    31     private const LINK = 
'STUDY_PROGRAMME_LINK';
    32     private const ORG_UNIT = 
'STUDY_PROGRAMME_ORG_UNITS';
    33     private const STATUS = 
'STUDY_PROGRAMME_STATUS';
    38     private const DEADLINE = 
'STUDY_PROGRAMME_DEADLINE';
    40     private const VALIDITY = 
'STUDY_PROGRAMME_VALIDITY';
    43         self::TITLE => 
'prg_title',
    44         self::DESCRIPTION => 
'prg_description',
    45         self::TYPE => 
'prg_type',
    46         self::LINK => 
'prg_link',
    47         self::ORG_UNIT => 
'prg_orgus',
    48         self::STATUS => 
'prg_status',
    49         self::COMPLETION_DATE => 
'prg_completion_date',
    50         self::COMPLETED_BY => 
'prg_completion_by',
    51         self::POINTS_REQUIRED => 
'prg_points_required',
    52         self::POINTS_CURRENT => 
'prg_points_current',
    53         self::DEADLINE => 
'prg_deadline',
    54         self::EXPIRE_DATE => 
'prg_expiry_date',
    55         self::VALIDITY => 
'prg_validity',
    77         $this->
lng = $DIC[
'lng'];
    78         $this->
lng->loadLanguageModule(
'prg');
    88         return $this->
lng->txt(
'prg_mail_context_title');
    93         return $this->
lng->txt(
'prg_mail_context_info');
   102         foreach (self::PLACEHOLDER_TRANSLATIONS as 
$id => $label) {
   103             $placeholders[
$id] = [
   104                 'placeholder' => 
$id,
   105                 'label' => $this->
lng->txt($label)
   108         return $placeholders;
   115         string $placeholder_id,
   116         array $context_parameters,
   120         if (is_null($recipient)) {
   124         $placeholder_id = strtoupper($placeholder_id);
   125         if (! array_key_exists($placeholder_id, self::PLACEHOLDER_TRANSLATIONS)) {
   131         $assignments = $prg->getAssignmentsOfSingleProgramForUser($recipient->getId());
   135         switch ($placeholder_id) {
   137                 $string = $prg->getTitle();
   139             case self::DESCRIPTION:
   140                 $string = $prg->getDescription();
   144                 if (!is_null($prg->getSubType())) {
   145                     $string = $prg->getSubType()->getTitle();
   149                 $string = ilLink::_getLink((
int) $context_parameters[
'ref_id'], 
'prg') . 
' ';
   155                 $string = $this->
statusToRepr($latest->getProgressTree()->getStatus(), $recipient->getLanguage());
   157             case self::COMPLETION_DATE:
   158                 $string = $this->
date2String($latest->getProgressTree()->getCompletionDate(), $recipient);
   160             case self::COMPLETED_BY:
   162                 $id = $latest->getProgressTree()->getCompletionBy();
   165                     if ($obj->getType() === 
'usr') {
   177             case self::POINTS_REQUIRED:
   178                 $string = (string) $latest->getProgressTree()->getAmountOfPoints();
   180             case self::POINTS_CURRENT:
   181                 $string = (string) $latest->getProgressTree()->getCurrentAmountOfPoints();
   184                 $string = $latest->getProgressTree()->isInProgress() ?
   185                     $this->
date2String($latest->getProgressTree()->getDeadline(), $recipient) : 
'';
   190                 if ($latest_successful) {
   191                     $langvar = $latest_successful->getProgressTree()->isInvalidated() ? 
'prg_not_valid' : 
'prg_still_valid';
   192                     $string = $this->
lng->txtlng(
'prg', $langvar, $recipient->getLanguage());
   196             case self::EXPIRE_DATE:
   198                 if ($latest_successful) {
   199                     $string = $this->
date2String($latest_successful->getProgressTree()->getValidityOfQualification(), $recipient);
   203                 throw new \Exception(
"cannot resolve placeholder: " . $placeholder_id);
   215             if ($a_dat > $b_dat) {
   217             } elseif ($a_dat < $b_dat) {
   223         return array_shift($assignments);
   228         $successful = array_filter(
   230             fn($ass) => $ass->getProgressTree()->isSuccessful()
   232         if (count($successful) === 0) {
   239             if ($a_dat > $b_dat) {
   241             } elseif ($a_dat < $b_dat) {
   247         return array_shift($successful);
   255             return $this->
lng->txtlng(
'prg', 
'prg_status_in_progress', $lang);
   258             return $this->
lng->txtlng(
'prg', 
'prg_status_completed', $lang);
   261             return $this->
lng->txtlng(
'prg', 
'prg_status_accredited', $lang);
   264             return $this->
lng->txtlng(
'prg', 
'prg_status_not_relevant', $lang);
   267             return $this->
lng->txtlng(
'prg', 
'prg_status_failed', $lang);
   270         throw new ilException(
"Unknown status: '$status'");
   277         if (is_null($date_time)) {
   280         if (is_null($user)) {
   281             return $date_time->format(self::DATE_FORMAT);
   283         return $user->getDateFormat()->applyTo($date_time);
 
getSpecificPlaceholders()
Return an array of placeholders. 
 
static _lookupTitle(int $obj_id)
 
OrgUnitUserService $orgUnitUserService
 
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
 
statusToRepr(int $status, string $lang)
 
Class ilMailEnvironmentHelper. 
 
static lookupOrgUnitsRepresentation(int $a_usr_id)
lookup org unit representation 
 
ilMailLanguageHelper $languageHelper
 
getLatestAssignment(array $assignments)
 
date2String(DateTimeImmutable $date_time=null, ilObjUser $user=null)
 
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data 
 
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null)
 
Class ilMailLanguageHelper. 
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
const STATUS_NOT_RELEVANT
 
getLatestSuccessfulAssignment(array $assignments)
 
const PLACEHOLDER_TRANSLATIONS
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
__construct(Container $dic, ilPlugin $plugin)
 
static _lookupTargetRefId(int $a_obj_id)
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples 
 
ilMailEnvironmentHelper $envHelper
 
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
 
static _lookupDeletedDate(int $ref_id)
 
static _lookupLogin(int $a_user_id)