3declare(strict_types=1);
9 const ID =
'prg_context_manual';
45 $this->lng =
$DIC[
'lng'];
46 $this->lng->loadLanguageModule(
'prg');
52 public function getId() : string
62 return $this->lng->txt(
'prg_mail_context_title');
70 return $this->lng->txt(
'prg_mail_context_info');
79 $placeholders = array();
82 'placeholder' =>
'STUDY_PROGRAMME_TITLE',
83 'label' => $this->lng->txt(self::TITLE)
87 'placeholder' =>
'STUDY_PROGRAMME_DESCRIPTION',
88 'label' => $this->lng->txt(self::DESCRIPTION)
92 'placeholder' =>
'STUDY_PROGRAMME_TYPE',
93 'label' => $this->lng->txt(self::TYPE)
97 'placeholder' =>
'STUDY_PROGRAMME_LINK',
98 'label' => $this->lng->txt(self::LINK)
102 'placeholder' =>
'STUDY_PROGRAMME_ORG_UNITS',
103 'label' => $this->lng->txt(self::ORG_UNIT)
107 'placeholder' =>
'STUDY_PROGRAMME_STATUS',
108 'label' => $this->lng->txt(self::STATUS)
112 'placeholder' =>
'STUDY_PROGRAMME_COMPLETION_DATE',
113 'label' => $this->lng->txt(self::COMPLETION_DATE)
117 'placeholder' =>
'STUDY_PROGRAMME_COMPLETED_BY',
118 'label' => $this->lng->txt(self::COMPLETED_BY)
122 'placeholder' =>
'STUDY_PROGRAMME_POINTS_REQUIRED',
123 'label' => $this->lng->txt(self::POINTS_REQUIRED)
127 'placeholder' =>
'STUDY_PROGRAMME_POINTS_CURRENT',
128 'label' => $this->lng->txt(self::POINTS_CURRENT)
132 'placeholder' =>
'STUDY_PROGRAMME_DEADLINE',
133 'label' => $this->lng->txt(self::DEADLINE)
137 'placeholder' =>
'STUDY_PROGRAMME_EXPIRE_DATE',
138 'label' => $this->lng->txt(self::EXPIRE_DATE)
142 'placeholder' =>
'STUDY_PROGRAMME_VALIDITY',
143 'label' => $this->lng->txt(self::VALIDITY)
146 return $placeholders;
153 string $placeholder_id,
154 array $context_parameters,
156 bool $html_markup =
false
158 if (is_null($recipient)) {
162 if (!in_array($placeholder_id, [
169 self::COMPLETION_DATE,
171 self::POINTS_REQUIRED,
172 self::POINTS_CURRENT,
187 switch ($placeholder_id) {
196 if (!is_null($obj->getSubType())) {
197 $string = (string) $obj->getSubType()->getTitle();
210 $string = $this->
date2String($progress->getCompletionDate());
214 $id = $progress->getCompletionBy();
217 if ($obj->getType() ==
'usr') {
232 $string = (string) $progress->getAmountOfPoints();
235 $string = (string) $progress->getCurrentAmountOfPoints();
238 $string = $this->
date2String($progress->getDeadline());
241 $string = $this->lng->txt(
'prg_quali_not_valid');
242 $now = (
new DateTime())->format(
'Y-m-d H:i:s');
243 $val_of_qual = $progress->getValidityOfQualification();
245 if (!is_null($val_of_qual)) {
246 $vq_date = $val_of_qual->format(
'Y-m-d H:i:s');
247 if ($vq_date > $now) {
248 $string = $this->lng->txt(
'prg_quali_still_valid');
253 $string = $this->
date2String($progress->getValidityOfQualification());
267 return $a->isSuccessful() ||
$a->isSuccessfulExpired() ||
$a->isAccredited();
270 if (count($successfully_progress) == 0) {
275 if (
$a->getCompletionDate() >
$b->getCompletionDate()) {
277 } elseif (
$a->getCompletionDate() <
$b->getCompletionDate()) {
284 return array_shift($successfully_progress);
290 return $this->lng->txt(
"prg_status_in_progress");
293 return $this->lng->txt(
"prg_status_completed");
296 return $this->lng->txt(
"prg_status_accredited");
299 return $this->lng->txt(
"prg_status_not_relevant");
302 return $this->lng->txt(
"prg_status_failed");
304 throw new ilException(
"Unknown status: '$status'");
307 protected function date2String(DateTime $date_time =
null) : string
309 if (is_null($date_time)) {
313 return $date_time->format(
'd-m-Y H:i:s');
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.
Base class for ILIAS Exception handling.
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
statusToRepr(int $status)
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
ilMailTemplateContext constructor.
getSpecificPlaceholders()
Return an array of placeholders.
date2String(DateTime $date_time=null)
getNewestProgressForUser(ilObjStudyProgramme $obj, int $user_id)
const STATUS_NOT_RELEVANT
Represents the progress of a user at one node of a study programme.
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