ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilSurveyMailTemplateReminderContext.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 {
30  protected ilLanguage $lng;
32 
33  public function __construct(
36  ilMailUserHelper $usernameHelper = null,
38  ) {
39  global $DIC;
40 
43  $envHelper,
44  $usernameHelper,
46  );
47 
48  $this->lng = $DIC->language();
49  if (isset($DIC["ilObjDataCache"])) {
50  $this->obj_data_cache = $DIC["ilObjDataCache"];
51  }
52  }
53 
54  public const ID = 'svy_context_rmd';
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('survey');
66 
67  return $lng->txt('svy_mail_context_reminder_title');
68  }
69 
70  public function getDescription(): string
71  {
72  $lng = $this->lng;
73 
74  $lng->loadLanguageModule('survey');
75 
76  return $lng->txt('svy_mail_context_reminder_info');
77  }
78 
79  public function getSpecificPlaceholders(): array
80  {
84  $lng = $this->lng;
85 
86  $lng->loadLanguageModule('survey');
87 
88  $placeholders = array();
89 
90  $placeholders['survey_title'] = array(
91  'placeholder' => 'SURVEY_TITLE',
92  'label' => $lng->txt('svy_mail_context_reminder_survey_title')
93  );
94 
95  $placeholders['survey_link'] = array(
96  'placeholder' => 'SURVEY_LINK',
97  'label' => $lng->txt('perma_link')
98  );
99 
100  return $placeholders;
101  }
102 
103  public function resolveSpecificPlaceholder(
104  string $placeholder_id,
105  array $context_parameters,
106  ilObjUser $recipient = null
107  ): string {
111  $ilObjDataCache = $this->obj_data_cache;
112 
113  if ('survey_title' === $placeholder_id) {
114  return $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId((int) $context_parameters['ref_id']));
115  }
116 
117  if ('survey_link' === $placeholder_id) {
118  return ilLink::_getLink($context_parameters['ref_id'], 'svy');
119  }
120 
121  return '';
122  }
123 }
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...
loadLanguageModule(string $a_module)
Load language module.
Class ilMailEnvironmentHelper.
Class ilMailUserHelper.
ilMailLanguageHelper $languageHelper
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null)
Class ilMailLanguageHelper.
Class ilMailTemplateContext.
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
ilMailEnvironmentHelper $envHelper