- 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 152 of file class.ilMailAttachmentGUI.php.
References ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and showAttachments().
155 if ($this->
http->wrapper()->post()->has(
'filename')) {
156 $files = $this->
http->wrapper()->post()->retrieve(
163 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'mail_select_one_mail'));
169 foreach ($files as $value) {
170 $decodedFiles[] = urldecode($value);
173 $error = $this->mfile->unlinkFiles($decodedFiles);
175 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_error_delete_file') .
' ' . $error);
177 $mail_data = $this->umail->retrieveFromStage();
178 if (is_array($mail_data[
'attachments'])) {
180 foreach ($mail_data[
'attachments'] as $attachment) {
181 if (!in_array($attachment, $decodedFiles,
true)) {
182 $tmp[] = $attachment;
185 $this->umail->saveAttachments($tmp);
188 $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 117 of file class.ilMailAttachmentGUI.php.
References $filename, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), showAttachments(), and ilUtil\stripSlashes().
120 if ($this->
http->wrapper()->post()->has(
'filename')) {
121 $files = $this->
http->wrapper()->post()->retrieve(
127 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_select_one_file'));
132 $this->tpl->setTitle($this->
lng->txt(
'mail'));
135 $confirmation->setFormAction($this->
ctrl->getFormAction($this,
'confirmDeleteAttachments'));
136 $confirmation->setConfirm($this->
lng->txt(
'confirm'),
'confirmDeleteAttachments');
137 $confirmation->setCancel($this->
lng->txt(
'cancel'),
'showAttachments');
138 $confirmation->setHeaderText($this->
lng->txt(
'mail_sure_delete_file'));
141 $confirmation->addItem(
148 $this->tpl->setContent($confirmation->getHTML());
149 $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.
◆ executeCommand()
| ilMailAttachmentGUI::executeCommand |
( |
| ) |
|
◆ getToolbarForm()
| ilMailAttachmentGUI::getToolbarForm |
( |
| ) |
|
|
protected |
◆ saveAttachments()
| ilMailAttachmentGUI::saveAttachments |
( |
| ) |
|
Definition at line 67 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().
74 $sizeOfSelectedFiles = 0;
76 if ($this->
http->wrapper()->post()->has(
'filename')) {
77 $filesOfRequest = $this->
http->wrapper()->post()->retrieve(
83 foreach ($filesOfRequest as $file) {
84 if (is_file($this->mfile->getMailPath() .
'/' 85 . basename($this->
user->getId() .
'_' . urldecode($file)))
87 $files[] = urldecode($file);
88 $sizeOfSelectedFiles += filesize(
89 $this->mfile->getMailPath() .
'/' .
90 basename($this->
user->getId() .
'_' . urldecode($file))
97 null !== $this->mfile->getAttachmentsTotalSizeLimit() &&
98 $sizeOfSelectedFiles > $this->mfile->getAttachmentsTotalSizeLimit()
100 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_max_size_attachments_total_error') .
' ' .
106 $this->umail->saveAttachments($files);
108 $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 228 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().
230 $this->tpl->setTitle($this->
lng->txt(
'mail'));
234 $attachment->setSize(20);
235 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
'uploadFile'),
true);
236 $this->
toolbar->addInputItem($attachment);
237 $this->
toolbar->addFormButton($this->
lng->txt(
'upload'),
'uploadFile');
241 $mail_data = $this->umail->retrieveFromStage();
242 $files = $this->mfile->getUserFilesData();
245 foreach ($files as $file) {
247 if (is_array($mail_data[
'attachments']) && in_array($file[
'name'], $mail_data[
'attachments'],
true)) {
252 'checked' => $checked,
253 'filename' => $file[
'name'],
254 'filesize' => (
int) $file[
'size'],
255 'filecreatedate' => (
int) $file[
'ctime'],
260 $table->setData(
$data);
262 $this->tpl->setContent($table->getHTML());
263 $this->tpl->printToStdout();
◆ uploadFile()
| ilMailAttachmentGUI::uploadFile |
( |
| ) |
|
Definition at line 206 of file class.ilMailAttachmentGUI.php.
References ilUtil\formatSize(), getToolbarForm(), ILIAS\Repository\lng(), and showAttachments().
208 if (isset($_FILES[
'userfile'][
'name']) && trim($_FILES[
'userfile'][
'name']) !==
'') {
210 if ($form->checkInput()) {
211 $this->mfile->storeUploadedFile($_FILES[
'userfile']);
212 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
213 } elseif ($form->getItemByPostVar(
'userfile')->getAlert() !==
214 $this->
lng->txt(
"form_msg_file_size_exceeds")
216 $this->tpl->setOnScreenMessage(
'failure', $form->getItemByPostVar(
'userfile')->getAlert());
218 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mail_maxsize_attachment_error') .
' ' .
222 $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
| readonly Refinery ilMailAttachmentGUI::$refinery |
|
private |
◆ $toolbar
◆ $tpl
◆ $umail
◆ $user
| readonly ilObjUser ilMailAttachmentGUI::$user |
|
private |
The documentation for this class was generated from the following file: