ILIAS  release_8 Revision v8.24
class.ilSurveyMailTemplateRaterInvitationContext.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
29{
30 protected ilLanguage $lng;
32
33 public function __construct(
36 ilMailUserHelper $usernameHelper = null,
38 ) {
39 global $DIC;
40
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_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['svy_title'] = array(
88 'placeholder' => 'SURVEY_TITLE',
89 'label' => $lng->txt('svy_mail_context_rater_invitation_survey_title')
90 );
91
92 $placeholders['svy_link'] = array(
93 'placeholder' => 'SURVEY_LINK',
94 'label' => $lng->txt('perma_link')
95 );
96
97 $placeholders['svy_ext_rater_firstname'] = array(
98 'placeholder' => 'EXTERNAL_RATER_FIRSTNAME',
99 'label' => $lng->txt('svy_ext_rater_firstname')
100 );
101
102 $placeholders['svy_ext_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 bool $html_markup = false
115 ): string {
119 $ilObjDataCache = $this->obj_data_cache;
120
121 $svy = new ilObjSurvey((int) $context_parameters['ref_id']);
122 $raters = $svy->getRatersData((int) $context_parameters['appr_id']);
123 $current_rater = null;
124 foreach ($raters as $rater) {
125 if ($rater["user_id"] == $context_parameters['rater_id']) {
126 $current_rater = $rater;
127 }
128 }
129
130 switch ($placeholder_id) {
131 case 'svy_title':
132 return $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId((int) $context_parameters['ref_id']));
133
134 case 'svy_link':
135 $svy = new ilObjSurvey((int) $context_parameters['ref_id']);
136 $raters = $svy->getRatersData((int) $context_parameters['appr_id']);
137 $href = ilLink::_getLink((int) $context_parameters['ref_id'], 'svy');
138 if (isset($current_rater["href"]) && $current_rater["href"] !== "") {
139 $href = $current_rater["href"];
140 }
141 return $href;
142
143 case 'svy_ext_rater_firstname':
144 return $current_rater["firstname"] ?? "";
145
146 case 'svy_ext_rater_lastname':
147 return $current_rater["lastname"] ?? "";
148 }
149
150 return '';
151 }
152}
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...
Class ilMailEnvironmentHelper.
Class ilMailLanguageHelper.
Class ilMailTemplateContext.
ilMailLanguageHelper $languageHelper
OrgUnitUserService $orgUnitUserService
ilMailEnvironmentHelper $envHelper
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
Class ilMailUserHelper.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc