3declare(strict_types=1);
9 const ID =
'prg_context_manual';
47 $this->lng =
$DIC[
'lng'];
48 $this->lng->loadLanguageModule(
'prg');
54 public function getId() : string
64 return $this->lng->txt(
'prg_mail_context_title');
72 return $this->lng->txt(
'prg_mail_context_info');
81 $placeholders = array();
84 'placeholder' =>
'STUDY_PROGRAMME_TITLE',
85 'label' => $this->lng->txt(self::TITLE)
89 'placeholder' =>
'STUDY_PROGRAMME_DESCRIPTION',
90 'label' => $this->lng->txt(self::DESCRIPTION)
94 'placeholder' =>
'STUDY_PROGRAMME_TYPE',
95 'label' => $this->lng->txt(self::TYPE)
99 'placeholder' =>
'STUDY_PROGRAMME_LINK',
100 'label' => $this->lng->txt(self::LINK)
104 'placeholder' =>
'STUDY_PROGRAMME_ORG_UNITS',
105 'label' => $this->lng->txt(self::ORG_UNIT)
109 'placeholder' =>
'STUDY_PROGRAMME_STATUS',
110 'label' => $this->lng->txt(self::STATUS)
114 'placeholder' =>
'STUDY_PROGRAMME_COMPLETION_DATE',
115 'label' => $this->lng->txt(self::COMPLETION_DATE)
119 'placeholder' =>
'STUDY_PROGRAMME_COMPLETED_BY',
120 'label' => $this->lng->txt(self::COMPLETED_BY)
124 'placeholder' =>
'STUDY_PROGRAMME_POINTS_REQUIRED',
125 'label' => $this->lng->txt(self::POINTS_REQUIRED)
129 'placeholder' =>
'STUDY_PROGRAMME_POINTS_CURRENT',
130 'label' => $this->lng->txt(self::POINTS_CURRENT)
134 'placeholder' =>
'STUDY_PROGRAMME_DEADLINE',
135 'label' => $this->lng->txt(self::DEADLINE)
139 'placeholder' =>
'STUDY_PROGRAMME_EXPIRE_DATE',
140 'label' => $this->lng->txt(self::EXPIRE_DATE)
144 'placeholder' =>
'STUDY_PROGRAMME_VALIDITY',
145 'label' => $this->lng->txt(self::VALIDITY)
148 return $placeholders;
155 string $placeholder_id,
156 array $context_parameters,
158 bool $html_markup =
false
160 if (is_null($recipient)) {
164 if (!in_array($placeholder_id, [
171 self::COMPLETION_DATE,
173 self::POINTS_REQUIRED,
174 self::POINTS_CURRENT,
189 switch ($placeholder_id) {
198 if (!is_null($obj->getSubType())) {
199 $string = (string) $obj->getSubType()->getTitle();
209 $string = $this->
statusToRepr($progress->getStatus(), $recipient->getLanguage());
212 $string = $this->
date2String($progress->getCompletionDate());
216 $id = $progress->getCompletionBy();
219 if ($obj->getType() ==
'usr') {
234 $string = (string) $progress->getAmountOfPoints();
237 $string = (string) $progress->getCurrentAmountOfPoints();
240 $string = $this->
date2String($progress->getDeadline());
243 $now =
new DateTimeImmutable();
246 if (!is_null($progress->hasValidQualification($now))) {
247 $string = $this->lng->txtlng(
'prg',
'prg_not_valid', $recipient->getLanguage());
248 if ($progress->hasValidQualification($now)) {
249 $string = $this->lng->txtlng(
'prg',
'prg_still_valid', $recipient->getLanguage());
254 $string = $this->
date2String($progress->getValidityOfQualification());
268 return $a->isSuccessful() ||
$a->isSuccessfulExpired() ||
$a->isAccredited();
271 if (count($successfully_progress) == 0) {
276 if (
$a->getCompletionDate() >
$b->getCompletionDate()) {
278 } elseif (
$a->getCompletionDate() <
$b->getCompletionDate()) {
285 return array_shift($successfully_progress);
291 return $this->lng->txtlng(
'prg',
'prg_status_in_progress',
$lang);
294 return $this->lng->txtlng(
'prg',
'prg_status_completed',
$lang);
297 return $this->lng->txtlng(
'prg',
'prg_status_accredited',
$lang);
300 return $this->lng->txtlng(
'prg',
'prg_status_not_relevant',
$lang);
303 return $this->lng->txtlng(
'prg',
'prg_status_failed',
$lang);
306 throw new ilException(
"Unknown status: '$status'");
309 protected function date2String(DateTimeImmutable $date_time =
null) : string
311 if (is_null($date_time)) {
314 return $date_time->format(self::DATE_FORMAT);
An exception for terminatinating execution or to throw for unit testing.
static _lookupTargetRefId($a_obj_id)
Lookup target ref_id.
static _lookupTitle($a_obj_id)
Overwitten from base class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
Class ilMailEnvironmentHelper.
Class ilMailLanguageHelper.
Class ilMailTemplateContext.
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
getProgressesOf(int $a_user_id)
Get the progresses the user has on this node.
static _lookupLogin($a_user_id)
lookup login
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupDescription($a_id)
lookup object description
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
date2String(DateTimeImmutable $date_time=null)
statusToRepr(int $status, string $lang)
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
ilMailTemplateContext constructor.
getSpecificPlaceholders()
Return an array of placeholders.
getNewestProgressForUser(ilObjStudyProgramme $obj, int $user_id)
Class ilStudyProgrammeProgress.
const STATUS_NOT_RELEVANT
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples