ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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

final const SESSION_KEY = 'mail_transport'
 
final const REFERER_KEY = 'r'
 
final const SIGNATURE_KEY = 'sig'
 
final const CONTEXT_PREFIX = 'ctx'
 
final 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 200 of file class.ilMailFormCall.php.

References ilSession\get(), and null.

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

200  : ?string
201  {
202  $session = ilSession::get(self::SESSION_KEY);
203  return (
204  isset($session[self::CONTEXT_PREFIX][self::CONTEXT_KEY]) &&
205  is_string($session[self::CONTEXT_PREFIX][self::CONTEXT_KEY]) ?
206  $session[self::CONTEXT_PREFIX][self::CONTEXT_KEY] : null
207  );
208  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContextParameters()

static ilMailFormCall::getContextParameters ( )
static

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

References ilSession\get().

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

217  : array
218  {
219  $session = ilSession::get(self::SESSION_KEY);
220  if (isset($session[self::CONTEXT_PREFIX]) && is_array($session[self::CONTEXT_PREFIX])) {
221  return $session[self::CONTEXT_PREFIX];
222  }
223 
224  return [];
225  }
static get(string $a_var)
+ 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

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

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

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

◆ getRecipients()

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

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

References ilSession\get().

Referenced by ilMailGUI\executeCommand().

247  : array
248  {
249  $session = ilSession::get(self::SESSION_KEY) ?? [];
250  $key = 'rcp_' . $type;
251  if (isset($session[$key]) && is_array($session[$key])) {
252  return array_map('strval', array_values($session[$key]));
253  }
254 
255  return [];
256  }
static get(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRedirectTarget()

◆ getRefererRedirectUrl()

static ilMailFormCall::getRefererRedirectUrl ( )
static

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

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

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

161  : string
162  {
163  $url = '';
164  $session = ilSession::get(self::SESSION_KEY);
165 
166  if (isset($session[self::REFERER_KEY])) {
167  $url = $session[self::REFERER_KEY];
168  if (is_string($url) && $url !== '') {
169  $parts = parse_url($url);
170  if (isset($parts['query']) && $parts['query'] !== '') {
171  $url .= '&returned_from_mail=1';
172  } else {
173  $url .= '?returned_from_mail=1';
174  }
175 
176  $ilias_url_parts = parse_url(ilUtil::_getHttpPath());
177  if (isset($parts['host']) && $ilias_url_parts['host'] !== $parts['host']) {
178  $url = 'ilias.php?baseClass=ilMailGUI';
179  }
180  }
181 
182  unset($session[self::REFERER_KEY]);
183  ilSession::set(self::SESSION_KEY, $session);
184  }
185 
186  return $url;
187  }
static get(string $a_var)
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
$url
Definition: shib_logout.php:66
static _getHttpPath()
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 146 of file class.ilMailFormCall.php.

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

Referenced by ilMailFormGUI\showForm().

146  : string
147  {
148  $sig = '';
149  $session = ilSession::get(self::SESSION_KEY);
150 
151  if (isset($session[self::SIGNATURE_KEY])) {
152  $sig = $session[self::SIGNATURE_KEY];
153 
154  unset($session[self::SIGNATURE_KEY]);
155  ilSession::set(self::SESSION_KEY, $session);
156  }
157 
158  return $sig;
159  }
static get(string $a_var)
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
object | string$gui

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

References $DIC.

71  : string {
72  global $DIC;
73 
74  $mparams = '';
75  $referer = '';
76 
77  foreach ($mail_params as $key => $value) {
78  $mparams .= $argument_separator . $key . '=' . urlencode((string) $value);
79  }
80 
81  foreach ($context_params as $key => $value) {
82  if ($key === self::CONTEXT_KEY) {
83  $mparams .= $argument_separator . $key . '=' . urlencode((string) $value);
84  } else {
85  $mparams .= $argument_separator . self::CONTEXT_PREFIX . '_' . $key . '=' . urlencode((string) $value);
86  }
87  }
88 
89  if (is_object($gui)) {
90  $ilCtrlTmp = clone $DIC->ctrl();
91  foreach ($gui_params as $key => $value) {
92  $ilCtrlTmp->setParameter($gui, $key, $value);
93  }
94  $referer = $ilCtrlTmp->getLinkTarget($gui, $cmd, '');
95  } elseif (is_string($gui)) {
96  $referer = $gui;
97  }
98 
99  $referer = $argument_separator . self::REFERER_KEY . '=' . rawurlencode(base64_encode($referer));
100 
101  return 'ilias.php?baseClass=ilMailGUI' . $referer . $mparams;
102  }
global $DIC
Definition: shib_login.php:22

◆ isRefererStored()

static ilMailFormCall::isRefererStored ( )
static

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

References ilSession\get().

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

189  : bool
190  {
191  $session = ilSession::get(self::SESSION_KEY);
192 
193  return (
194  isset($session[self::REFERER_KEY]) &&
195  is_string($session[self::REFERER_KEY]) &&
196  $session[self::REFERER_KEY] !== ''
197  );
198  }
static get(string $a_var)
+ 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 210 of file class.ilMailFormCall.php.

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

Referenced by ilMailFormGUI\showForm().

210  : void
211  {
212  $session = ilSession::get(self::SESSION_KEY);
213  $session[self::CONTEXT_KEY] = $id;
214  ilSession::set(self::SESSION_KEY, $session);
215  }
static get(string $a_var)
$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 227 of file class.ilMailFormCall.php.

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

Referenced by ilMailFormGUI\showForm().

227  : void
228  {
229  $session = ilSession::get(self::SESSION_KEY);
230  $session[self::CONTEXT_PREFIX] = $parameters;
231  ilSession::set(self::SESSION_KEY, $session);
232  }
static get(string $a_var)
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 237 of file class.ilMailFormCall.php.

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

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

237  : void
238  {
239  $session = ilSession::get(self::SESSION_KEY) ?? [];
240  $session['rcp_' . $type] = array_map('strval', array_values($recipients));
241  ilSession::set(self::SESSION_KEY, $session);
242  }
static get(string $a_var)
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 107 of file class.ilMailFormCall.php.

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

Referenced by ilMailGUI\executeCommand().

107  : void
108  {
109  $session = ilSession::get(self::SESSION_KEY);
110 
111  if (isset($queryParameters[self::REFERER_KEY])) {
112  $session[self::REFERER_KEY] = base64_decode(rawurldecode($queryParameters[self::REFERER_KEY]));
113  $session[self::SIGNATURE_KEY] = base64_decode(
114  rawurldecode(
115  $queryParameters[self::SIGNATURE_KEY] ?? ''
116  )
117  );
118 
119  $contextParameters = [];
120  foreach ($queryParameters as $key => $value) {
121  $prefix = substr($key, 0, strlen(self::CONTEXT_PREFIX));
122  if ($prefix === self::CONTEXT_PREFIX) {
123  if ($key === self::CONTEXT_KEY) {
124  $contextParameters[$key] = $value;
125  } else {
126  $contextParameters[substr($key, strlen(self::CONTEXT_PREFIX . '_'))] = $value;
127  }
128  }
129  }
130  $session[self::CONTEXT_PREFIX] = $contextParameters;
131  } else {
132  if (isset($session[self::REFERER_KEY])) {
133  unset($session[self::REFERER_KEY]);
134  }
135  if (isset($session[self::SIGNATURE_KEY])) {
136  unset($session[self::SIGNATURE_KEY]);
137  }
138  if (isset($session[self::CONTEXT_PREFIX])) {
139  unset($session[self::CONTEXT_PREFIX]);
140  }
141  }
142 
143  ilSession::set(self::SESSION_KEY, $session);
144  }
static get(string $a_var)
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

final const ilMailFormCall::CONTEXT_PREFIX = 'ctx'

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

◆ REFERER_KEY

final const ilMailFormCall::REFERER_KEY = 'r'

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

◆ SESSION_KEY

final const ilMailFormCall::SESSION_KEY = 'mail_transport'

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

◆ SIGNATURE_KEY


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