ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 $org_unit_user_service=null, ?ilMailEnvironmentHelper $environment_helper=null, ?ilMailUserHelper $user_helper=null, ?ilMailLanguageHelper $language_helper=null)
 
 getLanguage ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getNestedPlaceholders ()
 
 getPlaceholders ()
 
 getSpecificPlaceholders ()
 
 resolveSpecificPlaceholder (string $placeholder_id, array $context_parameters, ?ilObjUser $recipient=null)
 
 resolvePlaceholder (string $placeholder_id, array $context_parameters, ?ilObjUser $recipient=null)
 

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 $iso_code)
 

Protected Attributes

ilLanguage $lng
 
- Protected Attributes inherited from ilMailTemplateContext
ilLanguage $language
 
ilMailEnvironmentHelper $env_helper
 
ilMailLanguageHelper $language_helper
 
ilMailUserHelper $user_helper
 
OrgUnitUserService $org_unit_user_service
 

Private Attributes

const TITLE = 'STUDY_PROGRAMME_TITLE'
 
const DESCRIPTION = 'STUDY_PROGRAMME_DESCRIPTION'
 
const TYPE = 'STUDY_PROGRAMME_TYPE'
 
const LINK = 'STUDY_PROGRAMME_LINK'
 
const ORG_UNIT = 'STUDY_PROGRAMME_ORG_UNITS'
 
const STATUS = 'STUDY_PROGRAMME_STATUS'
 
const COMPLETION_DATE = 'STUDY_PROGRAMME_COMPLETION_DATE'
 
const COMPLETED_BY = 'STUDY_PROGRAMME_COMPLETED_BY'
 
const POINTS_REQUIRED = 'STUDY_PROGRAMME_POINTS_REQUIRED'
 
const POINTS_CURRENT = 'STUDY_PROGRAMME_POINTS_CURRENT'
 
const DEADLINE = 'STUDY_PROGRAMME_DEADLINE'
 
const EXPIRE_DATE = 'STUDY_PROGRAMME_EXPIRE_DATE'
 
const VALIDITY = 'STUDY_PROGRAMME_VALIDITY'
 
const PLACEHOLDER_TRANSLATIONS
 
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 62 of file class.ilStudyProgrammeMailTemplateContext.php.

67 {
69 $orgUnitUserService,
70 $envHelper,
71 $usernameHelper,
72 $languageHelper
73 );
74
75 global $DIC;
76
77 $this->lng = $DIC['lng'];
78 $this->lng->loadLanguageModule('prg');
79 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, 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 273 of file class.ilStudyProgrammeMailTemplateContext.php.

276 : string {
277 if (is_null($date_time)) {
278 return '';
279 }
280 if (is_null($user)) {
281 return $date_time->format(self::DATE_FORMAT);
282 }
283 return $user->getDateFormat()->applyTo($date_time);
284 }

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )

Reimplemented from ilMailTemplateContext.

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

91 : string
92 {
93 return $this->lng->txt('prg_mail_context_info');
94 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )

Reimplemented from ilMailTemplateContext.

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

References ID.

◆ getLatestAssignment()

ilStudyProgrammeMailTemplateContext::getLatestAssignment ( array  $assignments)
protected

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

211 {
212 usort($assignments, static function (ilPRGAssignment $a, ilPRGAssignment $b): int {
213 $a_dat = $a->getProgressTree()->getAssignmentDate();
214 $b_dat = $b->getProgressTree()->getAssignmentDate();
215 if ($a_dat > $b_dat) {
216 return -1;
217 } elseif ($a_dat < $b_dat) {
218 return 1;
219 } else {
220 return 0;
221 }
222 });
223 return array_shift($assignments);
224 }
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 226 of file class.ilStudyProgrammeMailTemplateContext.php.

227 {
228 $successful = array_filter(
229 $assignments,
230 fn($ass) => $ass->getProgressTree()->isSuccessful()
231 );
232 if (count($successful) === 0) {
233 return null;
234 }
235
236 usort($successful, static function (ilPRGAssignment $a, ilPRGAssignment $b): int {
237 $a_dat = $a->getProgressTree()->getCompletionDate();
238 $b_dat = $b->getProgressTree()->getCompletionDate();
239 if ($a_dat > $b_dat) {
240 return -1;
241 } elseif ($a_dat < $b_dat) {
242 return 1;
243 } else {
244 return 0;
245 }
246 });
247 return array_shift($successful);
248 }

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

◆ getSpecificPlaceholders()

ilStudyProgrammeMailTemplateContext::getSpecificPlaceholders ( )

Return an array of placeholders.

