- Author
- Jens Conze
- Version
- $Id$
Definition at line 29 of file class.ilMailAttachmentGUI.php.
◆ __construct()
ilMailAttachmentGUI::__construct |
( |
| ) |
|
◆ cancelSaveAttachments()
ilMailAttachmentGUI::cancelSaveAttachments |
( |
| ) |
|
◆ confirmDeleteAttachments()
ilMailAttachmentGUI::confirmDeleteAttachments |
( |
| ) |
|
Definition at line 158 of file class.ilMailAttachmentGUI.php.
References ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and showAttachments().
161 if ($this->
http->wrapper()->post()->has(
'filename')) {
162 $files = $this->
http->wrapper()->post()->retrieve(
169 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'mail_select_one_mail'));
175 foreach ($files as $value) {
176 $decodedFiles[] = urldecode($value);
179 $error = $this->mfile->unlinkFiles($decodedFiles);
181 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_error_delete_file') .
' ' . $error);
183 $mail_data = $this->umail->retrieveFromStage();
184 if (is_array($mail_data[
'attachments'])) {
186 foreach ($mail_data[
'attachments'] as $attachment) {
187 if (!in_array($attachment, $decodedFiles,
true)) {
188 $tmp[] = $attachment;
191 $this->umail->saveAttachments($tmp);
194 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'mail_files_deleted'));
static http()
Fetches the global http state from ILIAS.
◆ deleteAttachments()
ilMailAttachmentGUI::deleteAttachments |
( |
| ) |
|
Definition at line 123 of file class.ilMailAttachmentGUI.php.
References $filename, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), showAttachments(), and ilUtil\stripSlashes().
126 if ($this->
http->wrapper()->post()->has(
'filename')) {
127 $files = $this->
http->wrapper()->post()->retrieve(
133 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_select_one_file'));
138 $this->tpl->setTitle($this->
lng->txt(
'mail'));
141 $confirmation->setFormAction($this->
ctrl->getFormAction($this,
'confirmDeleteAttachments'));
142 $confirmation->setConfirm($this->
lng->txt(
'confirm'),
'confirmDeleteAttachments');
143 $confirmation->setCancel($this->
lng->txt(
'cancel'),
'showAttachments');
144 $confirmation->setHeaderText($this->
lng->txt(
'mail_sure_delete_file'));
147 $confirmation->addItem(
154 $this->tpl->setContent($confirmation->getHTML());
155 $this->tpl->printToStdout();
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ executeCommand()
ilMailAttachmentGUI::executeCommand |
( |
| ) |
|
◆ getToolbarForm()
ilMailAttachmentGUI::getToolbarForm |
( |
| ) |
|
|
protected |
◆ saveAttachments()
ilMailAttachmentGUI::saveAttachments |
( |
| ) |
|
Definition at line 73 of file class.ilMailAttachmentGUI.php.
References ILIAS\Repository\ctrl(), ilUtil\formatSize(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), showAttachments(), and ILIAS\Repository\user().
80 $sizeOfSelectedFiles = 0;
82 if ($this->
http->wrapper()->post()->has(
'filename')) {
83 $filesOfRequest = $this->
http->wrapper()->post()->retrieve(
89 foreach ($filesOfRequest as $file) {
90 if (is_file($this->mfile->getMailPath() .
'/' 91 . basename($this->
user->getId() .
'_' . urldecode($file)))
93 $files[] = urldecode($file);
94 $sizeOfSelectedFiles += filesize(
95 $this->mfile->getMailPath() .
'/' .
96 basename($this->
user->getId() .
'_' . urldecode($file))
103 null !== $this->mfile->getAttachmentsTotalSizeLimit() &&
104 $sizeOfSelectedFiles > $this->mfile->getAttachmentsTotalSizeLimit()
106 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_max_size_attachments_total_error') .
' ' .
112 $this->umail->saveAttachments($files);
114 $this->
ctrl->returnToParent($this);
static http()
Fetches the global http state from ILIAS.
static formatSize(int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
Returns the specified file size value in a human friendly form.
◆ showAttachments()
ilMailAttachmentGUI::showAttachments |
( |
| ) |
|
Definition at line 234 of file class.ilMailAttachmentGUI.php.
References $data, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilFormPropertyGUI\setRequired(), and ILIAS\Repository\toolbar().
Referenced by confirmDeleteAttachments(), deleteAttachments(), saveAttachments(), and uploadFile().
236 $this->tpl->setTitle($this->
lng->txt(
'mail'));
240 $attachment->setSize(20);
241 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
'uploadFile'),
true);
242 $this->
toolbar->addInputItem($attachment);
243 $this->
toolbar->addFormButton($this->
lng->txt(
'upload'),
'uploadFile');
247 $mail_data = $this->umail->retrieveFromStage();
248 $files = $this->mfile->getUserFilesData();
251 foreach ($files as $file) {
253 if (is_array($mail_data[
'attachments']) && in_array($file[
'name'], $mail_data[
'attachments'],
true)) {
258 'checked' => $checked,
259 'filename' => $file[
'name'],
260 'filesize' => (
int) $file[
'size'],
261 'filecreatedate' => (
int) $file[
'ctime'],
266 $table->setData(
$data);
268 $this->tpl->setContent($table->getHTML());
269 $this->tpl->printToStdout();
◆ uploadFile()
ilMailAttachmentGUI::uploadFile |
( |
| ) |
|
Definition at line 212 of file class.ilMailAttachmentGUI.php.
References ilUtil\formatSize(), getToolbarForm(), ILIAS\Repository\lng(), and showAttachments().
214 if (isset($_FILES[
'userfile'][
'name']) && trim($_FILES[
'userfile'][
'name']) !==
'') {
216 if ($form->checkInput()) {
217 $this->mfile->storeUploadedFile($_FILES[
'userfile']);
218 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
219 } elseif ($form->getItemByPostVar(
'userfile')->getAlert() !==
220 $this->
lng->txt(
"form_msg_file_size_exceeds")
222 $this->tpl->setOnScreenMessage(
'failure', $form->getItemByPostVar(
'userfile')->getAlert());
224 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_maxsize_attachment_error') .
' ' .
228 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_select_one_file'));
static formatSize(int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
Returns the specified file size value in a human friendly form.
◆ $ctrl
◆ $http
◆ $lng
◆ $mfile
◆ $refinery
Refinery ilMailAttachmentGUI::$refinery |
|
private |
◆ $toolbar
◆ $tpl
◆ $umail
◆ $user
The documentation for this class was generated from the following file: