ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSurveyMailTemplateReminderContext.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
6 
13 {
17  protected $lng;
18 
22  protected $obj_data_cache;
23 
24  public function __construct(
27  ilMailUserHelper $usernameHelper = null,
29  ) {
30  global $DIC;
31 
34  $envHelper,
35  $usernameHelper,
37  );
38 
39  $this->lng = $DIC->language();
40  if (isset($DIC["ilObjDataCache"])) {
41  $this->obj_data_cache = $DIC["ilObjDataCache"];
42  }
43  }
44 
45  const ID = 'svy_context_rmd';
46 
50  public function getId() : string
51  {
52  return self::ID;
53  }
54 
58  public function getTitle() : string
59  {
60  $lng = $this->lng;
61 
62  $lng->loadLanguageModule('survey');
63 
64  return $lng->txt('svy_mail_context_reminder_title');
65  }
66 
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 
83  public function getSpecificPlaceholders() : array
84  {
88  $lng = $this->lng;
89 
90  $lng->loadLanguageModule('survey');
91 
92  $placeholders = array();
93 
94  $placeholders['svy_title'] = array(
95  'placeholder' => 'SURVEY_TITLE',
96  'label' => $lng->txt('svy_mail_context_reminder_survey_title')
97  );
98 
99  $placeholders['svy_link'] = array(
100  'placeholder' => 'SURVEY_LINK',
101  'label' => $lng->txt('perma_link')
102  );
103 
104  return $placeholders;
105  }
106 
110  public function resolveSpecificPlaceholder(
111  string $placeholder_id,
112  array $context_parameters,
113  ilObjUser $recipient = null,
114  bool $html_markup = false
115  ) : string {
119  $ilObjDataCache = $this->obj_data_cache;
120 
121  if ('svy_title' == $placeholder_id) {
122  return (string) $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($context_parameters['ref_id']));
123  } else {
124  if ('svy_link' == $placeholder_id) {
125  require_once './Services/Link/classes/class.ilLink.php';
126  return (string) ilLink::_getLink($context_parameters['ref_id'], 'svy');
127  }
128  }
129 
130  return '';
131  }
132 }
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
getSpecificPlaceholders()
Return an array of placeholders.
Class ilMailEnvironmentHelper.
Class ilMailUserHelper.
Class ilMailLanguageHelper.
global $DIC
Definition: goto.php:24
Class ilMailTemplateContext.
__construct(Container $dic, ilPlugin $plugin)
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)