Reimplemented from ilMailTemplateContext.

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

99 : array
100 {
101 $placeholders = [];
102 foreach (self::PLACEHOLDER_TRANSLATIONS as $id => $label) {
103 $placeholders[$id] = [
104 'placeholder' => $id,
105 'label' => $this->lng->txt($label)
106 ];
107 }
108 return $placeholders;
109 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )

Reimplemented from ilMailTemplateContext.

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

86 : string
87 {
88 return $this->lng->txt('prg_mail_context_title');
89 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ statusToRepr()

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

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

252 : string
253 {
254 if ($status === ilPRGProgress::STATUS_IN_PROGRESS) {
255 return $this->lng->txtlng('prg', 'prg_status_in_progress', $lang);
256 }
257 if ($status === ilPRGProgress::STATUS_COMPLETED) {
258 return $this->lng->txtlng('prg', 'prg_status_completed', $lang);
259 }
260 if ($status === ilPRGProgress::STATUS_ACCREDITED) {
261 return $this->lng->txtlng('prg', 'prg_status_accredited', $lang);
262 }
263 if ($status === ilPRGProgress::STATUS_NOT_RELEVANT) {
264 return $this->lng->txtlng('prg', 'prg_status_not_relevant', $lang);
265 }
266 if ($status === ilPRGProgress::STATUS_FAILED) {
267 return $this->lng->txtlng('prg', 'prg_status_failed', $lang);
268 }
269
270 throw new ilException("Unknown status: '$status'");
271 }
Base class for ILIAS Exception handling.
$lang
Definition: xapiexit.php:25

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 = 'STUDY_PROGRAMME_COMPLETED_BY'
private

◆ COMPLETION_DATE

const ilStudyProgrammeMailTemplateContext::COMPLETION_DATE = 'STUDY_PROGRAMME_COMPLETION_DATE'
private

◆ DATE_FORMAT

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

◆ DEADLINE

const ilStudyProgrammeMailTemplateContext::DEADLINE = 'STUDY_PROGRAMME_DEADLINE'
private

◆ DESCRIPTION

const ilStudyProgrammeMailTemplateContext::DESCRIPTION = 'STUDY_PROGRAMME_DESCRIPTION'
private

◆ EXPIRE_DATE

const ilStudyProgrammeMailTemplateContext::EXPIRE_DATE = 'STUDY_PROGRAMME_EXPIRE_DATE'
private

◆ ID

const ilStudyProgrammeMailTemplateContext::ID = 'prg_context_manual'

◆ LINK

const ilStudyProgrammeMailTemplateContext::LINK = 'STUDY_PROGRAMME_LINK'
private

◆ ORG_UNIT

const ilStudyProgrammeMailTemplateContext::ORG_UNIT = 'STUDY_PROGRAMME_ORG_UNITS'
private

◆ PLACEHOLDER_TRANSLATIONS

const ilStudyProgrammeMailTemplateContext::PLACEHOLDER_TRANSLATIONS
private
Initial value:
= [
self::TITLE => 'prg_title',
self::DESCRIPTION => 'prg_description',
self::TYPE => 'prg_type',
self::LINK => 'prg_link',
self::ORG_UNIT => 'prg_orgus',
self::STATUS => 'prg_status',
self::COMPLETION_DATE => 'prg_completion_date',
self::COMPLETED_BY => 'prg_completion_by',
self::POINTS_REQUIRED => 'prg_points_required',
self::POINTS_CURRENT => 'prg_points_current',
self::DEADLINE => 'prg_deadline',
self::EXPIRE_DATE => 'prg_expiry_date',
self::VALIDITY => 'prg_validity',
]

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

◆ POINTS_CURRENT

const ilStudyProgrammeMailTemplateContext::POINTS_CURRENT = 'STUDY_PROGRAMME_POINTS_CURRENT'
private

◆ POINTS_REQUIRED

const ilStudyProgrammeMailTemplateContext::POINTS_REQUIRED = 'STUDY_PROGRAMME_POINTS_REQUIRED'
private

◆ STATUS

const ilStudyProgrammeMailTemplateContext::STATUS = 'STUDY_PROGRAMME_STATUS'
private

◆ TITLE

const ilStudyProgrammeMailTemplateContext::TITLE = 'STUDY_PROGRAMME_TITLE'
private

◆ TYPE

const ilStudyProgrammeMailTemplateContext::TYPE = 'STUDY_PROGRAMME_TYPE'
private

◆ VALIDITY

const ilStudyProgrammeMailTemplateContext::VALIDITY = 'STUDY_PROGRAMME_VALIDITY'
private

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