ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveyMailTemplateRaterInvitationContext.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
30 protected ilLanguage $lng;
32
33 public function __construct(
34 ?OrgUnitUserService $orgUnitUserService = null,
35 ?ilMailEnvironmentHelper $envHelper = null,
36 ?ilMailUserHelper $usernameHelper = null,
37 ?ilMailLanguageHelper $languageHelper = null
38 ) {
39 global $DIC;
40
42 $orgUnitUserService,
43 $envHelper,
44 $usernameHelper,
45 $languageHelper
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_rater_inv';
55
56 public function getId(): string
57 {
58 return self::ID;
59 }
60
61 public function getTitle(): string
62 {
64
65 $lng->loadLanguageModule('survey');
66
67 return $lng->txt('svy_mail_context_rater_invitation_title');
68 }
69
70 public function getDescription(): string
71 {
73
74 $lng->loadLanguageModule('survey');
75
76 return $lng->txt('svy_mail_context_rater_invitation_info');
77 }
78
79 public function getSpecificPlaceholders(): array
80 {
82
83 $lng->loadLanguageModule('survey');
84
85 $placeholders = array();
86
87 $placeholders['survey_title'] = array(
88 'placeholder' => 'SURVEY_TITLE',
89 'label' => $lng->txt('svy_mail_context_rater_invitation_survey_title')
90 );
91
92 $placeholders['survey_link'] = array(
93 'placeholder' => 'SURVEY_LINK',
94 'label' => $lng->txt('perma_link')
95 );
96
97 $placeholders['external_rater_firstname'] = array(
98 'placeholder' => 'EXTERNAL_RATER_FIRSTNAME',
99 'label' => $lng->txt('svy_ext_rater_firstname')
100 );
101
102 $placeholders['external_rater_lastname'] = array(
103 'placeholder' => 'EXTERNAL_RATER_LASTNAME',
104 'label' => $lng->txt('svy_ext_rater_lastname')
105 );
106
107 return $placeholders;
108 }
109
110 public function resolveSpecificPlaceholder(
111 string $placeholder_id,
112 array $context_parameters,
113 ?ilObjUser $recipient = null
114 ): string {
118 $ilObjDataCache = $this->obj_data_cache;
119
120 $svy = new ilObjSurvey((int) $context_parameters['ref_id']);
121 $raters = $svy->getRatersData((int) $context_parameters['appr_id']);
122 $current_rater = null;
123 foreach ($raters as $rater) {
124 if ($rater["user_id"] == $context_parameters['rater_id']) {
125 $current_rater = $rater;
126 }
127 }
128
129 switch ($placeholder_id) {
130 case 'survey_title':
131 return $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId((int) $context_parameters['ref_id']));
132
133 case 'survey_link':
134 $svy = new ilObjSurvey((int) $context_parameters['ref_id']);
135 $raters = $svy->getRatersData((int) $context_parameters['appr_id']);
136 $href = ilLink::_getLink((int) $context_parameters['ref_id'], 'svy');
137 if (isset($current_rater["href"]) && $current_rater["href"] !== "") {
138 $href = $current_rater["href"];
139 }
140 return $href;
141
142 case 'external_rater_firstname':
143 return $current_rater["firstname"] ?? "";
144
145 case 'external_rater_lastname':
146 return $current_rater["lastname"] ?? "";
147 }
148
149 return '';
150 }
151}
language handling
loadLanguageModule(string $a_module)
Load language module.
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)
User class.
class ilObjectDataCache
__construct(?OrgUnitUserService $orgUnitUserService=null, ?ilMailEnvironmentHelper $envHelper=null, ?ilMailUserHelper $usernameHelper=null, ?ilMailLanguageHelper $languageHelper=null)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26