ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailOptions Class Reference

Class UserMail this class handles user mails. More...

+ Collaboration diagram for ilMailOptions:

Public Member Functions

 __construct ($a_user_id)
 Constructor setup an mail object. More...
 
 createMailOptionsEntry ()
 create entry in table_mail_options for a new user this method should only be called from createUser() public More...
 
 getOptions ()
 get options of user and set variables $signature and $linebreak this method shouldn't bew called from outside use getSignature() and getLinebreak() private More...
 
 updateOptions ($a_signature, $a_linebreak, $a_incoming_type, $a_cronjob_notification)
 update user options More...
 
 getLinebreak ()
 get linebreak of user public More...
 
 getSignature ()
 get signature of user public More...
 
 getIncomingType ()
 
 setCronjobNotification ()
 
 getCronjobNotification ()
 

Data Fields

 $ilias
 
 $LOCAL = 0
 
 $EMAIL = 1
 
 $BOTH = 2
 
 $linebreak
 
 $signature
 
 $incoming_type
 
 $cronjob_notification
 

Detailed Description

Class UserMail this class handles user mails.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 17 of file class.ilMailOptions.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailOptions::__construct (   $a_user_id)

Constructor setup an mail object.

Parameters
intuser_id public

Definition at line 48 of file class.ilMailOptions.php.

References $ilias, and getOptions().

49  {
50  global $ilias;
51 
52  define("DEFAULT_LINEBREAK",60);
53 
54  $this->ilias = $ilias;
55  $this->table_mail_options = 'mail_options';
56 
57  $this->user_id = $a_user_id;
58  $this->getOptions();
59  }
getOptions()
get options of user and set variables $signature and $linebreak this method shouldn't bew called from...
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

Member Function Documentation

◆ createMailOptionsEntry()

ilMailOptions::createMailOptionsEntry ( )

create entry in table_mail_options for a new user this method should only be called from createUser() public

Returns
boolean

Definition at line 67 of file class.ilMailOptions.php.

References $ilSetting, and IL_MAIL_BOTH.

68  {
69  global $ilDB, $ilSetting;
70 
71  /* Get default setting for incoming mails */
72  $incomingMail = $ilSetting->get("mail_incoming_mail", IL_MAIL_BOTH);
73 
74  $statement = $ilDB->manipulateF('
75  INSERT INTO '.$this->table_mail_options.'
76  ( user_id,
77  linebreak,
78  signature,
79  incoming_type,
80  cronjob_notification
81  )
82  VALUES(%s, %s, %s, %s, %s)',
83  array('integer', 'integer', 'text', 'integer', 'integer'),
84  array($this->user_id, DEFAULT_LINEBREAK, NULL, $incomingMail, '0'));
85 
86  return true;
87  }
const IL_MAIL_BOTH
global $ilSetting
Definition: privfeed.php:40

◆ getCronjobNotification()

ilMailOptions::getCronjobNotification ( )

Definition at line 191 of file class.ilMailOptions.php.

References $cronjob_notification.

192  {
194  }

◆ getIncomingType()

ilMailOptions::getIncomingType ( )

Definition at line 182 of file class.ilMailOptions.php.

References $incoming_type.

Referenced by ilMailOptionsGUI\setMailOptionsValuesByDB(), and ilPersonalSettingsGUI\setMailOptionsValuesByDB().

183  {
184  return $this->incoming_type;
185  }
+ Here is the caller graph for this function:

◆ getLinebreak()

ilMailOptions::getLinebreak ( )

get linebreak of user public

Returns
array mails

Definition at line 167 of file class.ilMailOptions.php.

References $linebreak.

168  {
169  return $this->linebreak;
170  }

◆ getOptions()

ilMailOptions::getOptions ( )

get options of user and set variables $signature and $linebreak this method shouldn't bew called from outside use getSignature() and getLinebreak() private

Returns
boolean

Definition at line 96 of file class.ilMailOptions.php.

References $LOCAL, $res, $row, ilObjUser\_lookupEmail(), and DB_FETCHMODE_OBJECT.

Referenced by __construct().

97  {
98  global $ilDB;
99 
100  $res = $ilDB->queryf('
101  SELECT * FROM '.$this->table_mail_options.'
102  WHERE user_id = %s',
103  array('integer'), array($this->user_id));
104 
105  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
106 
107  $this->cronjob_notification = stripslashes($row->cronjob_notification);
108  $this->signature = stripslashes($row->signature);
109  $this->linebreak = stripslashes($row->linebreak);
110  $this->incoming_type = $row->incoming_type;
111 
112  if(!strlen(ilObjUser::_lookupEmail($this->user_id)))
113  {
114  $this->incoming_type = $this->LOCAL;
115  }
116 
117  return true;
118  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
_lookupEmail($a_user_id)
Lookup email.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSignature()

ilMailOptions::getSignature ( )

get signature of user public

Returns
array mails

Definition at line 177 of file class.ilMailOptions.php.

References $signature.

178  {
179  return $this->signature;
180  }

◆ setCronjobNotification()

ilMailOptions::setCronjobNotification ( )

Definition at line 187 of file class.ilMailOptions.php.

References $cronjob_notification.

188  {
190  }

◆ updateOptions()

ilMailOptions::updateOptions (   $a_signature,
  $a_linebreak,
  $a_incoming_type,
  $a_cronjob_notification 
)

update user options

Parameters
stringSignature
intlinebreak
intincoming_type
intcronjob_notification
Returns
boolean

Definition at line 128 of file class.ilMailOptions.php.

References $data, $ilias, and $query.

129  {
130  global $ilDB, $ilias;
131 
132  $data = array();
133  $data_types = array();
134 
135  $query = 'UPDATE '.$this->table_mail_options.'
136  SET signature = %s,
137  linebreak = %s, ';
138 
139  array_push($data_types, 'text', 'integer');
140  array_push($data, $a_signature, $a_linebreak);
141 
142  if ($ilias->getSetting('mail_notification'))
143  {
144  $query .= 'cronjob_notification = %s, ';
145  array_push($data_types, 'integer');
146  array_push($data, $a_cronjob_notification);
147  }
148 
149  $query .='incoming_type = %s WHERE user_id = %s';
150  array_push($data, $a_incoming_type, $this->user_id);
151  array_push($data_types, 'integer', 'integer');
152 
153  $statement = $ilDB->manipulateF($query, $data_types, $data);
154 
155  $this->cronjob_notification = $a_cronjob_notification;
156  $this->signature = $a_signature;
157  $this->linebreak = $a_linebreak;
158  $this->incoming_type = $a_incoming_type;
159 
160  return true;
161  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

Field Documentation

◆ $BOTH

ilMailOptions::$BOTH = 2

Definition at line 24 of file class.ilMailOptions.php.

◆ $cronjob_notification

ilMailOptions::$cronjob_notification

Definition at line 40 of file class.ilMailOptions.php.

Referenced by getCronjobNotification(), and setCronjobNotification().

◆ $EMAIL

ilMailOptions::$EMAIL = 1

Definition at line 23 of file class.ilMailOptions.php.

◆ $ilias

ilMailOptions::$ilias

Definition at line 19 of file class.ilMailOptions.php.

Referenced by __construct(), and updateOptions().

◆ $incoming_type

ilMailOptions::$incoming_type

Definition at line 39 of file class.ilMailOptions.php.

Referenced by getIncomingType().

◆ $linebreak

ilMailOptions::$linebreak

Definition at line 31 of file class.ilMailOptions.php.

Referenced by getLinebreak().

◆ $LOCAL

ilMailOptions::$LOCAL = 0

Definition at line 22 of file class.ilMailOptions.php.

Referenced by getOptions().

◆ $signature

ilMailOptions::$signature

Definition at line 38 of file class.ilMailOptions.php.

Referenced by getSignature().


The documentation for this class was generated from the following file: