Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once "Services/Mail/classes/class.ilMailbox.php";
00025 require_once "Services/Mail/classes/class.ilFormatMail.php";
00026
00033 class ilMailOptionsGUI
00034 {
00035 private $tpl = null;
00036 private $ctrl = null;
00037 private $lng = null;
00038
00039 private $umail = null;
00040 private $mbox = null;
00041
00042 private $errorDelete = false;
00043
00044 public function __construct()
00045 {
00046 global $tpl, $ilCtrl, $lng, $ilUser;
00047
00048 $this->tpl = $tpl;
00049 $this->ctrl = $ilCtrl;
00050 $this->lng = $lng;
00051
00052 $this->ctrl->saveParameter($this, "mobj_id");
00053
00054 $this->umail = new ilFormatMail($ilUser->getId());
00055 $this->mbox = new ilMailBox($ilUser->getId());
00056 }
00057
00058 public function executeCommand()
00059 {
00060 $forward_class = $this->ctrl->getNextClass($this);
00061 switch($forward_class)
00062 {
00063 default:
00064 if (!($cmd = $this->ctrl->getCmd()))
00065 {
00066 $cmd = "showOptions";
00067 }
00068
00069 $this->$cmd();
00070 break;
00071 }
00072 return true;
00073 }
00074
00075 public function saveOptions()
00076 {
00077 $this->umail->mail_options->updateOptions(ilUtil::stripSlashes($_POST["signature"]), ilUtil::stripSlashes((int) $_POST["linebreak"]), ilUtil::stripSlashes((int) $_POST["incoming_type"]), ilUtil::stripSlashes((int) $_POST['cronjob_notification']));
00078 # ilUtil::sendInfo($this->lng->txt("mail_options_saved"),true);
00079 # $this->ctrl->redirectByClass("ilmailfoldergui");
00080 ilUtil::sendInfo($this->lng->txt("mail_options_saved"));
00081 $this->showOptions();
00082
00083 }
00084
00085 public function showOptions()
00086 {
00087 global $ilUser, $ilias;
00088
00089 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_options.html", "Services/Mail");
00090 $this->tpl->setVariable("HEADER", $this->lng->txt("mail"));
00091
00092
00093
00094 $this->tpl->setCurrentBlock("options");
00095
00096
00097 $this->tpl->setCurrentBlock("option_inc_line");
00098
00099 $inc = array($this->lng->txt("mail_incoming_local"),$this->lng->txt("mail_incoming_smtp"),$this->lng->txt("mail_incoming_both"));
00100 foreach($inc as $key => $option)
00101 {
00102 $this->tpl->setVariable("OPTION_INC_VALUE",$key);
00103 $this->tpl->setVariable("OPTION_INC_NAME",$option);
00104 $this->tpl->setVariable("OPTION_INC_SELECTED",$this->umail->mail_options->getIncomingType() == $key ? "selected=\"selected\"" : "");
00105 $this->tpl->parseCurrentBlock();
00106 }
00107
00108
00109 $this->tpl->setCurrentBlock("option_line");
00110 $linebreak = $this->umail->mail_options->getLinebreak();
00111
00112 for($i = 50; $i <= 80;$i++)
00113 {
00114 $this->tpl->setVariable("OPTION_VALUE",$i);
00115 $this->tpl->setVariable("OPTION_NAME",$i);
00116 if( $i == $linebreak)
00117 {
00118 $this->tpl->setVariable("OPTION_SELECTED","selected");
00119 }
00120 $this->tpl->parseCurrentBlock();
00121 }
00122
00123 if(!strlen(ilObjUser::_lookupEmail($ilUser->getId())))
00124 {
00125 $this->tpl->setVariable('INC_DISABLED','disabled="disabled"');
00126 }
00127
00128 $this->tpl->setVariable("GLOBAL_OPTIONS",$this->lng->txt("mail_global_options"));
00129 $this->tpl->setVariable("TXT_INCOMING", $this->lng->txt("mail_incoming"));
00130 $this->tpl->setVariable("TXT_LINEBREAK", $this->lng->txt("linebreak"));
00131 $this->tpl->setVariable("TXT_SIGNATURE", $this->lng->txt("signature"));
00132 $this->tpl->setVariable("CONTENT",$this->umail->mail_options->getSignature());
00133
00134 if ($ilias->getSetting("mail_notification"))
00135 {
00136 $this->tpl->setVariable("TXT_CRONJOB_NOTIFICATION", $this->lng->txt("cron_mail_notification"));
00137 $this->tpl->setVariable("TXT_CRONJOB_NOTIFICATION_INFO", $this->lng->txt("mail_cronjob_notification_info"));
00138 if ($this->umail->mail_options->getCronjobNotification())
00139 {
00140 $this->tpl->setVariable("CRONJOB_NOTIFICATION_SELECTED", " checked=\"checked\"");
00141 }
00142 }
00143
00144 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00145
00146 $this->ctrl->setParameter($this, "cmd", "post");
00147 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this));
00148 $this->ctrl->clearParameters($this);
00149
00150 $this->tpl->parseCurrentBlock();
00151
00152 $this->tpl->show();
00153 }
00154
00155 }
00156
00157 ?>