ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilExcMailTemplateGradeReminderContext.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
30 {
31  public const ID = 'exc_context_grade_rmd';
32 
33  protected ilLanguage $lng;
35 
36  public function __construct(
39  ?ilMailUserHelper $usernameHelper = null,
41  ) {
42  global $DIC;
43 
46  $envHelper,
47  $usernameHelper,
49  );
50 
51  $this->lng = $DIC->language();
52  if (isset($DIC["ilObjDataCache"])) {
53  $this->obj_data_cache = $DIC["ilObjDataCache"];
54  }
56  }
57 
58  public function getId(): string
59  {
60  return self::ID;
61  }
62 
63  public function getTitle(): string
64  {
65  $lng = $this->lng;
66 
67  $lng->loadLanguageModule('exc');
68 
69  return $lng->txt('exc_mail_context_grade_reminder_title');
70  }
71 
72  public function getDescription(): string
73  {
74  $lng = $this->lng;
75 
76  $lng->loadLanguageModule('exc');
77 
78  return $lng->txt('exc_mail_context_grade_reminder_info');
79  }
80 
81  public function getSpecificPlaceholders(): array
82  {
83  $lng = $this->lng;
84  $lng->loadLanguageModule('exc');
85 
86  $placeholders = array();
87 
88  $placeholders['assignment_title'] = array(
89  'placeholder' => 'ASSIGNMENT_TITLE',
90  'label' => $lng->txt('exc_mail_context_reminder_assignment_title')
91  );
92  $placeholders['exercise_title'] = array(
93  'placeholder' => 'EXERCISE_TITLE',
94  'label' => $lng->txt('exc_mail_context_reminder_exercise_title')
95  );
96 
97  $placeholders['assignment_link'] = array(
98  'placeholder' => 'ASSIGNMENT_LINK',
99  'label' => $lng->txt('perma_link')
100  );
101 
102  return $placeholders;
103  }
104 
105  public function resolveSpecificPlaceholder(
106  string $placeholder_id,
107  array $context_parameters,
108  ?ilObjUser $recipient = null
109  ): string {
110  $ilObjDataCache = $this->obj_data_cache;
111 
112  if ($placeholder_id == 'assignment_title') {
113  return ilExAssignment::lookupTitle($context_parameters["ass_id"]);
114  } else {
115  if ($placeholder_id == 'exercise_title') {
116  return $ilObjDataCache->lookupTitle((int) $context_parameters["exc_id"]);
117  } else {
118  if ($placeholder_id == 'assignment_link') {
119  return ilLink::_getLink(
120  $context_parameters["exc_ref"],
121  "exc",
122  array(),
123  "_" . $context_parameters["ass_id"]
124  );
125  }
126  }
127  }
128 
129  return '';
130  }
131 }
OrgUnitUserService $orgUnitUserService
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static lookupTitle(int $a_id)
Handles exercise Grade reminder mail placeholders If all contexts are using the same placeholders...
__construct(?OrgUnitUserService $orgUnitUserService=null, ?ilMailEnvironmentHelper $envHelper=null, ?ilMailUserHelper $usernameHelper=null, ?ilMailLanguageHelper $languageHelper=null)
loadLanguageModule(string $a_module)
Load language module.
Class ilMailEnvironmentHelper.
Class ilMailUserHelper.
ilMailLanguageHelper $languageHelper
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilMailLanguageHelper.
global $DIC
Definition: shib_login.php:22
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ?ilObjUser $recipient=null)
__construct(Container $dic, ilPlugin $plugin)
ilMailEnvironmentHelper $envHelper