3 declare(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();
83 $placeholders[self::TITLE] = array(
84 'placeholder' =>
'STUDY_PROGRAMME_TITLE',
85 'label' => $this->lng->txt(self::TITLE)
88 $placeholders[self::DESCRIPTION] = array(
89 'placeholder' =>
'STUDY_PROGRAMME_DESCRIPTION',
90 'label' => $this->lng->txt(self::DESCRIPTION)
93 $placeholders[self::TYPE] = array(
94 'placeholder' =>
'STUDY_PROGRAMME_TYPE',
95 'label' => $this->lng->txt(self::TYPE)
98 $placeholders[self::LINK] = array(
99 'placeholder' =>
'STUDY_PROGRAMME_LINK',
100 'label' => $this->lng->txt(self::LINK)
103 $placeholders[self::ORG_UNIT] = array(
104 'placeholder' =>
'STUDY_PROGRAMME_ORG_UNITS',
105 'label' => $this->lng->txt(self::ORG_UNIT)
108 $placeholders[self::STATUS] = array(
109 'placeholder' =>
'STUDY_PROGRAMME_STATUS',
110 'label' => $this->lng->txt(self::STATUS)
113 $placeholders[self::COMPLETION_DATE] = array(
114 'placeholder' =>
'STUDY_PROGRAMME_COMPLETION_DATE',
115 'label' => $this->lng->txt(self::COMPLETION_DATE)
118 $placeholders[self::COMPLETED_BY] = array(
119 'placeholder' =>
'STUDY_PROGRAMME_COMPLETED_BY',
120 'label' => $this->lng->txt(self::COMPLETED_BY)
123 $placeholders[self::POINTS_REQUIRED] = array(
124 'placeholder' =>
'STUDY_PROGRAMME_POINTS_REQUIRED',
125 'label' => $this->lng->txt(self::POINTS_REQUIRED)
128 $placeholders[self::POINTS_CURRENT] = array(
129 'placeholder' =>
'STUDY_PROGRAMME_POINTS_CURRENT',
130 'label' => $this->lng->txt(self::POINTS_CURRENT)
133 $placeholders[self::DEADLINE] = array(
134 'placeholder' =>
'STUDY_PROGRAMME_DEADLINE',
135 'label' => $this->lng->txt(self::DEADLINE)
138 $placeholders[self::EXPIRE_DATE] = array(
139 'placeholder' =>
'STUDY_PROGRAMME_EXPIRE_DATE',
140 'label' => $this->lng->txt(self::EXPIRE_DATE)
143 $placeholders[self::VALIDITY] = array(
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) {
193 case self::DESCRIPTION:
198 if (!is_null($obj->getSubType())) {
199 $string = (string) $obj->getSubType()->getTitle();
209 $string = $this->
statusToRepr($progress->getStatus(), $recipient->getLanguage());
211 case self::COMPLETION_DATE:
212 $string = $this->
date2String($progress->getCompletionDate());
214 case self::COMPLETED_BY:
216 $id = $progress->getCompletionBy();
219 if ($obj->getType() ==
'usr') {
233 case self::POINTS_REQUIRED:
234 $string = (string) $progress->getAmountOfPoints();
236 case self::POINTS_CURRENT:
237 $string = (string) $progress->getCurrentAmountOfPoints();
240 $string = $this->
date2String($progress->getDeadline());
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());
253 case self::EXPIRE_DATE:
254 $string = $this->
date2String($progress->getValidityOfQualification());
271 if (count($successfully_progress) == 0) {
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'");
311 if (is_null($date_time)) {
314 return $date_time->format(self::DATE_FORMAT);
static _lookupLogin($a_user_id)
lookup login
getNewestProgressForUser(ilObjStudyProgramme $obj, int $user_id)
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
getSpecificPlaceholders()
Return an array of placeholders.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
statusToRepr(int $status, string $lang)
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
static _lookupTitle($a_id)
lookup object title
Class ilMailEnvironmentHelper.
date2String(DateTimeImmutable $date_time=null)
static _lookupObjectId($a_ref_id)
lookup object id
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
static _lookupTitle($a_obj_id)
Overwitten from base class.
Class ilMailLanguageHelper.
static _lookupDescription($a_id)
lookup object description
Class ilMailTemplateContext.
const STATUS_NOT_RELEVANT
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilStudyProgrammeProgress.
getProgressesOf(int $a_user_id)
Get the progresses the user has on this node.
__construct(Container $dic, ilPlugin $plugin)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupTargetRefId($a_obj_id)
Lookup target ref_id.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")