ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExcMailTemplateGradeReminderContext.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
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['ass_title'] = array(
89  'placeholder' => 'ASSIGNMENT_TITLE',
90  'label' => $lng->txt('exc_mail_context_reminder_assignment_title')
91  );
92  $placeholders['exc_title'] = array(
93  'placeholder' => 'EXERCISE_TITLE',
94  'label' => $lng->txt('exc_mail_context_reminder_exercise_title')
95  );
96 
97  $placeholders['ass_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  bool $html_markup = false
110  ): string {
111  $ilObjDataCache = $this->obj_data_cache;
112 
113  if ($placeholder_id == 'ass_title') {
114  return ilExAssignment::lookupTitle($context_parameters["ass_id"]);
115  } else {
116  if ($placeholder_id == 'exc_title') {
117  return $ilObjDataCache->lookupTitle((int) $context_parameters["exc_id"]);
118  } else {
119  if ($placeholder_id == 'ass_link') {
120  return ilLink::_getLink(
121  $context_parameters["exc_ref"],
122  "exc",
123  array(),
124  "_" . $context_parameters["ass_id"]
125  );
126  }
127  }
128  }
129 
130  return '';
131  }
132 }
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...
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
static lookupTitle(int $a_id)
Handles exercise Grade reminder mail placeholders If all contexts are using the same placeholders...
loadLanguageModule(string $a_module)
Load language module.
Class ilMailEnvironmentHelper.
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
Class ilMailUserHelper.
ilMailLanguageHelper $languageHelper
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
Class ilMailLanguageHelper.
Class ilMailTemplateContext.
__construct(Container $dic, ilPlugin $plugin)
ilMailEnvironmentHelper $envHelper
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...