ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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=[], array $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'
 
const SIGNATURE_KEY = 'sig'
 
const CONTEXT_PREFIX = 'ctx'
 
const CONTEXT_KEY = 'ctx_template'
 

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 27 of file class.ilMailFormCall.php.

Member Function Documentation

◆ getContextId()

static ilMailFormCall::getContextId ( )
static

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

References $session, and ilSession\get().

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

216  : ?string
217  {
218  $session = ilSession::get(self::SESSION_KEY);
219  return (
220  isset($session[self::CONTEXT_PREFIX][self::CONTEXT_KEY]) &&
221  is_string($session[self::CONTEXT_PREFIX][self::CONTEXT_KEY]) ?
222  $session[self::CONTEXT_PREFIX][self::CONTEXT_KEY] : null
223  );
224  }
static get(string $a_var)
$session
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContextParameters()

static ilMailFormCall::getContextParameters ( )
static

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

References $session, and ilSession\get().

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

233  : array
234  {
235  $session = ilSession::get(self::SESSION_KEY);
236  if (isset($session[self::CONTEXT_PREFIX]) && is_array($session[self::CONTEXT_PREFIX])) {
237  return $session[self::CONTEXT_PREFIX];
238  }
239 
240  return [];
241  }
static get(string $a_var)
$session
+ 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 = [],
array  $context_params = [] 
)
static
Parameters
object | string$gui
string$cmd
array$gui_params
array$mail_params
array$context_params
Returns
string

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

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

49  : string {
50  return self::getTargetUrl('&', $gui, $cmd, $gui_params, $mail_params, $context_params);
51  }
+ Here is the caller graph for this function:

◆ getRecipients()

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

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

References ILIAS\LTI\ToolProvider\$key, $session, $type, and ilSession\get().

Referenced by ilMailGUI\executeCommand().

263  : array
264  {
265  $session = ilSession::get(self::SESSION_KEY) ?? [];
266  $key = 'rcp_' . $type;
267  if (isset($session[$key]) && is_array($session[$key])) {
268  return array_map('strval', array_values($session[$key]));
269  }
270 
271  return [];
272  }
static get(string $a_var)
$type
$session
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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

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

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

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

177  : string
178  {
179  $url = '';
180  $session = ilSession::get(self::SESSION_KEY);
181 
182  if (isset($session[self::REFERER_KEY])) {
183  $url = $session[self::REFERER_KEY];
184  if (is_string($url) && $url !== '') {
185  $parts = parse_url($url);
186  if (isset($parts['query']) && $parts['query'] !== '') {
187  $url .= '&returned_from_mail=1';
188  } else {
189  $url .= '?returned_from_mail=1';
190  }
191 
192  $ilias_url_parts = parse_url(ilUtil::_getHttpPath());
193  if (isset($parts['host']) && $ilias_url_parts['host'] !== $parts['host']) {
194  $url = 'ilias.php?baseClass=ilMailGUI';
195  }
196  }
197 
198  unset($session[self::REFERER_KEY]);
199  ilSession::set(self::SESSION_KEY, $session);
200  }
201 
202  return $url;
203  }
static get(string $a_var)
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
$session
static _getHttpPath()
$url
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSignature()

static ilMailFormCall::getSignature ( )
static

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

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

Referenced by ilMailFormGUI\showForm().

162  : string
163  {
164  $sig = '';
165  $session = ilSession::get(self::SESSION_KEY);
166 
167  if (isset($session[self::SIGNATURE_KEY])) {
168  $sig = $session[self::SIGNATURE_KEY];
169 
170  unset($session[self::SIGNATURE_KEY]);
171  ilSession::set(self::SESSION_KEY, $session);
172  }
173 
174  return $sig;
175  }
static get(string $a_var)
$session
static set(string $a_var, $a_val)
Set a value.
+ 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 80 of file class.ilMailFormCall.php.

References $DIC, and ILIAS\LTI\ToolProvider\$key.

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

