ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExcMailTemplatePeerReminderContext.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
29 {
30  public const ID = 'exc_context_peer_rmd';
31 
32  protected ilLanguage $lng;
34 
35  public function __construct(
38  ilMailUserHelper $usernameHelper = null,
40  ) {
41  global $DIC;
42 
45  $envHelper,
46  $usernameHelper,
48  );
49 
50  $this->lng = $DIC->language();
51  if (isset($DIC["ilObjDataCache"])) {
52  $this->obj_data_cache = $DIC["ilObjDataCache"];
53  }
54  }
55 
56  public function getId(): string
57  {
58  return self::ID;
59  }
60 
61  public function getTitle(): string
62  {
63  $lng = $this->lng;
64 
65  $lng->loadLanguageModule('exc');
66 
67  return $lng->txt('exc_mail_context_peer_reminder_title');
68  }
69 
70  public function getDescription(): string
71  {
72  $lng = $this->lng;
73 
74  $lng->loadLanguageModule('exc');
75 
76  return $lng->txt('exc_mail_context_peer_reminder_info');
77  }
78 
79  public function getSpecificPlaceholders(): array
80  {
81  $lng = $this->lng;
82  $lng->loadLanguageModule('exc');
83 
84  $placeholders = array();
85 
86  $placeholders['ass_title'] = array(
87  'placeholder' => 'ASSIGNMENT_TITLE',
88  'label' => $lng->txt('exc_mail_context_reminder_assignment_title')
89  );
90  $placeholders['exc_title'] = array(
91  'placeholder' => 'EXERCISE_TITLE',
92  'label' => $lng->txt('exc_mail_context_reminder_exercise_title')
93  );
94 
95  $placeholders['ass_link'] = array(
96  'placeholder' => 'ASSIGNMENT_LINK',
97  'label' => $lng->txt('perma_link')
98  );
99 
100  return $placeholders;
101  }
102 
106  public function resolveSpecificPlaceholder(
107  string $placeholder_id,
108  array $context_parameters,
109  ilObjUser $recipient = null,
110  bool $html_markup = false
111  ): string {
112  $ilObjDataCache = $this->obj_data_cache;
113 
114  if ($placeholder_id == 'ass_title') {
115  return ilExAssignment::lookupTitle($context_parameters["ass_id"]);
116  } else {
117  if ($placeholder_id == 'exc_title') {
118  return $ilObjDataCache->lookupTitle((int) $context_parameters["exc_id"]);
119  } else {
120  if ($placeholder_id == 'ass_link') {
121  return ilLink::_getLink(
122  $context_parameters["exc_ref"],
123  "exc",
124  array(),
125  "_" . $context_parameters["ass_id"]
126  );
127  }
128  }
129  }
130 
131  return '';
132  }
133 }
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)
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
{}
loadLanguageModule(string $a_module)
Load language module.
Class ilMailEnvironmentHelper.
Handles exercise Peer reminder mail placeholders If all contexts are using the same placeholders...
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)
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
ilMailEnvironmentHelper $envHelper
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...