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 define("IL_MAIL_LOCAL", 0);
00025 define("IL_MAIL_EMAIL", 1);
00026 define("IL_MAIL_BOTH", 2);
00027
00037 class ilMailOptions
00038 {
00039 var $ilias;
00040
00041
00042 var $LOCAL = 0;
00043 var $EMAIL = 1;
00044 var $BOTH = 2;
00045
00051 var $linebreak;
00052
00058 var $signature;
00059 var $incoming_type;
00060 var $cronjob_notification;
00061
00068 function ilMailOptions($a_user_id)
00069 {
00070 global $ilias;
00071
00072 define("DEFAULT_LINEBREAK",60);
00073
00074 $this->ilias =& $ilias;
00075 $this->table_mail_options = 'mail_options';
00076
00077 $this->user_id = $a_user_id;
00078 $this->getOptions();
00079 }
00080
00087 function createMailOptionsEntry()
00088 {
00089 global $ilDB;
00090
00091
00092 if (!($incomingMail = $this->ilias->getSetting("mail_incoming_mail")))
00093 {
00094
00095 $incomingMail = IL_MAIL_BOTH;
00096 }
00097
00098 $query = "INSERT INTO $this->table_mail_options " .
00099 "VALUES(" . $ilDB->quote($this->user_id) . ", " .
00100 $ilDB->quote(DEFAULT_LINEBREAK) . ", '', " .
00101 $ilDB->quote($incomingMail) . ", '0')";
00102
00103 $res = $this->ilias->db->query($query);
00104 return true;
00105 }
00106
00114 function getOptions()
00115 {
00116 global $ilDB;
00117
00118 $query = "SELECT * FROM $this->table_mail_options ".
00119 "WHERE user_id = ".$ilDB->quote($this->user_id)." ";
00120
00121 $row = $this->ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
00122
00123 $this->cronjob_notification = stripslashes($row->cronjob_notification);
00124 $this->signature = stripslashes($row->signature);
00125 $this->linebreak = stripslashes($row->linebreak);
00126 $this->incoming_type = $row->incoming_type;
00127
00128 if(!strlen(ilObjUser::_lookupEmail($this->user_id)))
00129 {
00130 $this->incoming_type = $this->LOCAL;
00131 }
00132
00133 return true;
00134 }
00135
00144 function updateOptions($a_signature, $a_linebreak, $a_incoming_type, $a_cronjob_notification)
00145 {
00146 global $ilDB, $ilias;
00147
00148 $query = 'UPDATE '.$this->table_mail_options.'
00149 SET
00150 signature = '.$ilDB->quote($a_signature).',
00151 linebreak = '.$ilDB->quote($a_linebreak).', ';
00152 if ($ilias->getSetting('mail_notification'))
00153 {
00154 $query .= 'cronjob_notification = '.$ilDB->quote($a_cronjob_notification).', ';
00155 }
00156
00157 $query .='incoming_type = '.$ilDB->quote($a_incoming_type).'
00158 WHERE 1
00159 AND user_id = '.$ilDB->quote($this->user_id).' ';
00160
00161 $res = $this->ilias->db->query($query);
00162
00163 $this->cronjob_notification = $a_cronjob_notification;
00164 $this->signature = $a_signature;
00165 $this->linebreak = $a_linebreak;
00166 $this->incoming_type = $a_incoming_type;
00167
00168 return true;
00169 }
00175 function getLinebreak()
00176 {
00177 return $this->linebreak;
00178 }
00179
00185 function getSignature()
00186 {
00187 return $this->signature;
00188 }
00189
00190 function getIncomingType()
00191 {
00192 return $this->incoming_type;
00193 }
00194
00195 function setCronjobNotification()
00196 {
00197 return $this->cronjob_notification;
00198 }
00199 function getCronjobNotification()
00200 {
00201 return $this->cronjob_notification;
00202 }
00203
00204
00205 }
00206 ?>