◆ isRefererStored()

static ilMailFormCall::isRefererStored ( )
static

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

References $session, and ilSession\get().

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

205  : bool
206  {
207  $session = ilSession::get(self::SESSION_KEY);
208 
209  return (
210  isset($session[self::REFERER_KEY]) &&
211  is_string($session[self::REFERER_KEY]) &&
212  $session[self::REFERER_KEY] !== ''
213  );
214  }
static get(string $a_var)
$session
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextId()

static ilMailFormCall::setContextId ( ?string  $id)
static

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

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

Referenced by ilMailFormGUI\showForm().

226  : void
227  {
228  $session = ilSession::get(self::SESSION_KEY);
229  $session[self::CONTEXT_KEY] = $id;
230  ilSession::set(self::SESSION_KEY, $session);
231  }
static get(string $a_var)
$session
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextParameters()

static ilMailFormCall::setContextParameters ( array  $parameters)
static

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

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

Referenced by ilMailFormGUI\showForm().

243  : void
244  {
245  $session = ilSession::get(self::SESSION_KEY);
246  $session[self::CONTEXT_PREFIX] = $parameters;
247  ilSession::set(self::SESSION_KEY, $session);
248  }
static get(string $a_var)
$session
static set(string $a_var, $a_val)
Set a value.
+ 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 253 of file class.ilMailFormCall.php.

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

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

253  : void
254  {
255  $session = ilSession::get(self::SESSION_KEY) ?? [];
256  $session['rcp_' . $type] = array_map('strval', array_values($recipients));
257  ilSession::set(self::SESSION_KEY, $session);
258  }
static get(string $a_var)
$type
$session
static set(string $a_var, $a_val)
Set a value.
+ 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,mixed>$queryParameters

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

References ILIAS\LTI\ToolProvider\$key, $session, ilSession\get(), and ilSession\set().

Referenced by ilMailGUI\executeCommand().

123  : void
124  {
125  $session = ilSession::get(self::SESSION_KEY);
126 
127  if (isset($queryParameters[self::REFERER_KEY])) {
128  $session[self::REFERER_KEY] = base64_decode(rawurldecode($queryParameters[self::REFERER_KEY]));
129  $session[self::SIGNATURE_KEY] = base64_decode(
130  rawurldecode(
131  $queryParameters[self::SIGNATURE_KEY] ?? ''
132  )
133  );
134 
135  $contextParameters = [];
136  foreach ($queryParameters as $key => $value) {
137  $prefix = substr($key, 0, strlen(self::CONTEXT_PREFIX));
138  if ($prefix === self::CONTEXT_PREFIX) {
139  if ($key === self::CONTEXT_KEY) {
140  $contextParameters[$key] = $value;
141  } else {
142  $contextParameters[substr($key, strlen(self::CONTEXT_PREFIX . '_'))] = $value;
143  }
144  }
145  }
146  $session[self::CONTEXT_PREFIX] = $contextParameters;
147  } else {
148  if (isset($session[self::REFERER_KEY])) {
149  unset($session[self::REFERER_KEY]);
150  }
151  if (isset($session[self::SIGNATURE_KEY])) {
152  unset($session[self::SIGNATURE_KEY]);
153  }
154  if (isset($session[self::CONTEXT_PREFIX])) {
155  unset($session[self::CONTEXT_PREFIX]);
156  }
157  }
158 
159  ilSession::set(self::SESSION_KEY, $session);
160  }
static get(string $a_var)
$session
string $key
Consumer key/client ID value.
Definition: System.php:193
static set(string $a_var, $a_val)
Set a value.
+ 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'

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

◆ REFERER_KEY

const ilMailFormCall::REFERER_KEY = 'r'

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

◆ SESSION_KEY

const ilMailFormCall::SESSION_KEY = 'mail_transport'

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

◆ SIGNATURE_KEY

const ilMailFormCall::SIGNATURE_KEY = 'sig'

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