ILIAS  release_8 Revision v8.24
ilStudyProgrammeMailTemplateContext Class Reference
+ Inheritance diagram for ilStudyProgrammeMailTemplateContext:
+ Collaboration diagram for ilStudyProgrammeMailTemplateContext:

Public Member Functions

 __construct (OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getSpecificPlaceholders ()
 Return an array of placeholders. More...
 
- Public Member Functions inherited from ilMailTemplateContext
 __construct (OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
 
 getLanguage ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getPlaceholders ()
 
 getSpecificPlaceholders ()
 
 resolveSpecificPlaceholder (string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
 
 resolvePlaceholder (string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
 

Data Fields

const ID = 'prg_context_manual'
 

Protected Member Functions

 getLatestAssignment (array $assignments)
 
 getLatestSuccessfulAssignment (array $assignments)
 
 statusToRepr (int $status, string $lang)
 
 date2String (DateTimeImmutable $date_time=null, ilObjUser $user=null)
 
- Protected Member Functions inherited from ilMailTemplateContext
 initLanguage (ilObjUser $user)
 
 initLanguageByIso2Code (string $isoCode)
 

Protected Attributes

ilLanguage $lng
 
- Protected Attributes inherited from ilMailTemplateContext
ilLanguage $language
 
ilMailEnvironmentHelper $envHelper
 
ilMailLanguageHelper $languageHelper
 
ilMailUserHelper $userHelper
 
OrgUnitUserService $orgUnitUserService
 

Private Attributes

const TITLE = "prg_title"
 
const DESCRIPTION = "prg_description"
 
const TYPE = "prg_type"
 
const LINK = "prg_link"
 
const ORG_UNIT = "prg_orgus"
 
const STATUS = "prg_status"
 
const COMPLETION_DATE = "prg_completion_date"
 
const COMPLETED_BY = "prg_completion_by"
 
const POINTS_REQUIRED = "prg_points_required"
 
const POINTS_CURRENT = "prg_points_current"
 
const DEADLINE = "prg_deadline"
 
const EXPIRE_DATE = "prg_expiry_date"
 
const VALIDITY = "prg_validity"
 
const DATE_FORMAT = 'd.m.Y'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeMailTemplateContext::__construct ( OrgUnitUserService  $orgUnitUserService = null,
ilMailEnvironmentHelper  $envHelper = null,
ilMailUserHelper  $usernameHelper = null,
ilMailLanguageHelper  $languageHelper = null 
)

Reimplemented from ilMailTemplateContext.

Definition at line 45 of file class.ilStudyProgrammeMailTemplateContext.php.

50 {
54 $usernameHelper,
56 );
57
58 global $DIC;
59
60 $this->lng = $DIC['lng'];
61 $this->lng->loadLanguageModule('prg');
62 }
ilMailLanguageHelper $languageHelper
OrgUnitUserService $orgUnitUserService
ilMailEnvironmentHelper $envHelper
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ilMailTemplateContext\$envHelper, ilMailTemplateContext\$languageHelper, ilMailTemplateContext\$orgUnitUserService, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ date2String()

ilStudyProgrammeMailTemplateContext::date2String ( DateTimeImmutable  $date_time = null,
ilObjUser  $user = null 
)
protected

Definition at line 329 of file class.ilStudyProgrammeMailTemplateContext.php.

332 : string {
333 if (is_null($date_time)) {
334 return '';
335 }
336 if (is_null($user)) {
337 return $date_time->format(self::DATE_FORMAT);
338 }
339 return $user->getDateFormat()->applyTo($date_time);
340 }

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )

Reimplemented from ilMailTemplateContext.

Definition at line 74 of file class.ilStudyProgrammeMailTemplateContext.php.

74 : string
75 {
76 return $this->lng->txt('prg_mail_context_info');
77 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )

Reimplemented from ilMailTemplateContext.

Definition at line 64 of file class.ilStudyProgrammeMailTemplateContext.php.

References ID.

◆ getLatestAssignment()

ilStudyProgrammeMailTemplateContext::getLatestAssignment ( array  $assignments)
protected

Definition at line 266 of file class.ilStudyProgrammeMailTemplateContext.php.

267 {
268 usort($assignments, static function (ilPRGAssignment $a, ilPRGAssignment $b): int {
269 $a_dat =$a->getProgressTree()->getAssignmentDate();
270 $b_dat =$b->getProgressTree()->getAssignmentDate();
271 if ($a_dat > $b_dat) {
272 return -1;
273 } elseif ($a_dat < $b_dat) {
274 return 1;
275 } else {
276 return 0;
277 }
278 });
279 return array_shift($assignments);
280 }
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, and Vendor\Package\$b.

◆ getLatestSuccessfulAssignment()

ilStudyProgrammeMailTemplateContext::getLatestSuccessfulAssignment ( array  $assignments)
protected

Definition at line 282 of file class.ilStudyProgrammeMailTemplateContext.php.

283 {
284 $successful = array_filter(
285 $assignments,
286 fn ($ass) => $ass->getProgressTree()->isSuccessful()
287 );
288 if (count($successful) === 0) {
289 return null;
290 }
291
292 usort($successful, static function (ilPRGAssignment $a, ilPRGAssignment $b): int {
293 $a_dat =$a->getProgressTree()->getCompletionDate();
294 $b_dat =$b->getProgressTree()->getCompletionDate();
295 if ($a_dat > $b_dat) {
296 return -1;
297 } elseif ($a_dat < $b_dat) {
298 return 1;
299 } else {
300 return 0;
301 }
302 });
303 return array_shift($successful);
304 }

References Vendor\Package\$a, and Vendor\Package\$b.

◆ getSpecificPlaceholders()

ilStudyProgrammeMailTemplateContext::getSpecificPlaceholders ( )

Return an array of placeholders.

Reimplemented from ilMailTemplateContext.

Definition at line 82 of file class.ilStudyProgrammeMailTemplateContext.php.

82 : array
83 {
84 $placeholders = [];
85
86 $placeholders[self::TITLE] = [
87 'placeholder' => 'STUDY_PROGRAMME_TITLE',
88 'label' => $this->lng->txt(self::TITLE)
89 ];
90
91 $placeholders[self::DESCRIPTION] = [
92 'placeholder' => 'STUDY_PROGRAMME_DESCRIPTION',
93 'label' => $this->lng->txt(self::DESCRIPTION)
94 ];
95
96 $placeholders[self::TYPE] = [
97 'placeholder' => 'STUDY_PROGRAMME_TYPE',
98 'label' => $this->lng->txt(self::TYPE)
99 ];
100
101 $placeholders[self::LINK] = [
102 'placeholder' => 'STUDY_PROGRAMME_LINK',
103 'label' => $this->lng->txt(self::LINK)
104 ];
105
106 $placeholders[self::ORG_UNIT] = [
107 'placeholder' => 'STUDY_PROGRAMME_ORG_UNITS',
108 'label' => $this->lng->txt(self::ORG_UNIT)
109 ];
110
111 $placeholders[self::STATUS] = [
112 'placeholder' => 'STUDY_PROGRAMME_STATUS',
113 'label' => $this->lng->txt(self::STATUS)
114 ];
115
116 $placeholders[self::COMPLETION_DATE] = [
117 'placeholder' => 'STUDY_PROGRAMME_COMPLETION_DATE',
118 'label' => $this->lng->txt(self::COMPLETION_DATE)
119 ];
120
121 $placeholders[self::COMPLETED_BY] = [
122 'placeholder' => 'STUDY_PROGRAMME_COMPLETED_BY',
123 'label' => $this->lng->txt(self::COMPLETED_BY)
124 ];
125
126 $placeholders[self::POINTS_REQUIRED] = [
127 'placeholder' => 'STUDY_PROGRAMME_POINTS_REQUIRED',
128 'label' => $this->lng->txt(self::POINTS_REQUIRED)
129 ];
130
131 $placeholders[self::POINTS_CURRENT] = [
132 'placeholder' => 'STUDY_PROGRAMME_POINTS_CURRENT',
133 'label' => $this->lng->txt(self::POINTS_CURRENT)
134 ];
135
136 $placeholders[self::DEADLINE] = [
137 'placeholder' => 'STUDY_PROGRAMME_DEADLINE',
138 'label' => $this->lng->txt(self::DEADLINE)
139 ];
140
141 $placeholders[self::EXPIRE_DATE] = [
142 'placeholder' => 'STUDY_PROGRAMME_EXPIRE_DATE',
143 'label' => $this->lng->txt(self::EXPIRE_DATE)
144 ];
145
146 $placeholders[self::VALIDITY] = [
147 'placeholder' => 'STUDY_PROGRAMME_VALIDITY',
148 'label' => $this->lng->txt(self::VALIDITY)
149 ];
150
151 return $placeholders;
152 }

References COMPLETED_BY, COMPLETION_DATE, DEADLINE, DESCRIPTION, EXPIRE_DATE, LINK, ILIAS\Repository\lng(), ORG_UNIT, POINTS_CURRENT, POINTS_REQUIRED, STATUS, TITLE, TYPE, and VALIDITY.

+ Here is the call graph for this function:

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )

Reimplemented from ilMailTemplateContext.

Definition at line 69 of file class.ilStudyProgrammeMailTemplateContext.php.

69 : string
70 {
71 return $this->lng->txt('prg_mail_context_title');
72 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ statusToRepr()

ilStudyProgrammeMailTemplateContext::statusToRepr ( int  $status,
string  $lang 
)
protected

Definition at line 308 of file class.ilStudyProgrammeMailTemplateContext.php.

308 : string
309 {
310 if ($status === ilPRGProgress::STATUS_IN_PROGRESS) {
311 return $this->lng->txtlng('prg', 'prg_status_in_progress', $lang);
312 }
313 if ($status === ilPRGProgress::STATUS_COMPLETED) {
314 return $this->lng->txtlng('prg', 'prg_status_completed', $lang);
315 }
316 if ($status === ilPRGProgress::STATUS_ACCREDITED) {
317 return $this->lng->txtlng('prg', 'prg_status_accredited', $lang);
318 }
319 if ($status === ilPRGProgress::STATUS_NOT_RELEVANT) {
320 return $this->lng->txtlng('prg', 'prg_status_not_relevant', $lang);
321 }
322 if ($status === ilPRGProgress::STATUS_FAILED) {
323 return $this->lng->txtlng('prg', 'prg_status_failed', $lang);
324 }
325
326 throw new ilException("Unknown status: '$status'");
327 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lang
Definition: xapiexit.php:26

References ILIAS\Repository\lng(), ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilStudyProgrammeMailTemplateContext::$lng
protected

◆ COMPLETED_BY

const ilStudyProgrammeMailTemplateContext::COMPLETED_BY = "prg_completion_by"
private

◆ COMPLETION_DATE

const ilStudyProgrammeMailTemplateContext::COMPLETION_DATE = "prg_completion_date"
private

◆ DATE_FORMAT

const ilStudyProgrammeMailTemplateContext::DATE_FORMAT = 'd.m.Y'
private

◆ DEADLINE

const ilStudyProgrammeMailTemplateContext::DEADLINE = "prg_deadline"
private

◆ DESCRIPTION

const ilStudyProgrammeMailTemplateContext::DESCRIPTION = "prg_description"
private

◆ EXPIRE_DATE

const ilStudyProgrammeMailTemplateContext::EXPIRE_DATE = "prg_expiry_date"
private

◆ ID

const ilStudyProgrammeMailTemplateContext::ID = 'prg_context_manual'

◆ LINK

const ilStudyProgrammeMailTemplateContext::LINK = "prg_link"
private

◆ ORG_UNIT

const ilStudyProgrammeMailTemplateContext::ORG_UNIT = "prg_orgus"
private

◆ POINTS_CURRENT

const ilStudyProgrammeMailTemplateContext::POINTS_CURRENT = "prg_points_current"
private

◆ POINTS_REQUIRED

const ilStudyProgrammeMailTemplateContext::POINTS_REQUIRED = "prg_points_required"
private

◆ STATUS

const ilStudyProgrammeMailTemplateContext::STATUS = "prg_status"
private

◆ TITLE

const ilStudyProgrammeMailTemplateContext::TITLE = "prg_title"
private

◆ TYPE

const ilStudyProgrammeMailTemplateContext::TYPE = "prg_type"
private

◆ VALIDITY

const ilStudyProgrammeMailTemplateContext::VALIDITY = "prg_validity"
private

The documentation for this class was generated from the following file: