ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailMimeSenderUser Class Reference

Class ilMailMimeSenderSystem. More...

+ Inheritance diagram for ilMailMimeSenderUser:
+ Collaboration diagram for ilMailMimeSenderUser:

Public Member Functions

 __construct (\ilSetting $settings, \ilObjUser $user)
 ilMailMimeSenderSystem constructor. More...
 
 hasReplyToAddress ()
 
Returns
bool
More...
 
 getReplyToAddress ()
 
Returns
string
More...
 
 getReplyToName ()
 
Returns
string
More...
 
 hasEnvelopFromAddress ()
 
Returns
bool
More...
 
 getEnvelopFromAddress ()
 
Returns
string
More...
 
 getFromAddress ()
 
Returns
string
More...
 
 getFromName ()
 
Returns
string
More...
 

Static Public Member Functions

static byUsrId (\ilSetting $settings, $usrId)
 
static addUserToCache ($usrId, \ilObjUser $user)
 
static byEmailAddress (\ilSetting $settings, $emailAddress)
 

Protected Attributes

 $settings
 
 $user
 

Static Protected Attributes

static $userInstances = array()
 

Detailed Description

Class ilMailMimeSenderSystem.

Definition at line 9 of file class.ilMailMimeSenderUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailMimeSenderUser::__construct ( \ilSetting  $settings,
\ilObjUser  $user 
)

ilMailMimeSenderSystem constructor.

Parameters
\ilSetting$settings

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

References $settings, $user, settings(), and user().

32  {
33  $this->settings = $settings;
34  $this->user = $user;
35  }
user()
Definition: user.php:4
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ addUserToCache()

static ilMailMimeSenderUser::addUserToCache (   $usrId,
\ilObjUser  $user 
)
static
Parameters
int$usrId
\ilObjUser$user

Definition at line 55 of file class.ilMailMimeSenderUser.php.

References $user.

Referenced by ilMailMimeTest\setUp().

56  {
57  self::$userInstances[$usrId] = $user;
58  }
+ Here is the caller graph for this function:

◆ byEmailAddress()

static ilMailMimeSenderUser::byEmailAddress ( \ilSetting  $settings,
  $emailAddress 
)
static
Parameters
\ilSetting$settings
string$emailAddress
Returns
self

Definition at line 65 of file class.ilMailMimeSenderUser.php.

References $settings, and $user.

Referenced by ilMailMimeSenderFactory\userByEmailAddress().

66  {
67  $user = new \ilObjUser();
68  $user->setEmail($emailAddress);
69 
70  return new self($settings, $user);
71  }
+ Here is the caller graph for this function:

◆ byUsrId()

static ilMailMimeSenderUser::byUsrId ( \ilSetting  $settings,
  $usrId 
)
static
Parameters
\ilSetting$settings
int$usrId
Returns
self

Definition at line 42 of file class.ilMailMimeSenderUser.php.

References $settings.

Referenced by ilMailMimeSenderFactory\user().

43  {
44  if (!array_key_exists($usrId, self::$userInstances)) {
45  self::$userInstances[$usrId] = new \ilObjUser($usrId);
46  }
47 
48  return new self($settings, self::$userInstances[$usrId]);
49  }
+ Here is the caller graph for this function:

◆ getEnvelopFromAddress()

ilMailMimeSenderUser::getEnvelopFromAddress ( )

Returns
string

Implements ilMailMimeSender.

Definition at line 108 of file class.ilMailMimeSenderUser.php.

References settings().

109  {
110  return $this->settings->get('mail_system_usr_env_from_addr');
111  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getFromAddress()

ilMailMimeSenderUser::getFromAddress ( )

Returns
string

Implements ilMailMimeSender.

Definition at line 116 of file class.ilMailMimeSenderUser.php.

References settings().

117  {
118  return $this->settings->get('mail_system_usr_from_addr');
119  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getFromName()

ilMailMimeSenderUser::getFromName ( )

Returns
string

Implements ilMailMimeSender.

Definition at line 124 of file class.ilMailMimeSenderUser.php.

References $from, $name, settings(), and user().

125  {
126  $from = $this->settings->get('mail_system_usr_from_name');
127  if (0 == strlen($from)) {
128  return $this->user->getFullname();
129  }
130 
131  $name = str_ireplace('[FULLNAME]', $this->user->getFullname(), $from);
132  $name = str_ireplace('[FIRSTNAME]', $this->user->getFirstname(), $name);
133  $name = str_ireplace('[LASTNAME]', $this->user->getLastname(), $name);
134  if ($name != $from) {
135  return $name;
136  }
137 
138  return $from;
139  }
$from
user()
Definition: user.php:4
if($format !==null) $name
Definition: metadata.php:146
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getReplyToAddress()

ilMailMimeSenderUser::getReplyToAddress ( )

Returns
string

Implements ilMailMimeSender.

Definition at line 84 of file class.ilMailMimeSenderUser.php.

References user().

85  {
86  return $this->user->getEmail();
87  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ getReplyToName()

ilMailMimeSenderUser::getReplyToName ( )

Returns
string

Implements ilMailMimeSender.

Definition at line 92 of file class.ilMailMimeSenderUser.php.

References user().

93  {
94  return $this->user->getFullname();
95  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ hasEnvelopFromAddress()

ilMailMimeSenderUser::hasEnvelopFromAddress ( )

Returns
bool

Implements ilMailMimeSender.

Definition at line 100 of file class.ilMailMimeSenderUser.php.

References settings().

101  {
102  return strlen($this->settings->get('mail_system_usr_env_from_addr')) > 0;
103  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ hasReplyToAddress()

ilMailMimeSenderUser::hasReplyToAddress ( )

Returns
bool

Implements ilMailMimeSender.

Definition at line 76 of file class.ilMailMimeSenderUser.php.

77  {
78  return true;
79  }

Field Documentation

◆ $settings

ilMailMimeSenderUser::$settings
protected

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

Referenced by __construct(), byEmailAddress(), and byUsrId().

◆ $user

ilMailMimeSenderUser::$user
protected

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

Referenced by __construct(), addUserToCache(), and byEmailAddress().

◆ $userInstances

ilMailMimeSenderUser::$userInstances = array()
staticprotected

Definition at line 14 of file class.ilMailMimeSenderUser.php.


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