• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

mail_attachment.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00033 require_once "./include/inc.header.php";
00034 require_once "./include/inc.mail.php";
00035 require_once "classes/class.ilFormatMail.php";
00036 require_once "classes/class.ilFileDataMail.php";
00037 
00038 $lng->loadLanguageModule("mail");
00039 $lng->loadLanguageModule("forum");
00040 
00041 $mfile = new ilFileDataMail($_SESSION["AccountId"]);
00042 
00043 // GET SAVED DATA
00044 $umail = new ilFormatMail($_SESSION["AccountId"]);
00045 $mail_data = $umail->getSavedData();
00046 
00047 $_POST["filename"] = $_POST["filename"] ? $_POST["filename"] : array();
00048 
00049 $tpl->addBlockFile("CONTENT", "content", "tpl.mail_attachment.html");
00050 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00051 $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachment"));
00052 infoPanel();
00053 
00054 // LOCATOR
00055 setLocator($_GET["mobj_id"],$_SESSION["AccountId"],"");
00056 
00057 if(isset($_POST["attachment"]["adopt"]))
00058 {
00059         $umail->saveAttachments($_POST["filename"]);
00060         header("location:mail_new.php?mobj_id=$_GET[mobj_id]&type=attach");
00061         exit();
00062 
00063 }
00064 if(isset($_POST["attachment"]["cancel"]))
00065 {
00066         header("location:mail_new.php?mobj_id=$_GET[mobj_id]&type=attach");
00067         exit;
00068 
00069 }
00070 if(isset($_POST["attachment"]["delete"]))
00071 {
00072         if(!$_POST["filename"])
00073         {
00074                 sendInfo($lng->txt("mail_select_one_file"));
00075                 $error_delete = true;
00076         }
00077         else
00078         {
00079                 sendInfo($lng->txt("mail_sure_delete_file"));
00080         }
00081 }
00082 // UPLOAD FILE
00083 if(isset($_POST["cmd"]["upload"]))
00084 {
00085         if($mfile->storeUploadedFile($_FILES['userfile']) == 1)
00086         {
00087                 sendInfo($lng->txt("mail_maxsize_attachment_error")." ".$mfile->getUploadLimit()." K".$lng->txt("mail_byte"));
00088         }
00089 }
00090 // CONFIRM CANCELED
00091 if(isset($_POST["cmd"]["cancel"]))
00092 {
00093         header("location:mail_attachment.php?mobj_id=$_GET[mobj_id]");
00094         exit;
00095 }
00096 // DELETE CONFIRMED
00097 if(isset($_POST["cmd"]["confirm"]))
00098 {
00099         if(!$_POST["filename"])
00100         {
00101                 sendInfo($lng->txt("mail_select_one_mail"));
00102         }
00103         else if($error = $mfile->unlinkFiles($_POST["filename"]))
00104         {
00105                 sendInfo($lng->txt("mail_error_delete_file")." ".$error);
00106         }
00107         else
00108         {
00109                 sendInfo($lng->txt("mail_files_deleted"));
00110         }
00111 }
00112 
00113 // BUTTONS
00114 include "./include/inc.mail_buttons.php";
00115 
00116 $tpl->setVariable("ACTION","mail_attachment.php?mobj_id=$_GET[mobj_id]");
00117 $tpl->setVariable("UPLOAD","mail_attachment.php?mobj_id=$_GET[mobj_id]");
00118 
00119 // BEGIN CONFIRM_DELETE
00120 if(isset($_POST["attachment"]["delete"]) and !$error_delete and !isset($_POST["cmd"]["confirm"]))
00121 {
00122         $tpl->setCurrentBlock("confirm_delete");
00123         $tpl->setVariable("BUTTON_CONFIRM",$lng->txt("confirm"));
00124         $tpl->setVariable("BUTTON_CANCEL",$lng->txt("cancel"));
00125         $tpl->parseCurrentBlock();
00126 }
00127 
00128 // SET STATIC VARIABLES ;-)
00129 $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachment"));
00130 $tpl->setVariable("TXT_FILENAME",$lng->txt("mail_file_name"));
00131 $tpl->setVariable("TXT_FILESIZE",$lng->txt("mail_file_size"));
00132 $tpl->setVariable("TXT_CREATE_TIME",$lng->txt("forums_thread_create_date"));
00133 $tpl->setVariable("TXT_NEW_FILE",$lng->txt("mail_new_file"));
00134 
00135 // ACTIONS
00136 $tpl->setVariable("BUTTON_ATTACHMENT_ADOPT",$lng->txt("adopt"));
00137 $tpl->setVariable("BUTTON_ATTACHMENT_CANCEL",$lng->txt("cancel"));
00138 $tpl->setVariable("BUTTON_ATTACHMENT_DELETE",$lng->txt("delete"));
00139 
00140 // BUTTONS
00141 $tpl->setVariable("BUTTON_SUBMIT",$lng->txt("submit"));
00142 $tpl->setVariable("BUTTON_UPLOAD",$lng->txt("upload"));
00143 
00144 // BEGIN FILES
00145 if($files = $mfile->getUserFilesData())
00146 {
00147         $counter = 0;
00148         foreach($files as $file)
00149         {
00150                 $tpl->setCurrentBlock('files');
00151                 if(in_array($file["name"],$mail_data["attachments"]) ||
00152                    in_array($file["name"],$_POST["filename"]))
00153                 {
00154                         $tpl->setVariable("CHECKED",'checked');
00155                 }
00156                 $tpl->setVariable('CSSROW',++$counter%2 ? 'tblrow1' : 'tblrow2');
00157                 $tpl->setVariable('FILE_NAME',$file["name"]);
00158                 $tpl->setVariable("NAME",$file["name"]);
00159                 $tpl->setVariable("SIZE",$file["size"]);
00160                 $tpl->setVariable("CTIME",$file["ctime"]);
00161                 $tpl->parseCurrentBlock();
00162         }
00163 }
00164 else
00165 {
00166         $tpl->setCurrentBlock("no_content");
00167         $tpl->setVariable("TXT_ATTACHMENT_NO",$lng->txt("mail_no_attachments_found"));
00168         $tpl->parseCurrentBlock();
00169 }
00170 $tpl->show();
00171 ?>

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1