ILIAS  release_8 Revision v8.23
class.ilSurveyMailTemplateReminderContext.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
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['svy_title'] = array(
91  'placeholder' => 'SURVEY_TITLE',
92  'label' => $lng->txt('svy_mail_context_reminder_survey_title')
93  );
94 
95  $placeholders['svy_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  bool $html_markup = false
108  ): string {
112  $ilObjDataCache = $this->obj_data_cache;
113 
114  if ('svy_title' === $placeholder_id) {
115  return $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId((int) $context_parameters['ref_id']));
116  }
117 
118  if ('svy_link' === $placeholder_id) {
119  return ilLink::_getLink($context_parameters['ref_id'], 'svy');
120  }
121 
122  return '';
123  }
124 }
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)
loadLanguageModule(string $a_module)
Load language module.
Class ilMailEnvironmentHelper.
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...