86 $this->user_id = $a_user_id;
88 $this->db = $DIC->database();
105 $incomingMail = strlen($this->
settings->get(
'mail_incoming_mail')) ? (
int) $this->
settings->get(
'mail_incoming_mail') : self::INCOMING_LOCAL;
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);
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');
269 $row = $DIC->database()->fetchAssoc($DIC->database()->query(
$query));
270 return (
int)
$row[
'cronjob_notification'];
280 $emailAddresses =
array();
283 case self::SECOND_EMAIL:
286 } elseif (strlen($user->
getEmail())) {
288 $emailAddresses[] = $user->
getEmail();
292 case self::BOTH_EMAIL:
294 $emailAddresses[] = $user->
getEmail();
301 case self::FIRST_EMAIL:
304 $emailAddresses[] = $user->
getEmail();
312 return $emailAddresses;
323 $mail_options =
new self($user->
getId());
326 return self::lookupExternalEmails($user, $mail_options);
Class ilMailOptions this class handles user mails.
setMailAddressOption($mail_address_option)
setCronjobNotification($cronjob_notification)
__construct($a_user_id, ilMailTransportSettings $mailTransportSettings=null)
createMailOptionsEntry()
create entry in table_mail_options for a new user this method should only be called from createUser()...
static getExternalEmailsByUser(ilObjUser $user, ilMailOptions $mail_options=null)
static lookupNotificationSetting($usr_id)
getEmail()
get email address public
foreach($_POST as $key=> $value) $res
getId()
get object id public
Create styles array
The data for the language used.
setIncomingType($incoming_type)
static getExternalEmailsByUserId($user_id, ilMailOptions $mail_options=null)
static lookupExternalEmails(ilObjUser $user, ilMailOptions $mail_options)