53 $this->user_id = $a_user_id;
55 $this->db = $DIC->database();
72 $this->incoming_type = self::INCOMING_LOCAL;
73 if (strlen($this->
settings->get(
'mail_incoming_mail',
'')) > 0) {
74 $this->incoming_type = (int) $this->
settings->get(
'mail_incoming_mail');
77 $this->mail_address_option = self::FIRST_EMAIL;
78 if (strlen($this->
settings->get(
'mail_address_option',
'')) > 0) {
79 $this->mail_address_option = (int) $this->
settings->get(
'mail_address_option');
82 $this->linebreak = self::DEFAULT_LINE_BREAK;
83 $this->cronjob_notification = 0;
84 $this->signature = null;
87 $this->table_mail_options,
89 'user_id' => [
'integer', $this->user_id],
92 'linebreak' => [
'integer', $this->linebreak],
93 'signature' => [
'text', $this->signature],
94 'incoming_type' => [
'integer', $this->incoming_type],
95 'mail_address_option' => [
'integer', $this->mail_address_option],
96 'cronjob_notification' => [
'integer', $this->cronjob_notification]
103 $res = $this->db->queryF(
104 'SELECT mail_options.cronjob_notification, 105 mail_options.signature, 106 mail_options.linebreak, 107 mail_options.incoming_type, 108 mail_options.mail_address_option, 110 usr_data.second_email 112 LEFT JOIN usr_data ON mail_options.user_id = usr_data.usr_id 113 WHERE mail_options.user_id = %s',
115 array($this->user_id)
117 $row = $this->db->fetchObject(
$res);
120 $this->cronjob_notification = (int)
$row->cronjob_notification;
121 $this->signature =
$row->signature;
122 $this->linebreak = (
int)
$row->linebreak;
123 $this->incoming_type = (int)
$row->incoming_type;
124 $this->mail_address_option = (
int)
$row->mail_address_option;
128 $this->incoming_type,
130 [
'options' => [
'min_range' => self::INCOMING_LOCAL,
'max_range' => self::INCOMING_BOTH]]
133 $this->incoming_type = self::INCOMING_LOCAL;
138 $this->mail_address_option,
140 [
'options' => [
'min_range' => self::FIRST_EMAIL,
'max_range' => self::BOTH_EMAIL]]
143 $this->mail_address_option = self::FIRST_EMAIL;
146 $firstMailAddress = (string)
$row->email;
147 $secondMailAddress = (
string)
$row->second_email;
149 $this->mailTransportSettings->adjust($firstMailAddress, $secondMailAddress);
157 'linebreak' => [
'integer', (int) $this->
getLinebreak()],
162 if ($this->
settings->get(
'mail_notification')) {
165 $data[
'cronjob_notification'] = [
'integer', (int) self::lookupNotificationSetting($this->user_id)];
168 return $this->db->replace(
169 $this->table_mail_options,
171 'user_id' => [
'integer', $this->user_id]
265 $query =
"SELECT cronjob_notification FROM mail_options WHERE user_id = " . $DIC->database()->quote($usr_id,
'integer');
266 $row = $DIC->database()->fetchAssoc($DIC->database()->query(
$query));
267 return (
int)
$row[
'cronjob_notification'];
277 $emailAddresses = array();
280 case self::SECOND_EMAIL:
283 } elseif (strlen($user->
getEmail())) {
285 $emailAddresses[] = $user->
getEmail();
289 case self::BOTH_EMAIL:
291 $emailAddresses[] = $user->
getEmail();
298 case self::FIRST_EMAIL:
301 $emailAddresses[] = $user->
getEmail();
309 return $emailAddresses;
320 $mail_options =
new self($user->
getId());
323 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
setIncomingType($incoming_type)
static getExternalEmailsByUserId($user_id, ilMailOptions $mail_options=null)
static lookupExternalEmails(ilObjUser $user, ilMailOptions $mail_options)