ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailAttachmentGUI Class Reference
+ Collaboration diagram for ilMailAttachmentGUI:

Public Member Functions

 executeCommand ()
 
 cancelSaveAttachments ()
 
 deleteAttachments ()
 
 confirmDeleteAttachments ()
 

Protected Member Functions

 getToolbarForm ()
 

Private Attributes

 $tpl
 
 $ctrl
 
 $lng
 
 $umail
 
 $mfile
 

Detailed Description

Author
Jens Conze
Version
$Id$

Definition at line 12 of file class.ilMailAttachmentGUI.php.

Member Function Documentation

◆ cancelSaveAttachments()

ilMailAttachmentGUI::cancelSaveAttachments ( )

Definition at line 114 of file class.ilMailAttachmentGUI.php.

115  {
116  $this->ctrl->setParameter($this, 'type', 'attach');
117  $this->ctrl->returnToParent($this);
118  }

◆ confirmDeleteAttachments()

ilMailAttachmentGUI::confirmDeleteAttachments ( )

Definition at line 147 of file class.ilMailAttachmentGUI.php.

References $_POST, $error, $files, array, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

148  {
149  if(!isset($_POST['filename']) || !is_array($_POST['filename']) || !$_POST['filename'])
150  {
151  ilUtil::sendInfo($this->lng->txt('mail_select_one_mail'));
152  $this->showAttachments();
153  return true;
154  }
155 
156  $files = array();
157  foreach($_POST['filename'] as $value)
158  {
159  $files[] = urldecode($value);
160  }
161 
162  if(strlen(($error = $this->mfile->unlinkFiles($files))))
163  {
164  ilUtil::sendFailure($this->lng->txt('mail_error_delete_file') . ' ' . $error);
165  }
166  else
167  {
168  $mailData = $this->umail->getSavedData();
169  if(is_array($mailData['attachments']))
170  {
171  $tmp = array();
172  for($i = 0; $i < count($mailData['attachments']); $i++)
173  {
174  if(!in_array($mailData['attachments'][$i], $files))
175  {
176  $tmp[] = $mailData['attachments'][$i];
177  }
178  }
179  $this->umail->saveAttachments($tmp);
180  }
181 
182  ilUtil::sendSuccess($this->lng->txt('mail_files_deleted'));
183  }
184 
185  $this->showAttachments();
186  }
$files
Definition: add-vimline.php:18
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$error
Definition: Error.php:17
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteAttachments()

ilMailAttachmentGUI::deleteAttachments ( )

Definition at line 120 of file class.ilMailAttachmentGUI.php.

References $_POST, $filename, ilUtil\sendFailure(), and ilUtil\stripSlashes().

121  {
122  if(!isset($_POST['filename']) || !is_array($_POST['filename']) || !$_POST['filename'])
123  {
124  ilUtil::sendFailure($this->lng->txt('mail_select_one_file'));
125  $this->showAttachments();
126  return;
127  }
128 
129  $this->tpl->setTitle($this->lng->txt('mail'));
130 
131  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
132  $confirmation = new ilConfirmationGUI();
133  $confirmation->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteAttachments'));
134  $confirmation->setConfirm($this->lng->txt('confirm'), 'confirmDeleteAttachments');
135  $confirmation->setCancel($this->lng->txt('cancel'), 'showAttachments');
136  $confirmation->setHeaderText($this->lng->txt('mail_sure_delete_file'));
137 
138  foreach($_POST['filename'] as $filename)
139  {
140  $confirmation->addItem('filename[]', ilUtil::stripSlashes($filename), ilUtil::stripSlashes(urldecode($filename)));
141  }
142 
143  $this->tpl->setContent($confirmation->getHtml());
144  $this->tpl->show();
145  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailAttachmentGUI::executeCommand ( )

Definition at line 59 of file class.ilMailAttachmentGUI.php.

References $_POST, $cmd, $file, $files, $ilUser, array, ilUtil\formatSize(), and ilUtil\sendFailure().

60  {
61  $forward_class = $this->ctrl->getNextClass($this);
62  switch($forward_class)
63  {
64  default:
65  if(!($cmd = $this->ctrl->getCmd()))
66  {
67  $cmd = 'showAttachments';
68  }
69 
70  $this->$cmd();
71  break;
72  }
73  return true;
74  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getToolbarForm()

ilMailAttachmentGUI::getToolbarForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 191 of file class.ilMailAttachmentGUI.php.

References $counter, $data, $file, $files, $lng, array, ilUtil\formatSize(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilFormPropertyGUI\setRequired().

192  {
193  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
194  $form = new ilPropertyFormGUI();
195  $attachment = new ilFileInputGUI($this->lng->txt('upload'), 'userfile');
196  $attachment->setRequired(true);
197  $attachment->setSize(20);
198  $form->addItem($attachment);
199  return $form;
200  }
This class represents a property form user interface.
This class represents a file property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilMailAttachmentGUI::$ctrl
private

Definition at line 22 of file class.ilMailAttachmentGUI.php.

◆ $lng

ilMailAttachmentGUI::$lng
private

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

Referenced by getToolbarForm().

◆ $mfile

ilMailAttachmentGUI::$mfile
private

Definition at line 37 of file class.ilMailAttachmentGUI.php.

◆ $tpl

ilMailAttachmentGUI::$tpl
private

Definition at line 17 of file class.ilMailAttachmentGUI.php.

◆ $umail

ilMailAttachmentGUI::$umail
private

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


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