86 $this->user_id = $a_user_id;
88 $this->db =
$DIC->database();
109 $this->table_mail_options,
111 'user_id' => array(
'integer', $this->user_id),
114 'linebreak' => array(
'integer', (
int) self::DEFAULT_LINE_BREAK),
115 'signature' => array(
'text',
null),
116 'incoming_type' => array(
'integer', $incomingMail),
118 'cronjob_notification' => array(
'integer', 0)
125 $res = $this->db->queryF(
126 'SELECT mail_options.cronjob_notification,
127 mail_options.signature,
128 mail_options.linebreak,
129 mail_options.incoming_type,
130 mail_options.mail_address_option,
132 usr_data.second_email
134 LEFT JOIN usr_data ON mail_options.user_id = usr_data.usr_id
135 WHERE mail_options.user_id = %s',
137 array($this->user_id)
141 $this->cronjob_notification =
$row->cronjob_notification;
142 $this->signature =
$row->signature;
143 $this->linebreak =
$row->linebreak;
144 $this->incoming_type =
$row->incoming_type;
145 $this->mail_address_option = (int)
$row->mail_address_option >= 3 ?
$row->mail_address_option : self::FIRST_EMAIL;
147 $firstMailAddress =
$row->email;
149 $secondMailAddress =
$row->second_email;
151 $this->mailTransportSettings->adjust($firstMailAddress, $secondMailAddress);
160 'linebreak' => array(
'integer', (
int) $this->
getLinebreak()),
165 if ($this->
settings->get(
'mail_notification')) {
168 $data[
'cronjob_notification'] = array(
'integer', (
int) self::lookupNotificationSetting($this->user_id));
171 return $this->db->replace(
172 $this->table_mail_options,
174 'user_id' => array(
'integer', $this->user_id)
268 $query =
"SELECT cronjob_notification FROM mail_options WHERE user_id = " .
$DIC->database()->quote($usr_id,
'integer');
270 return (
int)
$row[
'cronjob_notification'];
280 $emailAddresses = array();
286 } elseif (strlen($user->
getEmail())) {
288 $emailAddresses[] = $user->
getEmail();
294 $emailAddresses[] = $user->
getEmail();
304 $emailAddresses[] = $user->
getEmail();
312 return $emailAddresses;
323 $mail_options =
new self($user->
getId());
An exception for terminatinating execution or to throw for unit testing.
Class ilMailOptions this class handles user mails.
static lookupExternalEmails(ilObjUser $user, ilMailOptions $mail_options)
__construct($a_user_id, ilMailTransportSettings $mailTransportSettings=null)
static getExternalEmailsByUser(ilObjUser $user, ilMailOptions $mail_options=null)
createMailOptionsEntry()
create entry in table_mail_options for a new user this method should only be called from createUser()
setIncomingType($incoming_type)
static getExternalEmailsByUserId($user_id, ilMailOptions $mail_options=null)
setCronjobNotification($cronjob_notification)
setMailAddressOption($mail_address_option)
static lookupNotificationSetting($usr_id)
getEmail()
get email address @access public
getId()
get object id @access public
foreach($_POST as $key=> $value) $res