ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailFormGUI Class Reference
+ Collaboration diagram for ilMailFormGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 sendMessage ()
 
 saveDraft ()
 
 searchUsers ($save=true)
 
 searchCoursesTo ()
 
 searchGroupsTo ()
 
 search ()
 
 cancelSearch ()
 
 editAttachments ()
 
 returnFromAttachments ()
 
 searchResults ()
 
 mailUser ()
 
 mailRole ()
 
 replyMail ()
 
 mailAttachment ()
 
 showForm ()
 
 lookupRecipientAsync ()
 
 cancelMail ()
 
 searchMailingListsTo ()
 

Private Attributes

 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $umail = null
 
 $mbox = null
 
 $mfile = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailFormGUI::__construct ( )

Definition at line 27 of file class.ilMailFormGUI.php.

References $_GET, $_POST, $ilCtrl, $ilUser, $lng, and $tpl.

28  {
29  global $tpl, $ilCtrl, $lng, $ilUser;
30 
31  $this->tpl = $tpl;
32  $this->ctrl = $ilCtrl;
33  $this->lng = $lng;
34 
35  $this->umail = new ilFormatMail($ilUser->getId());
36  $this->mfile = new ilFileDataMail($ilUser->getId());
37  $this->mbox = new ilMailBox($ilUser->getId());
38 
39  if(isset($_POST['mobj_id']) && (int)$_POST['mobj_id'])
40  {
41  $_GET['mobj_id'] = $_POST['mobj_id'];
42  }
43  // IF THERE IS NO OBJ_ID GIVEN GET THE ID OF MAIL ROOT NODE
44  if(!(int)$_GET['mobj_id'])
45  {
46  $_GET['mobj_id'] = $this->mbox->getInboxFolder();
47  }
48  $_GET['mobj_id'] = (int)$_GET['mobj_id'];
49  $this->ctrl->saveParameter($this, 'mobj_id');
50  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
This class handles all operations on files (attachments) in directory ilias_data/mail.
global $ilCtrl
Definition: ilias.php:18
Class UserMail this class handles user mails.
global $ilUser
Definition: imgupload.php:15

Member Function Documentation

◆ cancelMail()

ilMailFormGUI::cancelMail ( )

Definition at line 755 of file class.ilMailFormGUI.php.

References $_POST, $ilUser, ilMailFormCall\getRefererRedirectUrl(), ilMailFormCall\isRefererStored(), ilUtil\redirect(), ilUtil\securePlainString(), and showForm().

756  {
759  else
760  return $this->showForm();
761  }
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ cancelSearch()

ilMailFormGUI::cancelSearch ( )

Definition at line 369 of file class.ilMailFormGUI.php.

References $_SESSION, and searchResults().

370  {
371  unset($_SESSION["mail_search"]);
372  $this->searchResults();
373  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the call graph for this function:

◆ editAttachments()

ilMailFormGUI::editAttachments ( )

Definition at line 375 of file class.ilMailFormGUI.php.

References $_POST, $_SESSION, and ilUtil\securePlainString().

376  {
377  // decode post values
378  $files = array();
379  if(is_array($_POST['attachments']))
380  {
381  foreach($_POST['attachments'] as $value)
382  {
383  $files[] = urldecode($value);
384  }
385  }
386 
387  // Note: For security reasons, ILIAS only allows Plain text messages.
388  $this->umail->savePostData($_SESSION["AccountId"],
389  $files,
392  ilUtil::securePlainString($_POST["rcp_bcc"]),
393  $_POST["m_type"],
394  ilUtil::securePlainString($_POST["m_email"]),
395  ilUtil::securePlainString($_POST["m_subject"]),
396  ilUtil::securePlainString($_POST["m_message"]),
397  ilUtil::securePlainString($_POST['use_placeholders'])
398  );
399 
400  $this->ctrl->redirectByClass("ilmailattachmentgui");
401  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailFormGUI::executeCommand ( )

Definition at line 52 of file class.ilMailFormGUI.php.

References $cmd.

53  {
54  $forward_class = $this->ctrl->getNextClass($this);
55  switch($forward_class)
56  {
57  case 'ilmailfoldergui':
58  include_once 'Services/Mail/classes/class.ilMailFolderGUI.php';
59 
60  $this->ctrl->forwardCommand(new ilMailFolderGUI());
61  break;
62 
63  case 'ilmailattachmentgui':
64  include_once 'Services/Mail/classes/class.ilMailAttachmentGUI.php';
65 
66  $this->ctrl->setReturn($this, "returnFromAttachments");
67  $this->ctrl->forwardCommand(new ilMailAttachmentGUI());
68  break;
69 
70  case 'ilmailsearchgui':
71  include_once 'Services/Contact/classes/class.ilMailSearchGUI.php';
72 
73  $this->ctrl->setReturn($this, "searchResults");
74  $this->ctrl->forwardCommand(new ilMailSearchGUI());
75  break;
76 
77  case 'ilmailsearchcoursesgui':
78  include_once 'Services/Contact/classes/class.ilMailSearchCoursesGUI.php';
79 
80  $this->ctrl->setReturn($this, "searchResults");
81  $this->ctrl->forwardCommand(new ilMailSearchCoursesGUI());
82  break;
83 
84  case 'ilmailinglistsgui':
85  include_once 'Services/Contact/classes/class.ilMailingListsGUI.php';
86 
87  $this->ctrl->setReturn($this, 'searchResults');
88  $this->ctrl->forwardCommand(new ilMailingListsGUI());
89  break;
90 
91  case 'ilmailsearchgroupsgui':
92  include_once 'Services/Contact/classes/class.ilMailSearchGroupsGUI.php';
93 
94  $this->ctrl->setReturn($this, "searchResults");
95  $this->ctrl->forwardCommand(new ilMailSearchGroupsGUI());
96  break;
97 
98  default:
99  if (!($cmd = $this->ctrl->getCmd()))
100  {
101  $cmd = "showForm";
102  }
103 
104  $this->$cmd();
105  break;
106  }
107  return true;
108  }
$cmd
Definition: sahs_server.php:35

◆ lookupRecipientAsync()

ilMailFormGUI::lookupRecipientAsync ( )

Definition at line 730 of file class.ilMailFormGUI.php.

References $_REQUEST, $result, ilJsonUtil\encode(), and exit.

731  {
732  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
733  include_once 'Services/Mail/classes/class.ilMailForm.php';
734 
735  $search = $_REQUEST["term"];
736  $result = array();
737  if (!$search)
738  {
740  exit;
741  }
742 
743  // #14768
744  $quoted = $search;
745  $quoted = str_replace('%', '\%', $quoted);
746  $quoted = str_replace('_', '\_', $quoted);
747 
748  $mailFormObj = new ilMailForm;
749  $result = $mailFormObj->getRecipientAsync("%" .$quoted. "%", $search);
750 
752  exit;
753  }
exit
Definition: login.php:54
$result
static encode($mixed, $suppress_native=false)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ mailAttachment()

ilMailFormGUI::mailAttachment ( )

Definition at line 433 of file class.ilMailFormGUI.php.

References $_GET, and showForm().

434  {
435  $_GET["type"] = "attach";
436  $this->showForm();
437  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ mailRole()

ilMailFormGUI::mailRole ( )

Definition at line 421 of file class.ilMailFormGUI.php.

References $_GET, and showForm().

422  {
423  $_GET["type"] = "role";
424  $this->showForm();
425  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ mailUser()

ilMailFormGUI::mailUser ( )

Definition at line 415 of file class.ilMailFormGUI.php.

References $_GET, and showForm().

416  {
417  $_GET["type"] = "new";
418  $this->showForm();
419  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ replyMail()

ilMailFormGUI::replyMail ( )

Definition at line 427 of file class.ilMailFormGUI.php.

References $_GET, and showForm().

428  {
429  $_GET["type"] = "reply";
430  $this->showForm();
431  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ returnFromAttachments()

ilMailFormGUI::returnFromAttachments ( )

Definition at line 403 of file class.ilMailFormGUI.php.

References $_GET, and showForm().

404  {
405  $_GET["type"] = "attach";
406  $this->showForm();
407  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ saveDraft()

ilMailFormGUI::saveDraft ( )

Definition at line 184 of file class.ilMailFormGUI.php.

References $_POST, $_SESSION, ilMailFormCall\getRefererRedirectUrl(), ilMailFormCall\isRefererStored(), ilUtil\redirect(), ilUtil\securePlainString(), ilUtil\sendInfo(), and showForm().

185  {
186  if(!$_POST['m_subject'])
187  {
188  $_POST['m_subject'] = 'No title';
189  }
190 
191  $draftsId = $this->mbox->getDraftsFolder();
192 
193  // decode post values
194  $files = array();
195  if(is_array($_POST['attachments']))
196  {
197  foreach($_POST['attachments'] as $value)
198  {
199  $files[] = urldecode($value);
200  }
201  }
202 
203  if(isset($_SESSION["draft"]))
204  {
205  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
206  $this->umail->updateDraft($draftsId, $files,
209  ilUtil::securePlainString($_POST["rcp_bcc"]),
210  $_POST["m_type"],
211  ilUtil::securePlainString($_POST["m_email"]),
212  ilUtil::securePlainString($_POST["m_subject"]),
213  ilUtil::securePlainString($_POST["m_message"]),
214  (int)$_SESSION["draft"],
215  (int)ilUtil::securePlainString($_POST['use_placeholders'])
216  );
217  #session_unregister("draft");
218  #ilUtil::sendInfo($this->lng->txt("mail_saved"),true);
219  #ilUtil::redirect("ilias.php?baseClass=ilMailGUI&mobj_id=".$mbox->getInboxFolder());
220 
221  unset($_SESSION["draft"]);
222  ilUtil::sendInfo($this->lng->txt("mail_saved"), true);
223 
226  else
227  $this->ctrl->redirectByClass("ilmailfoldergui");
228  }
229  else
230  {
231  if ($this->umail->sendInternalMail($draftsId,$_SESSION["AccountId"],$files,
232  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
235  ilUtil::securePlainString($_POST["rcp_bcc"]),
236  'read',
237  $_POST["m_type"],
238  ilUtil::securePlainString($_POST["m_email"]),
239  ilUtil::securePlainString($_POST["m_subject"]),
240  ilUtil::securePlainString($_POST["m_message"]),
241  $_SESSION["AccountId"],
242  ilUtil::securePlainString($_POST['use_placeholders'])
243  )
244  )
245  {
246  ilUtil::sendInfo($this->lng->txt("mail_saved"),true);
247  #$this->ctrl->setParameterByClass("ilmailfoldergui", "mobj_id", $this->mbox->getDraftsFolder());
248 
251  else
252  $this->ctrl->redirectByClass("ilmailfoldergui");
253  }
254  else
255  {
256  ilUtil::sendInfo($this->lng->txt("mail_send_error"));
257  }
258  }
259 
260  $this->showForm();
261  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ search()

ilMailFormGUI::search ( )

Definition at line 345 of file class.ilMailFormGUI.php.

References $_POST, $_SESSION, searchUsers(), and ilUtil\sendInfo().

346  {
347  $_SESSION["mail_search_search"] = $_POST["search"];
348  if(strlen(trim($_SESSION["mail_search_search"])) == 0)
349  {
350  ilUtil::sendInfo($this->lng->txt("mail_insert_query"));
351  $this->searchUsers(false);
352  }
353  else
354  {
355  if(strlen(trim($_SESSION["mail_search_search"])) < 3)
356  {
357  $this->lng->loadLanguageModule('search');
358  ilUtil::sendInfo($this->lng->txt('search_minimum_three'));
359  $this->searchUsers(false);
360  }
361  else
362  {
363  $this->ctrl->setParameterByClass("ilmailsearchgui", "search", urlencode($_SESSION["mail_search_search"]));
364  $this->ctrl->redirectByClass("ilmailsearchgui");
365  }
366  }
367  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
searchUsers($save=true)
+ Here is the call graph for this function:

◆ searchCoursesTo()

ilMailFormGUI::searchCoursesTo ( )

Definition at line 321 of file class.ilMailFormGUI.php.

References $_SESSION.

322  {
323  $this->saveMailBeforeSearch();
324 
325  if($_SESSION['search_crs'])
326  {
327  $this->ctrl->setParameterByClass('ilmailsearchcoursesgui', 'cmd', 'showMembers');
328  }
329 
330  $this->ctrl->setParameterByClass('ilmailsearchcoursesgui', 'ref', 'mail');
331  $this->ctrl->redirectByClass('ilmailsearchcoursesgui');
332  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ searchGroupsTo()

ilMailFormGUI::searchGroupsTo ( )

Definition at line 337 of file class.ilMailFormGUI.php.

338  {
339  $this->saveMailBeforeSearch();
340 
341  $this->ctrl->setParameterByClass('ilmailsearchgroupsgui', 'ref', 'mail');
342  $this->ctrl->redirectByClass('ilmailsearchgroupsgui');
343  }

◆ searchMailingListsTo()

ilMailFormGUI::searchMailingListsTo ( )

Definition at line 799 of file class.ilMailFormGUI.php.

800  {
801  $this->saveMailBeforeSearch();
802 
803  $this->ctrl->setParameterByClass('ilmailinglistsgui', 'ref', 'mail');
804  $this->ctrl->redirectByClass('ilmailinglistsgui');
805  }

◆ searchResults()

ilMailFormGUI::searchResults ( )

Definition at line 409 of file class.ilMailFormGUI.php.

References $_GET, and showForm().

Referenced by cancelSearch().

410  {
411  $_GET["type"] = "search_res";
412  $this->showForm();
413  }
$_GET["client_id"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ searchUsers()

ilMailFormGUI::searchUsers (   $save = true)

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

References $_POST, $_SESSION, $ilCtrl, $ilUser, ilUtil\prepareFormOutput(), ilUtil\securePlainString(), and ilTextInputGUI\setSize().

Referenced by search().

264  {
265  global $ilUser, $ilCtrl;
266 
267  $this->tpl->setTitle($this->lng->txt("mail"));
268 
269  if ($save)
270  {
271  // decode post values
272  $files = array();
273  if(is_array($_POST['attachments']))
274  {
275  foreach($_POST['attachments'] as $value)
276  {
277  $files[] = urldecode($value);
278  }
279  }
280 
281  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
282  $this->umail->savePostData($ilUser->getId(),
283  $files,
286  ilUtil::securePlainString($_POST["rcp_bcc"]),
287  $_POST["m_type"],
288  ilUtil::securePlainString($_POST["m_email"]),
289  ilUtil::securePlainString($_POST["m_subject"]),
290  ilUtil::securePlainString($_POST["m_message"]),
291  ilUtil::securePlainString($_POST['use_placeholders'])
292  );
293  }
294  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
295  $form = new ilPropertyFormGUI();
296  $form->setId('search_rcp');
297  $form->setTitle($this->lng->txt('search_recipients'));
298  $form->setFormAction($ilCtrl->getFormAction($this, 'search'));
299 
300  $inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search');
301  $inp->setSize(30);
302  $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true);
303  $inp->setDataSource($dsDataLink);
304 
305  if (strlen(trim($_SESSION["mail_search_search"])) > 0)
306  {
307  $inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true));
308  }
309  $form->addItem($inp);
310 
311  $form->addCommandButton('search', $this->lng->txt("search"));
312  $form->addCommandButton('cancelSearch', $this->lng->txt("cancel"));
313 
314  $this->tpl->setContent($form->getHtml());
315  $this->tpl->show();
316  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_POST['username']
Definition: cron.php:12
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
setSize($a_size)
Set Size.
This class represents a text property in a property form.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendMessage()

ilMailFormGUI::sendMessage ( )

Definition at line 110 of file class.ilMailFormGUI.php.

References $_POST, $ilUser, ilMailFormCall\getRefererRedirectUrl(), ilMailFormCall\isRefererStored(), ilUtil\redirect(), ilUtil\securePlainString(), ilUtil\sendInfo(), and showForm().

111  {
112  global $ilUser;
113 
114  // decode post values
115  $files = array();
116  if(is_array($_POST['attachments']))
117  {
118  foreach($_POST['attachments'] as $value)
119  {
120  if(is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . urldecode($value)))
121  {
122  $files[] = urldecode($value);
123  }
124  }
125  }
126 
127  // Remove \r
128  $f_message = str_replace("\r", '', ilUtil::securePlainString($_POST['m_message']));
129 
130  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
131  $f_message = $this->umail->formatLinebreakMessage($f_message);
132 
133  $this->umail->setSaveInSentbox(true);
134 
135  $m_type = isset($_POST["m_type"]) ? $_POST["m_type"] : array("normal");
136 
137  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
138  if($errorMessage = $this->umail->sendMail(
141  ilUtil::securePlainString($_POST['rcp_bcc']),
142  ilUtil::securePlainString($_POST['m_subject']), $f_message,
143  $files,
144 // $_POST['m_type'],
145  $m_type,
146  ilUtil::securePlainString($_POST['use_placeholders'])
147  )
148  )
149  {
150  if(is_array($_POST['attachments']))
151  {
152  foreach($_POST['attachments'] as $key => $value)
153  {
154  if(is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . urldecode($value)))
155  {
156  $_POST['attachments'][$key] = urldecode($value);
157  }
158  else
159  {
160  unset($_POST['attachments'][$key]);
161  }
162  }
163  }
164  ilUtil::sendInfo($errorMessage);
165  }
166  else
167  {
168  $this->umail->savePostData($ilUser->getId(), array(), "", "", "", "", "", "", "", "");
169 
170  $this->ctrl->setParameterByClass('ilmailgui', 'type', 'message_sent');
171 
173  {
174  ilUtil::sendInfo($this->lng->txt('mail_message_send'), true);
176  }
177  else
178  $this->ctrl->redirectByClass('ilmailgui');
179  }
180 
181  $this->showForm();
182  }
$_POST['username']
Definition: cron.php:12
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ showForm()

ilMailFormGUI::showForm ( )

Definition at line 439 of file class.ilMailFormGUI.php.

References $_GET, $_POST, $_SESSION, $data, $ilCtrl, $ilUser, $lng, $size, ilFormat\formatSize(), ilMailFormCall\getSignature(), ilMailFormCall\isRefererStored(), ilUtil\securePlainString(), ilUtil\sendInfo(), ilCheckboxInputGUI\setOptionTitle(), ilFormPropertyGUI\setRequired(), ilTextInputGUI\setSize(), and ilTextAreaInputGUI\setValue().

Referenced by cancelMail(), mailAttachment(), mailRole(), mailUser(), replyMail(), returnFromAttachments(), saveDraft(), searchResults(), and sendMessage().

440  {
441  global $rbacsystem, $ilUser, $ilCtrl, $lng, $ilTabs;
442 
443  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_new.html", "Services/Mail");
444  $this->tpl->setTitle($this->lng->txt("mail"));
445 
446  $this->lng->loadLanguageModule("crs");
447 
449  $ilTabs->setBackTarget($lng->txt('back'), $ilCtrl->getLinkTarget($this, 'cancelMail'));
450 
451  switch($_GET["type"])
452  {
453  case 'reply':
454  if($_SESSION['mail_id'])
455  {
456  $_GET['mail_id'] = $_SESSION['mail_id'];
457  }
458  $mailData = $this->umail->getMail($_GET["mail_id"]);
459  $mailData["m_subject"] = $this->umail->formatReplySubject();
460  $mailData["m_message"] = $this->umail->formatReplyMessage();
461  $mailData["m_message"] = $this->umail->prependSignature();
462  // NO ATTACHMENTS FOR REPLIES
463  $mailData["attachments"] = array();
464  //$mailData["rcp_cc"] = $this->umail->formatReplyRecipientsForCC();
465  $mailData["rcp_cc"] = '';
466  $mailData["rcp_to"] = $this->umail->formatReplyRecipient();
467  $_SESSION["mail_id"] = "";
468  break;
469 
470  case 'search_res':
471  $mailData = $this->umail->getSavedData();
472 
473  /*if($_SESSION["mail_search_results"])
474  {
475  $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results"],$_SESSION["mail_search"]);
476  }
477  unset($_SESSION["mail_search"]);
478  unset($_SESSION["mail_search_results"]);*/
479 
480  if($_SESSION["mail_search_results_to"])
481  {
482  $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_to"], 'to');
483  }
484  if($_SESSION["mail_search_results_cc"])
485  {
486  $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_cc"], 'cc');
487  }
488  if($_SESSION["mail_search_results_bcc"])
489  {
490  $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_bcc"], 'bc');
491  }
492 
493  unset($_SESSION["mail_search_results_to"]);
494  unset($_SESSION["mail_search_results_cc"]);
495  unset($_SESSION["mail_search_results_bcc"]);
496 
497  break;
498 
499  case 'attach':
500  $mailData = $this->umail->getSavedData();
501  break;
502 
503  case 'draft':
504  $_SESSION["draft"] = $_GET["mail_id"];
505  $mailData = $this->umail->getMail($_GET["mail_id"]);
506  break;
507 
508  case 'forward':
509  $mailData = $this->umail->getMail($_GET["mail_id"]);
510  $mailData["rcp_to"] = $mailData["rcp_cc"] = $mailData["rcp_bcc"] = '';
511  $mailData["m_subject"] = $this->umail->formatForwardSubject();
512  $mailData["m_message"] = $this->umail->prependSignature();
513  if(count($mailData["attachments"]))
514  {
515  if($error = $this->mfile->adoptAttachments($mailData["attachments"],$_GET["mail_id"]))
516  {
517  ilUtil::sendInfo($error);
518  }
519  }
520  break;
521 
522  case 'new':
523  if($_GET['rcp_to'])
524  {
525  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
526  $mailData["rcp_to"] = ilUtil::securePlainString($_GET['rcp_to']);
527  }
528  else if($_SESSION['rcp_to'])
529  {
530  $mailData["rcp_to"] = $_SESSION['rcp_to'];
531  }
532  if($_GET['rcp_cc'])
533  {
534  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
535  $mailData["rcp_cc"] = ilUtil::securePlainString($_GET['rcp_cc']);
536  }
537  else if($_SESSION['rcp_cc'])
538  {
539  $mailData["rcp_cc"] = $_SESSION['rcp_cc'];
540  }
541  if($_GET['rcp_bcc'])
542  {
543  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
544  $mailData["rcp_bcc"] = ilUtil::securePlainString($_GET['rcp_bcc']);
545  }
546  else if($_SESSION['rcp_bcc'])
547  {
548  $mailData["rcp_bcc"] = $_SESSION['rcp_bcc'];
549  }
550  $mailData['m_message'] = '';
551  if(strlen($sig = ilMailFormCall::getSignature()))
552  {
553  $mailData['m_message'] = $sig;
554  $mailData['m_message'] .= chr(13).chr(10).chr(13).chr(10);
555  }
556  $mailData['m_message'] .= $this->umail->appendSignature();
557 
558  $_SESSION['rcp_to'] = '';
559  $_SESSION['rcp_cc'] = '';
560  $_SESSION['rcp_bcc'] = '';
561  break;
562 
563  case 'role':
564 
565  if(is_array($_POST['roles']))
566  {
567  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
568  $mailData['rcp_to'] = ilUtil::securePlainString(implode(',',$_POST['roles']));
569  }
570  elseif(is_array($_SESSION['mail_roles']))
571  {
572  $mailData['rcp_to'] = ilUtil::securePlainString(implode(',', $_SESSION['mail_roles']));
573  }
574 
575  $mailData['m_message'] = '';
576  if(strlen($sig = ilMailFormCall::getSignature()))
577  {
578  $mailData['m_message'] = $sig;
579  $mailData['m_message'] .= chr(13).chr(10).chr(13).chr(10);
580  }
581 
582  $mailData['m_message'] .= $_POST["additional_message_text"].chr(13).chr(10).$this->umail->appendSignature();
583  $_POST["additional_message_text"] = "";
584  $_SESSION['mail_roles'] = "";
585  break;
586 
587  case 'address':
588  $mailData["rcp_to"] = urldecode($_GET["rcp"]);
589  break;
590 
591  default:
592  // GET DATA FROM POST
593  $mailData = $_POST;
594 
595  // strip slashes
596  foreach ($mailData as $key => $value)
597  {
598  if (is_string($value))
599  {
600  // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
601  $mailData[$key] = ilUtil::securePlainString($value);
602  }
603  }
604  break;
605  }
606 
607  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
608 
609  $form_gui = new ilPropertyFormGUI();
610  $form_gui->setTitle($this->lng->txt('compose'));
611  $form_gui->setOpenTag(false);
612  $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'sendMessage'));
613 
614  $this->tpl->setVariable('BUTTON_TO', $lng->txt("search_recipients"));
615  $this->tpl->setVariable('BUTTON_COURSES_TO', $lng->txt("mail_my_courses"));
616  $this->tpl->setVariable('BUTTON_GROUPS_TO', $lng->txt("mail_my_groups"));
617  $this->tpl->setVariable('BUTTON_MAILING_LISTS_TO', $lng->txt("mail_my_mailing_lists"));
618 
619  $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true);
620 
621  // RECIPIENT
622  $inp = new ilTextInputGUI($this->lng->txt('mail_to'), 'rcp_to');
623  $inp->setRequired(true);
624  $inp->setSize(50);
625  $inp->setValue($mailData["rcp_to"]);
626  $inp->setDataSource($dsDataLink, ",");
627  $inp->setMaxLength(null);
628  $form_gui->addItem($inp);
629 
630  // CC
631  $inp = new ilTextInputGUI($this->lng->txt('cc'), 'rcp_cc');
632  $inp->setSize(50);
633  $inp->setValue($mailData["rcp_cc"]);
634  $inp->setDataSource($dsDataLink, ",");
635  $inp->setMaxLength(null);
636  $form_gui->addItem($inp);
637 
638  // BCC
639  $inp = new ilTextInputGUI($this->lng->txt('bc'), 'rcp_bcc');
640  $inp->setSize(50);
641  $inp->setValue($mailData["rcp_bcc"]);
642  $inp->setDataSource($dsDataLink, ",");
643  $inp->setMaxLength(null);
644  $form_gui->addItem($inp);
645 
646  // SUBJECT
647  $inp = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
648  $inp->setSize(50);
649  $inp->setRequired(true);
650  $inp->setValue($mailData["m_subject"]);
651  $form_gui->addItem($inp);
652 
653  // Attachments
654  include_once 'Services/Mail/classes/class.ilMailFormAttachmentFormPropertyGUI.php';
655  $att = new ilMailFormAttachmentPropertyGUI($this->lng->txt( ($mailData["attachments"]) ? 'edit' : 'add' ));
656 
657 
658  if (is_array($mailData["attachments"]) && count($mailData["attachments"]))
659  {
660  foreach($mailData["attachments"] as $data)
661  {
662  if(is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data))
663  {
664  $hidden = new ilHiddenInputGUI('attachments[]');
665  $form_gui->addItem($hidden);
666  $size = filesize($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data);
667  $label = $data . " [" . ilFormat::formatSize($size) . "]";
668  $att->addItem($label);
669  $hidden->setValue(urlencode($data));
670  }
671  }
672  }
673  $form_gui->addItem($att);
674 
675  // ONLY IF SYSTEM MAILS ARE ALLOWED
676  if($rbacsystem->checkAccess("system_message",$this->umail->getMailObjectReferenceId()))
677  {
678  $chb = new ilCheckboxInputGUI($this->lng->txt('type'), 'm_type[]');
679  $chb->setOptionTitle($this->lng->txt('system_message'));
680  $chb->setValue('system');
681  $chb->setChecked(false);
682  if(is_array($mailData["m_type"]) and in_array('system',$mailData["m_type"]))
683  {
684  $chb->setChecked(true);
685  }
686  $form_gui->addItem($chb);
687  }
688 
689 
690  // MESSAGE
691  $inp = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
692  //$inp->setValue(htmlspecialchars($mailData["m_message"], false));
693  $inp->setValue($mailData["m_message"]);
694  $inp->setRequired(false);
695  $inp->setCols(60);
696  $inp->setRows(10);
697 
698  // PLACEHOLDERS
699  $chb = new ilCheckboxInputGUI($this->lng->txt('activate_serial_letter_placeholders'), 'use_placeholders');
700  $chb->setOptionTitle($this->lng->txt('activate_serial_letter_placeholders'));
701  $chb->setValue(1);
702  $chb->setChecked(false);
703  $form_gui->addItem($inp);
704 
705  include_once 'Services/Mail/classes/class.ilMailFormPlaceholdersPropertyGUI.php';
706  $prop = new ilMailFormPlaceholdersPropertyGUI();
707 
708  $chb->addSubItem($prop);
709 
710  if ($mailData['use_placeholders'])
711  {
712  $chb->setChecked(true);
713  }
714 
715  $form_gui->addItem($chb);
716 
717  $form_gui->addCommandButton('sendMessage', $this->lng->txt('send_mail'));
718  $form_gui->addCommandButton('saveDraft', $this->lng->txt('save_message'));
720  $form_gui->addCommandButton('cancelMail', $this->lng->txt('cancel'));
721 
722  $this->tpl->parseCurrentBlock();
723 
724  $this->tpl->setVariable('FORM', $form_gui->getHTML());
725 
726  $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
727  $this->tpl->show();
728  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$size
Definition: RandomTest.php:79
$_POST['username']
Definition: cron.php:12
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
This class represents a property form user interface.
$_GET["client_id"]
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a hidden form property in a property form.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
This class represents a text area property in a property form.
static getSignature()
Get preset signature.
setOptionTitle($a_optiontitle)
Set Option Title (optional).
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilMailFormGUI::$ctrl = null
private

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

◆ $lng

ilMailFormGUI::$lng = null
private

Definition at line 21 of file class.ilMailFormGUI.php.

Referenced by __construct(), and showForm().

◆ $mbox

ilMailFormGUI::$mbox = null
private

Definition at line 24 of file class.ilMailFormGUI.php.

◆ $mfile

ilMailFormGUI::$mfile = null
private

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

◆ $tpl

ilMailFormGUI::$tpl = null
private

Definition at line 19 of file class.ilMailFormGUI.php.

Referenced by __construct().

◆ $umail

ilMailFormGUI::$umail = null
private

Definition at line 23 of file class.ilMailFormGUI.php.


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