ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

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  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ 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.

Referenced by getSpecificPlaceholders().

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

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )

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

References ILIAS\Repository\lng().

91  : string
92  {
93  return $this->lng->txt('prg_mail_context_info');
94  }
+ Here is the call graph for this function:

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )

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

81  : string
82  {
83  return self::ID;
84  }

◆ getLatestAssignment()

ilStudyProgrammeMailTemplateContext::getLatestAssignment ( array  $assignments)
protected

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

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

Referenced by getSpecificPlaceholders().

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  }
$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 226 of file class.ilStudyProgrammeMailTemplateContext.php.

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

Referenced by getSpecificPlaceholders().

226  : ?ilPRGAssignment
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  }
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 99 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().

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

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )

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

References ILIAS\Repository\lng().

86  : string
87  {
88  return $this->lng->txt('prg_mail_context_title');
89  }
+ 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.

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().

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  }
$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 = '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'

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: