ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 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 $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_expire_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 
)

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

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

50  {
53  $envHelper,
54  $usernameHelper,
56  );
57 
58  global $DIC;
59 
60  $this->lng = $DIC['lng'];
61  $this->lng->loadLanguageModule('prg');
62  }
OrgUnitUserService $orgUnitUserService
ilMailLanguageHelper $languageHelper
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
ilMailEnvironmentHelper $envHelper
+ 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 328 of file class.ilStudyProgrammeMailTemplateContext.php.

Referenced by getSpecificPlaceholders().

331  : string {
332  if (is_null($date_time)) {
333  return '';
334  }
335  if (is_null($user)) {
336  return $date_time->format(self::DATE_FORMAT);
337  }
338  return $user->getDateFormat()->applyTo($date_time);
339  }
+ Here is the caller graph for this function:

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )

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

References ILIAS\Repository\lng().

74  : string
75  {
76  return $this->lng->txt('prg_mail_context_info');
77  }
+ Here is the call graph for this function:

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )

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

64  : string
65  {
66  return self::ID;
67  }

◆ getLatestAssignment()

ilStudyProgrammeMailTemplateContext::getLatestAssignment ( array  $assignments)
protected

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

References Vendor\Package\$a, Vendor\Package\$b, and ilPRGAssignment\getProgressTree().

Referenced by getSpecificPlaceholders().

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

◆ getLatestSuccessfulAssignment()

ilStudyProgrammeMailTemplateContext::getLatestSuccessfulAssignment ( array  $assignments)
protected

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

References Vendor\Package\$a, Vendor\Package\$b, ilPRGAssignment\getProgressTree(), and null.

Referenced by getSpecificPlaceholders().

281  : ?ilPRGAssignment
282  {
283  $successful = array_filter(
284  $assignments,
285  fn($ass) => $ass->getProgressTree()->isSuccessful()
286  );
287  if (count($successful) === 0) {
288  return null;
289  }
290 
291  usort($successful, static function (ilPRGAssignment $a, ilPRGAssignment $b): int {
292  $a_dat = $a->getProgressTree()->getCompletionDate();
293  $b_dat = $b->getProgressTree()->getCompletionDate();
294  if ($a_dat > $b_dat) {
295  return -1;
296  } elseif ($a_dat < $b_dat) {
297  return 1;
298  } else {
299  return 0;
300  }
301  });
302  return array_shift($successful);
303  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificPlaceholders()

ilStudyProgrammeMailTemplateContext::getSpecificPlaceholders ( )

Return an array of placeholders.

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

References $id, $ref_id, ilObject\_exists(), ilObject\_lookupDeletedDate(), ilObjUser\_lookupLogin(), ilContainerReference\_lookupTargetRefId(), ilContainerReference\_lookupTitle(), date2String(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), getLatestAssignment(), getLatestSuccessfulAssignment(), ILIAS\Repository\lng(), ilObjUser\lookupOrgUnitsRepresentation(), null, ilMailTemplateContext\resolveSpecificPlaceholder(), and statusToRepr().

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  }
+ Here is the call graph for this function:

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )

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

References ILIAS\Repository\lng().

69  : string
70  {
71  return $this->lng->txt('prg_mail_context_title');
72  }
+ Here is the call graph for this function:

◆ statusToRepr()

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

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

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

Referenced by getSpecificPlaceholders().

307  : string
308  {
309  if ($status === ilPRGProgress::STATUS_IN_PROGRESS) {
310  return $this->lng->txtlng('prg', 'prg_status_in_progress', $lang);
311  }
312  if ($status === ilPRGProgress::STATUS_COMPLETED) {
313  return $this->lng->txtlng('prg', 'prg_status_completed', $lang);
314  }
315  if ($status === ilPRGProgress::STATUS_ACCREDITED) {
316  return $this->lng->txtlng('prg', 'prg_status_accredited', $lang);
317  }
318  if ($status === ilPRGProgress::STATUS_NOT_RELEVANT) {
319  return $this->lng->txtlng('prg', 'prg_status_not_relevant', $lang);
320  }
321  if ($status === ilPRGProgress::STATUS_FAILED) {
322  return $this->lng->txtlng('prg', 'prg_status_failed', $lang);
323  }
324 
325  throw new ilException("Unknown status: '$status'");
326  }
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller 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_expire_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: