ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 ilMailTemplateContext constructor. More...
 
 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)
 ilMailTemplateContext constructor. More...
 
 getLanguage ()
 
 getId ()
 Returns a unique (in the context of mail template contexts) id. More...
 
 getTitle ()
 Returns a translated title (depending on the current language) which is displayed in the user interface. More...
 
 getDescription ()
 Returns a translated description (depending on the current language) which is displayed in the user interface. More...
 
 getPlaceholders ()
 Return an array of placeholders. More...
 
 getSpecificPlaceholders ()
 Return an array of placeholders. More...
 
 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'
 
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 H:i:s'
 

Protected Member Functions

 getNewestProgressForUser (ilObjStudyProgramme $obj, int $user_id)
 
 statusToRepr (int $status, string $lang)
 
 date2String (DateTimeImmutable $date_time=null)
 
- Protected Member Functions inherited from ilMailTemplateContext
 initLanguage (ilObjUser $user)
 
 initLanguageByIso2Code (string $isoCode)
 

Protected Attributes

 $lng
 
- Protected Attributes inherited from ilMailTemplateContext
 $language
 
 $envHelper
 
 $languageHelper
 
 $userHelper
 
 $orgUnitUserService
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

ilMailTemplateContext constructor.

Parameters
OrgUnitUserService | null$orgUnitUserService
ilMailEnvironmentHelper | null$envHelper
ilMailUserHelper | null$usernameHelper
ilMailLanguageHelper | null$languageHelper

Reimplemented from ilMailTemplateContext.

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

37 {
41 $usernameHelper,
43 );
44
45 global $DIC;
46
47 $this->lng = $DIC['lng'];
48 $this->lng->loadLanguageModule('prg');
49 }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ date2String()

ilStudyProgrammeMailTemplateContext::date2String ( DateTimeImmutable  $date_time = null)
protected

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

309 : string
310 {
311 if (is_null($date_time)) {
312 return '';
313 }
314 return $date_time->format(self::DATE_FORMAT);
315 }

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )
Returns
string

Reimplemented from ilMailTemplateContext.

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

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

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )
Returns
string

Reimplemented from ilMailTemplateContext.

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

References ID.

◆ getNewestProgressForUser()

ilStudyProgrammeMailTemplateContext::getNewestProgressForUser ( ilObjStudyProgramme  $obj,
int  $user_id 
)
protected

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

264 {
265 $progress = $obj->getProgressesOf($user_id);
266
267 $successfully_progress = array_filter($progress, function (ilStudyProgrammeProgress $a) {
268 return $a->isSuccessful() || $a->isSuccessfulExpired() || $a->isAccredited();
269 });
270
271 if (count($successfully_progress) == 0) {
272 return $progress[0];
273 }
274
275 usort($successfully_progress, function (ilStudyProgrammeProgress $a, ilStudyProgrammeProgress $b) {
276 if ($a->getCompletionDate() > $b->getCompletionDate()) {
277 return -1;
278 } elseif ($a->getCompletionDate() < $b->getCompletionDate()) {
279 return 1;
280 } else {
281 return 0;
282 }
283 });
284
285 return array_shift($successfully_progress);
286 }
getProgressesOf(int $a_user_id)
Get the progresses the user has on this node.
Class ilStudyProgrammeProgress.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, and ilObjStudyProgramme\getProgressesOf().

+ Here is the call graph for this function:

◆ getSpecificPlaceholders()

ilStudyProgrammeMailTemplateContext::getSpecificPlaceholders ( )

Return an array of placeholders.

Returns
array

Reimplemented from ilMailTemplateContext.

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

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

References COMPLETED_BY, COMPLETION_DATE, DEADLINE, DESCRIPTION, EXPIRE_DATE, LINK, ORG_UNIT, POINTS_CURRENT, POINTS_REQUIRED, STATUS, TITLE, TYPE, and VALIDITY.

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )
Returns
string

Reimplemented from ilMailTemplateContext.

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

62 : string
63 {
64 return $this->lng->txt('prg_mail_context_title');
65 }

◆ statusToRepr()

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

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

288 : string
289 {
291 return $this->lng->txtlng('prg', 'prg_status_in_progress', $lang);
292 }
294 return $this->lng->txtlng('prg', 'prg_status_completed', $lang);
295 }
297 return $this->lng->txtlng('prg', 'prg_status_accredited', $lang);
298 }
300 return $this->lng->txtlng('prg', 'prg_status_not_relevant', $lang);
301 }
303 return $this->lng->txtlng('prg', 'prg_status_failed', $lang);
304 }
305
306 throw new ilException("Unknown status: '$status'");
307 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lang
Definition: xapiexit.php:8

References $lang, ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_COMPLETED, ilStudyProgrammeProgress\STATUS_FAILED, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

Field Documentation

◆ $lng

ilStudyProgrammeMailTemplateContext::$lng
protected

◆ COMPLETED_BY

const ilStudyProgrammeMailTemplateContext::COMPLETED_BY = "prg_completion_by"

◆ COMPLETION_DATE

const ilStudyProgrammeMailTemplateContext::COMPLETION_DATE = "prg_completion_date"

◆ DATE_FORMAT

const ilStudyProgrammeMailTemplateContext::DATE_FORMAT = 'd-m-Y H:i:s'

◆ DEADLINE

const ilStudyProgrammeMailTemplateContext::DEADLINE = "prg_deadline"

◆ DESCRIPTION

const ilStudyProgrammeMailTemplateContext::DESCRIPTION = "prg_description"

◆ EXPIRE_DATE

const ilStudyProgrammeMailTemplateContext::EXPIRE_DATE = "prg_expiry_date"

◆ ID

const ilStudyProgrammeMailTemplateContext::ID = 'prg_context_manual'

◆ LINK

const ilStudyProgrammeMailTemplateContext::LINK = "prg_link"

◆ ORG_UNIT

const ilStudyProgrammeMailTemplateContext::ORG_UNIT = "prg_orgus"

◆ POINTS_CURRENT

const ilStudyProgrammeMailTemplateContext::POINTS_CURRENT = "prg_points_current"

◆ POINTS_REQUIRED

const ilStudyProgrammeMailTemplateContext::POINTS_REQUIRED = "prg_points_required"

◆ STATUS

const ilStudyProgrammeMailTemplateContext::STATUS = "prg_status"

◆ TITLE

const ilStudyProgrammeMailTemplateContext::TITLE = "prg_title"

◆ TYPE

const ilStudyProgrammeMailTemplateContext::TYPE = "prg_type"

◆ VALIDITY

const ilStudyProgrammeMailTemplateContext::VALIDITY = "prg_validity"

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