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

mail_options.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.ilMailbox.php";
00036 require_once "./classes/class.ilFormatMail.php";
00037 
00038 $lng->loadLanguageModule("mail");
00039 
00040 $mbox = new ilMailBox($_SESSION["AccountId"]);
00041 $umail = new ilFormatMail($_SESSION["AccountId"]);
00042 
00043 // catch hack attempts
00044 if (!$rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
00045 {
00046         $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->WARNING);
00047 }
00048 
00049 // CREATE OUTPUT
00050 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00051 $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_options.html");
00052 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00053 $tpl->setCurrentBlock("header_image");
00054 $tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mail_b.gif"));
00055 $tpl->parseCurrentBlock();
00056 
00057 $tpl->setVariable("HEADER",$lng->txt("mail"));
00058 infoPanel();
00059 
00060 setLocator($_GET["mobj_id"],'mail_options.php',$_SESSION["AccountId"],"");
00061 
00062 // RENAME FOLDER
00063 if(isset($_POST["cmd"]["rename"]))
00064 {
00065         $tmp_data = $mbox->getFolderData($_GET["mobj_id"]);
00066         if($tmp_data["title"] != $_POST["folder_name"])
00067         {
00068                 if($mbox->renameFolder($_GET["mobj_id"],$_POST["folder_name"]))
00069                 {
00070                         sendInfo($lng->txt("mail_folder_name_changed"));
00071                 }
00072                 else
00073                 {
00074                         sendInfo($lng->txt("mail_folder_exists"));
00075                 }
00076         }
00077 }
00078 // DELETE FOLDER ask for confirmation
00079 if(isset($_POST["cmd"]["delete"]))
00080 {
00081         sendInfo($lng->txt("mail_sure_delete_folder"));
00082 }
00083 
00084 
00085 // SAVE OPTIONS
00086 if(isset($_POST["cmd"]["save"]))
00087 {
00088         $umail->mail_options->updateOptions($_POST["signature"],(int) $_POST["linebreak"],(int) $_POST["incoming_type"]);
00089         sendInfo($lng->txt("mail_options_saved"),true);
00090         header("location: mail.php?mobj_id=$_GET[mobj_id]");
00091         exit;
00092 }
00093         
00094 
00095 // GET FOLDER DATA
00096 $folder_data = $mbox->getFolderData($_GET["mobj_id"]);
00097 
00098 include "./include/inc.mail_buttons.php";
00099 
00100 $tpl->setVariable("TXT_MAIL", $lng->txt("mail"));
00101 
00102 $tpl->setCurrentBlock("content");
00103 
00104 // CONFIRM DELETE
00105 if(isset($_POST["cmd"]["delete"]))
00106 {
00107         $tpl->setCurrentBlock("confirm_delete");
00108         $tpl->setVariable("ACTION_DELETE","mail_frameset.php?mobj_id=$_GET[mobj_id]");
00109         $tpl->setVariable("TXT_DELETE_CONFIRM",$lng->txt("confirm"));
00110         $tpl->setVariable("TXT_DELETE_CANCEL",$lng->txt("cancel"));
00111         $tpl->parseCurrentBlock();
00112 }
00113 
00114 // FORM EDIT FOLDER
00115 if($folder_data["type"] == 'user_folder' and !isset($_POST["cmd"]["delete"]))
00116 {
00117         $tpl->setCurrentBlock('edit');
00118         $tpl->setVariable("FOLDER_OPTIONS",$lng->txt("mail_folder_options"));
00119         $tpl->setVariable("TXT_DELETE",$lng->txt("delete"));
00120         $tpl->setVariable("ACTION","mail_options.php?mobj_id=".$_GET["mobj_id"]);
00121         $tpl->setVariable("TXT_NAME",$lng->txt("mail_folder_name"));
00122         $tpl->setVariable("FOLDER_NAME",$folder_data["title"]);
00123         $tpl->setVariable("TXT_RENAME",$lng->txt("rename"));
00124         $tpl->parseCurrentBlock();
00125 }
00126 
00127 // FORM ADD FOLDER
00128 if(($folder_data["type"] == 'user_folder' or $folder_data["type"] == 'local') 
00129         and !isset($_POST["cmd"]["delete"]))
00130 {
00131         $tpl->setCurrentBlock('add');
00132         $tpl->setVariable("ACTION_ADD","mail_frameset.php?mobj_id=$_GET[mobj_id]");
00133         $tpl->setVariable("TXT_NAME_ADD",$lng->txt("mail_folder_name"));
00134         $tpl->setVariable("TXT_FOLDER_ADD",$lng->txt("add"));
00135         $tpl->parseCurrentBlock();
00136 }
00137 
00138 // FORM GLOBAL OPTIONS
00139 if(!isset($_POST["cmd"]["delete"]))
00140 {
00141         $tpl->setCurrentBlock("options");
00142 
00143         // BEGIN INCOMING
00144         $tpl->setCurrentBlock("option_inc_line");
00145 
00146         $inc = array($lng->txt("mail_incoming_local"),$lng->txt("mail_incoming_smtp"),$lng->txt("mail_incoming_both"));
00147         foreach($inc as $key => $option)
00148         {
00149                 $tpl->setVariable("OPTION_INC_VALUE",$key);
00150                 $tpl->setVariable("OPTION_INC_NAME",$option);
00151                 $tpl->setVariable("OPTION_INC_SELECTED",$umail->mail_options->getIncomingType() == $key ? "selected=\"selected\"" : "");
00152                 $tpl->parseCurrentBlock();
00153         }
00154 
00155         // BEGIN LINEBREAK_OPTIONS
00156         $tpl->setCurrentBlock("option_line");
00157         $linebreak = $umail->mail_options->getLinebreak();
00158         
00159         for($i = 50; $i <= 80;$i++)
00160         {
00161                 $tpl->setVariable("OPTION_VALUE",$i);
00162                 $tpl->setVariable("OPTION_NAME",$i);
00163                 if( $i == $linebreak)
00164                 {
00165                         $tpl->setVariable("OPTION_SELECTED","selected");
00166                 }
00167                 $tpl->parseCurrentBlock();
00168         }
00169         $tpl->setVariable("GLOBAL_OPTIONS",$lng->txt("mail_global_options"));
00170         $tpl->setVariable("TXT_INCOMING", $lng->txt("mail_incoming"));
00171         $tpl->setVariable("TXT_LINEBREAK", $lng->txt("linebreak"));
00172         $tpl->setVariable("TXT_SIGNATURE", $lng->txt("signature"));
00173         $tpl->setVariable("CONTENT",$umail->mail_options->getSignature());
00174         $tpl->setVariable("TXT_SAVE", $lng->txt("save"));
00175         $tpl->parseCurrentBlock();
00176 }
00177 $tpl->show();
00178 ?>

Generated on Fri Dec 13 2013 11:57:58 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1