4 require_once
"Services/Mail/classes/class.ilFormatMail.php";
5 require_once
"Services/Mail/classes/class.ilFileDataMail.php";
53 $this->tpl = $DIC->ui()->mainTemplate();
54 $this->ctrl = $DIC->ctrl();
55 $this->lng = $DIC->language();
56 $this->
user = $DIC->user();
57 $this->toolbar = $DIC->toolbar();
59 $this->ctrl->saveParameter($this,
'mobj_id');
67 $forward_class = $this->ctrl->getNextClass($this);
68 switch ($forward_class) {
70 if (!($cmd = $this->ctrl->getCmd())) {
71 $cmd =
'showAttachments';
86 $size_of_selected_files = 0;
87 if (is_array(
$_POST[
'filename']) && count(
$_POST[
'filename']) > 0) {
88 foreach (
$_POST[
'filename'] as $file) {
89 if (file_exists($this->mfile->getMailPath() .
'/' . basename($this->
user->getId() .
'_' . urldecode($file)))) {
90 $files[] = urldecode($file);
91 $size_of_selected_files += filesize($this->mfile->getMailPath() .
'/' . basename($this->
user->getId() .
'_' . urldecode($file)));
97 null !== $this->mfile->getAttachmentsTotalSizeLimit() &&
98 $files && $size_of_selected_files > $this->mfile->getAttachmentsTotalSizeLimit()
105 $this->umail->saveAttachments(
$files);
107 $this->ctrl->returnToParent($this);
112 $this->ctrl->setParameter($this,
'type',
'attach');
113 $this->ctrl->returnToParent($this);
118 if (!isset(
$_POST[
'filename']) || !is_array(
$_POST[
'filename']) || !
$_POST[
'filename']) {
124 $this->tpl->setTitle($this->lng->txt(
'mail'));
126 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
128 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'confirmDeleteAttachments'));
129 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'confirmDeleteAttachments');
130 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showAttachments');
131 $confirmation->setHeaderText($this->lng->txt(
'mail_sure_delete_file'));
137 $this->tpl->setContent($confirmation->getHtml());
143 if (!isset(
$_POST[
'filename']) || !is_array(
$_POST[
'filename']) || !
$_POST[
'filename']) {
150 foreach (
$_POST[
'filename'] as $value) {
151 $files[] = urldecode($value);
154 if (strlen(($error = $this->mfile->unlinkFiles(
$files)))) {
157 $mailData = $this->umail->getSavedData();
158 if (is_array($mailData[
'attachments'])) {
160 for (
$i = 0;
$i < count($mailData[
'attachments']);
$i++) {
161 if (!in_array($mailData[
'attachments'][
$i],
$files)) {
162 $tmp[] = $mailData[
'attachments'][
$i];
165 $this->umail->saveAttachments($tmp);
168 ilUtil::sendSuccess($this->lng->txt(
'mail_files_deleted'));
179 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
181 $attachment =
new ilFileInputGUI($this->lng->txt(
'upload'),
'userfile');
183 $attachment->setSize(20);
184 $form->addItem($attachment);
190 if (strlen(trim($_FILES[
'userfile'][
'name']))) {
192 if (
$form->checkInput()) {
193 $this->mfile->storeUploadedFile($_FILES[
'userfile']);
194 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
196 if (
$form->getItemByPostVar(
'userfile')->getAlert() != $this->lng->txt(
"form_msg_file_size_exceeds")) {
211 $this->tpl->setTitle($this->lng->txt(
'mail'));
213 require_once
'Services/Form/classes/class.ilFileInputGUI.php';
214 $attachment =
new ilFileInputGUI($this->lng->txt(
'upload'),
'userfile');
216 $attachment->setSize(20);
217 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'uploadFile'),
true);
218 $this->toolbar->addInputItem($attachment);
219 $this->toolbar->addFormButton($this->lng->txt(
'upload'),
'uploadFile');
221 require_once
'Services/Mail/classes/class.ilMailAttachmentTableGUI.php';
224 $mailData = $this->umail->getSavedData();
225 $files = $this->mfile->getUserFilesData();
228 foreach (
$files as $file) {
230 if (is_array($mailData[
'attachments']) && in_array($file[
'name'], $mailData[
'attachments'])) {
234 $data[$counter] = array(
235 'checked' => $checked,
236 'filename' => $file[
'name'],
237 'filesize' => (
int) $file[
'size'],
238 'filecreatedate' => (
int) $file[
'ctime']
245 $this->tpl->setContent(
$table->getHtml());
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
confirmDeleteAttachments()
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.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
if(empty($password)) $table
Confirmation screen class.