ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMailFormCall Class Reference

Statically used helper class for generating links to the mail form user interface. More...

+ Collaboration diagram for ilMailFormCall:

Static Public Member Functions

static getLinkTarget ( $gui, string $cmd, array $gui_params=[], array $mail_params=[], $context_params=[])
 
static getRedirectTarget ( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
 
static storeReferer (array $queryParameters)
 
static getSignature ()
 
static getRefererRedirectUrl ()
 
static isRefererStored ()
 
static getContextId ()
 
static setContextId (?string $id)
 
static getContextParameters ()
 
static setContextParameters (array $parameters)
 
static setRecipients (array $recipients, string $type='to')
 
static getRecipients (string $type='to')
 

Data Fields

const SESSION_KEY = 'mail_transport'
 
const REFERER_KEY = 'r'
 HTTP-GET parameter for the referer url. More...
 
const SIGNATURE_KEY = 'sig'
 Session parameter for the hash. More...
 
const CONTEXT_PREFIX = 'ctx'
 Session parameter for the context. More...
 
const CONTEXT_KEY = 'ctx_template'
 Session parameter for the context. More...
 

Static Protected Member Functions

static getTargetUrl (string $argument_separator, $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
 

Detailed Description

Statically used helper class for generating links to the mail form user interface.

Version
: $Id$
Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 10 of file class.ilMailFormCall.php.

Member Function Documentation

◆ getContextId()

static ilMailFormCall::getContextId ( )
static
Returns
string|null

Definition at line 226 of file class.ilMailFormCall.php.

226 : ?string
227 {
228 $session = ilSession::get(self::SESSION_KEY);
229 return (
230 isset($session[self::CONTEXT_PREFIX][self::CONTEXT_KEY]) &&
231 is_string($session[self::CONTEXT_PREFIX][self::CONTEXT_KEY]) ?
232 $session[self::CONTEXT_PREFIX][self::CONTEXT_KEY] : null
233 );
234 }
static get($a_var)
Get a value.
$session

References $session, and ilSession\get().

Referenced by ilMailFormGUI\editAttachments(), ilMailFormGUI\saveDraft(), ilMailFormGUI\saveMailBeforeSearch(), ilMailFormGUI\searchUsers(), ilForumMailEventNotificationSender\send(), ilMailFormGUI\sendMessage(), and ilMailFormGUI\showForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContextParameters()

static ilMailFormCall::getContextParameters ( )
static
Returns
array context parameters

Definition at line 249 of file class.ilMailFormCall.php.

249 : array
250 {
251 $session = ilSession::get(self::SESSION_KEY);
252 if (isset($session[self::CONTEXT_PREFIX]) && is_array($session[self::CONTEXT_PREFIX])) {
254 }
255
256 return [];
257 }
const CONTEXT_PREFIX
Session parameter for the context.

References $session, and ilSession\get().

Referenced by ilMailFormGUI\editAttachments(), ilMailFormGUI\saveDraft(), ilMailFormGUI\saveMailBeforeSearch(), ilMailFormGUI\searchUsers(), ilForumMailEventNotificationSender\send(), and ilMailFormGUI\sendMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinkTarget()

static ilMailFormCall::getLinkTarget (   $gui,
string  $cmd,
array  $gui_params = [],
array  $mail_params = [],
  $context_params = [] 
)
static
Parameters
object | string$gui
string$cmd
array$gui_params
array$mail_params
array$context_params
Returns
string

Definition at line 45 of file class.ilMailFormCall.php.

51 : string {
52 return self::getTargetUrl('&', $gui, $cmd, $gui_params, $mail_params, $context_params);
53 }
static getTargetUrl(string $argument_separator, $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])

Referenced by ilMailUserActionProvider\collectActionsForTargetUser(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilAssignedUsersTableGUI\fillRow(), ilPublicUserProfileGUI\getEmbeddable(), and ilObjCourseGUI\infoScreen().

+ Here is the caller graph for this function:

◆ getRecipients()

static ilMailFormCall::getRecipients ( string  $type = 'to')
static
Returns
list<string>

Definition at line 283 of file class.ilMailFormCall.php.

283 : array
284 {
285 $session = ilSession::get(self::SESSION_KEY) ?? [];
286 $key = 'rcp_' . $type;
287 if (isset($session[$key]) && is_array($session[$key])) {
288 return array_map('strval', array_values($session[$key]));
289 }
290
291 return [];
292 }
$type

References $session, $type, and ilSession\get().

Referenced by ilMailGUI\executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRedirectTarget()

static ilMailFormCall::getRedirectTarget (   $gui,
string  $cmd,
array  $gui_params = [],
array  $mail_params = [],
array  $context_params = [] 
)
static

◆ getRefererRedirectUrl()

static ilMailFormCall::getRefererRedirectUrl ( )
static
Returns
string

Definition at line 181 of file class.ilMailFormCall.php.

181 : string
182 {
183 $url = '';
184 $session = ilSession::get(self::SESSION_KEY);
185
186 if (isset($session[self::REFERER_KEY])) {
188 if (is_string($url) && $url !== '') {
189 $parts = parse_url($url);
190 if (isset($parts['query']) && $parts['query'] !== '') {
191 $url .= '&returned_from_mail=1';
192 } else {
193 $url .= '?returned_from_mail=1';
194 }
195
196 $ilias_url_parts = parse_url(ilUtil::_getHttpPath());
197 if (isset($parts['host']) && $ilias_url_parts['host'] !== $parts['host']) {
198 $url = 'ilias.php?baseClass=ilMailGUI';
199 }
200 }
201
202 unset($session[self::REFERER_KEY]);
203 ilSession::set(self::SESSION_KEY, $session);
204 }
205
206 return $url;
207 }
const REFERER_KEY
HTTP-GET parameter for the referer url.
static set($a_var, $a_val)
Set a value.
static _getHttpPath()
$url

References $session, $url, ilUtil\_getHttpPath(), ilSession\get(), and ilSession\set().

Referenced by ilMailFormGUI\cancelMail(), ilMailFormGUI\saveDraft(), and ilMailFormGUI\sendMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSignature()

static ilMailFormCall::getSignature ( )
static
Returns
string signature

Definition at line 163 of file class.ilMailFormCall.php.

163 : string
164 {
165 $sig = '';
166 $session = ilSession::get(self::SESSION_KEY);
167
168 if (isset($session[self::SIGNATURE_KEY])) {
170
171 unset($session[self::SIGNATURE_KEY]);
172 ilSession::set(self::SESSION_KEY, $session);
173 }
174
175 return $sig;
176 }
const SIGNATURE_KEY
Session parameter for the hash.

References $session, ilSession\get(), and ilSession\set().

Referenced by ilMailFormGUI\showForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetUrl()

static ilMailFormCall::getTargetUrl ( string  $argument_separator,
  $gui,
string  $cmd,
array  $gui_params = [],
array  $mail_params = [],
array  $context_params = [] 
)
staticprotected
Parameters
string$argument_separator
object | string$gui
string$cmd
array$gui_params
array$mail_params
array$context_params
Returns
string

Definition at line 82 of file class.ilMailFormCall.php.

89 : string {
90 global $DIC;
91
92 $mparams = '';
93 $referer = '';
94
95 foreach ($mail_params as $key => $value) {
96 $mparams .= $argument_separator . $key . '=' . urlencode($value);
97 }
98
99 foreach ($context_params as $key => $value) {
100 if ($key == self::CONTEXT_KEY) {
101 $mparams .= $argument_separator . $key . '=' . urlencode($value);
102 } else {
103 $mparams .= $argument_separator . self::CONTEXT_PREFIX . '_' . $key . '=' . urlencode($value);
104 }
105 }
106
107 if (is_object($gui)) {
108 $ilCtrlTmp = clone $DIC->ctrl();
109 foreach ($gui_params as $key => $value) {
110 $ilCtrlTmp->setParameter($gui, $key, $value);
111 }
112 $referer = $ilCtrlTmp->getLinkTarget($gui, $cmd, '', false, false);
113 } elseif (is_string($gui)) {
114 $referer = $gui;
115 }
116
117 $referer = $argument_separator . self::REFERER_KEY . '=' . rawurlencode(base64_encode($referer));
118
119 return 'ilias.php?baseClass=ilMailGUI' . $referer . $mparams;
120 }
global $DIC
Definition: goto.php:24

◆ isRefererStored()

static ilMailFormCall::isRefererStored ( )
static
Returns
bool

Definition at line 212 of file class.ilMailFormCall.php.

212 : bool
213 {
214 $session = ilSession::get(self::SESSION_KEY);
215
216 return (
217 isset($session[self::REFERER_KEY]) &&
218 is_string($session[self::REFERER_KEY]) &&
219 $session[self::REFERER_KEY] !== ''
220 );
221 }

References $session, and ilSession\get().

Referenced by ilMailFormGUI\cancelMail(), ilMailFormGUI\saveDraft(), ilMailFormGUI\sendMessage(), and ilMailFormGUI\showForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextId()

static ilMailFormCall::setContextId ( ?string  $id)
static
Parameters
string | null$id

Definition at line 239 of file class.ilMailFormCall.php.

239 : void
240 {
241 $session = ilSession::get(self::SESSION_KEY);
243 ilSession::set(self::SESSION_KEY, $session);
244 }
const CONTEXT_KEY
Session parameter for the context.

References $session, ilSession\get(), and ilSession\set().

Referenced by ilMailFormGUI\showForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextParameters()

static ilMailFormCall::setContextParameters ( array  $parameters)
static
Parameters
array$parameters
Returns
array

Definition at line 263 of file class.ilMailFormCall.php.

263 : void
264 {
265 $session = ilSession::get(self::SESSION_KEY);
266 $session[self::CONTEXT_PREFIX] = $parameters;
267 ilSession::set(self::SESSION_KEY, $session);
268 }

References $session, ilSession\get(), and ilSession\set().

Referenced by ilMailFormGUI\showForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRecipients()

static ilMailFormCall::setRecipients ( array  $recipients,
string  $type = 'to' 
)
static
Parameters
list<string>$recipients

Definition at line 273 of file class.ilMailFormCall.php.

273 : void
274 {
275 $session = ilSession::get(self::SESSION_KEY) ?? [];
276 $session['rcp_' . $type] = array_map('strval', array_values($recipients));
277 ilSession::set(self::SESSION_KEY, $session);
278 }

References $session, $type, ilSession\get(), and ilSession\set().

Referenced by ilMailGUI\executeCommand(), ilStudyProgrammeMailMemberSearchGUI\sendMailToSelectedUsers(), ilMailMemberSearchGUI\sendMailToSelectedUsers(), and ilMembershipGUI\sendMailToSelectedUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeReferer()

static ilMailFormCall::storeReferer ( array  $queryParameters)
static
Parameters
array<string,string>$queryParameters

Definition at line 125 of file class.ilMailFormCall.php.

125 : void
126 {
127 $session = ilSession::get(self::SESSION_KEY);
128
129 if (isset($queryParameters[self::REFERER_KEY])) {
130 $session[self::REFERER_KEY] = base64_decode(rawurldecode($queryParameters[self::REFERER_KEY]));
131 $session[self::SIGNATURE_KEY] = base64_decode(rawurldecode($queryParameters[self::SIGNATURE_KEY] ?? ''));
132
133 $contextParameters = [];
134 foreach ($queryParameters as $key => $value) {
135 $prefix = substr($key, 0, strlen(self::CONTEXT_PREFIX));
136 if ($prefix == self::CONTEXT_PREFIX) {
137 if ($key == self::CONTEXT_KEY) {
138 $contextParameters[$key] = $value;
139 } else {
140 $contextParameters[substr($key, strlen(self::CONTEXT_PREFIX . '_'))] = $value;
141 }
142 }
143 }
144 $session[self::CONTEXT_PREFIX] = $contextParameters;
145 } else {
146 if (isset($session[self::REFERER_KEY])) {
147 unset($session[self::REFERER_KEY]);
148 }
149 if (isset($session[self::SIGNATURE_KEY])) {
150 unset($session[self::SIGNATURE_KEY]);
151 }
152 if (isset($session[self::CONTEXT_PREFIX])) {
153 unset($session[self::CONTEXT_PREFIX]);
154 }
155 }
156
157 ilSession::set(self::SESSION_KEY, $session);
158 }

References $session, ilSession\get(), and ilSession\set().

Referenced by ilMailGUI\executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ CONTEXT_KEY

◆ CONTEXT_PREFIX

const ilMailFormCall::CONTEXT_PREFIX = 'ctx'

Session parameter for the context.

Definition at line 30 of file class.ilMailFormCall.php.

◆ REFERER_KEY

const ilMailFormCall::REFERER_KEY = 'r'

HTTP-GET parameter for the referer url.

Definition at line 20 of file class.ilMailFormCall.php.

◆ SESSION_KEY

const ilMailFormCall::SESSION_KEY = 'mail_transport'

Definition at line 15 of file class.ilMailFormCall.php.

◆ SIGNATURE_KEY

const ilMailFormCall::SIGNATURE_KEY = 'sig'

Session parameter for the hash.

Definition at line 25 of file class.ilMailFormCall.php.

Referenced by ilExerciseManagementGUI\redirectFeedbackMailObject().


The documentation for this class was generated from the following file: