ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailNotification Class Reference

Base class for course/group mail notifications. More...

+ Inheritance diagram for ilMailNotification:
+ Collaboration diagram for ilMailNotification:

Public Member Functions

 __construct ()
 Constructor.
 setType ($a_type)
 Set notification type.
 getType ()
 Get notification type.
 setSender ($a_usr_id)
 Set sender of mail.
 getSender ()
 get sender of mail
 setRecipients ($a_rcp)
 set mail recipients
 getRecipients ()
 get array of recipients
 setRefId ($a_id)
 Set ref id.
 getRefId ()
 get reference id
 getObjId ()
 get object id
 getObjType ()
 Get object type.
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails.
 getAdditionalInformation ()
 Get additional information for generating notification mails.
 send ()
 Send notifications.
 sendMail ($a_rcp, $a_type)
 Send Mail.

Data Fields

const SUBJECT_TITLE_LENGTH = 60

Protected Member Functions

 setSubject ($a_subject)
 Set mail subject.
 getSubject ()
 Get mail subject.
 setBody ($a_body)
 Set mail body.
 appendBody ($a_body)
 Append body text.
 getBody ()
 Get body.
 initLanguage ($a_usr_id)
 Init language.
 getLanguage ()
 get language object
 getLanguageText ($a_keyword)
 Replace new lines.
 getObjectTitle ($a_shorten=false)
 Get object title.
 initMail ()
 Init mail.
 getMail ()
 Get mail object.
 createPermanentLink ()
 Create a permanent link for an object.
 userToString ($a_usr_id)
 Utility function.

Private Attributes

 $type = null
 $sender = null
 $mail = null
 $subject = ''
 $body = ''
 $language = null
 $recipients = array()
 $ref_id = null
 $obj_id = null
 $obj_type = null
 $additional_info = array()

Detailed Description

Base class for course/group mail notifications.

Version
$Id$
Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 16 of file class.ilMailNotification.php.

Constructor & Destructor Documentation

ilMailNotification::__construct ( )

Constructor.

Returns

Reimplemented in ilCourseMembershipMailNotification, ilGroupMembershipMailNotification, and ilRegistrationMailNotification.

Definition at line 41 of file class.ilMailNotification.php.

References ilLanguageFactory\_getLanguage(), and setSender().

{
$this->setSender(ANONYMOUS_USER_ID);
$this->language = ilLanguageFactory::_getLanguage('en');
}

+ Here is the call graph for this function:

Member Function Documentation

ilMailNotification::appendBody (   $a_body)
protected

Append body text.

Parameters
string$a_body
Returns
string body

Definition at line 119 of file class.ilMailNotification.php.

Referenced by ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
return $this->body .= $a_body;
}

+ Here is the caller graph for this function:

ilMailNotification::createPermanentLink ( )
protected

Create a permanent link for an object.

Returns

Definition at line 319 of file class.ilMailNotification.php.

References ilLink\_getLink(), getObjType(), and getRefId().

Referenced by ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
include_once './classes/class.ilLink.php';
if($this->getRefId())
{
return ilLink::_getLink($this->ref_id,$this->getObjType());
}
else
{
// Return root
return ilLink::_getLink(ROOT_FOLDER_ID,'root');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::getAdditionalInformation ( )

Get additional information for generating notification mails.

Returns

Definition at line 235 of file class.ilMailNotification.php.

References $additional_info.

Referenced by ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
return (array) $this->additional_info;
}

+ Here is the caller graph for this function:

ilMailNotification::getBody ( )
protected

Get body.

Returns
string

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

References $body.

Referenced by sendMail().

{
return $this->body;
}

+ Here is the caller graph for this function:

ilMailNotification::getLanguageText (   $a_keyword)
protected

Replace new lines.

Parameters
object$a_keyword
Returns

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

References getLanguage().

Referenced by ilCourseMembershipMailNotification\createCourseStatus(), ilGroupMembershipMailNotification\createGroupStatus(), ilRegistrationMailNotification\send(), ilGroupMembershipMailNotification\send(), and ilCourseMembershipMailNotification\send().

{
return str_replace('\n', "\n", $this->getLanguage()->txt($a_keyword));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::getMail ( )
protected

Get mail object.

Returns

Definition at line 310 of file class.ilMailNotification.php.

References initMail().

Referenced by ilRegistrationMailNotification\send(), ilGroupMembershipMailNotification\send(), ilCourseMembershipMailNotification\send(), and sendMail().

{
return is_object($this->mail) ? $this->mail : $this->initMail();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::getObjectTitle (   $a_shorten = false)
protected

Get object title.

Parameters
boolshorten title
Returns

Definition at line 245 of file class.ilMailNotification.php.

References ilObject\_lookupTitle(), getObjId(), and ilUtil\shortenText().

Referenced by ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
if(!$this->getObjId())
{
return '';
}
return ilUtil::shortenText(ilObject::_lookupTitle($this->getObjId()), self::SUBJECT_TITLE_LENGTH,true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::getObjId ( )

get object id

Returns

Definition at line 207 of file class.ilMailNotification.php.

References $obj_id.

Referenced by ilCourseMembershipMailNotification\createCourseStatus(), ilGroupMembershipMailNotification\createGroupStatus(), and getObjectTitle().

{
return $this->obj_id;
}

+ Here is the caller graph for this function:

ilMailNotification::getObjType ( )

Get object type.

Returns

Definition at line 216 of file class.ilMailNotification.php.

References $obj_type.

Referenced by createPermanentLink().

{
}

+ Here is the caller graph for this function:

ilMailNotification::getRecipients ( )

get array of recipients

Returns

Definition at line 147 of file class.ilMailNotification.php.

References $recipients.

Referenced by ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
}

+ Here is the caller graph for this function:

ilMailNotification::getRefId ( )

get reference id

Returns

Definition at line 198 of file class.ilMailNotification.php.

References $ref_id.

Referenced by createPermanentLink().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilMailNotification::getSender ( )

get sender of mail

Returns

Definition at line 80 of file class.ilMailNotification.php.

References $sender.

Referenced by initMail().

{
return $this->sender;
}

+ Here is the caller graph for this function:

ilMailNotification::getSubject ( )
protected

Get mail subject.

Returns
string

Definition at line 99 of file class.ilMailNotification.php.

References $subject.

Referenced by sendMail().

{
}

+ Here is the caller graph for this function:

ilMailNotification::getType ( )

Get notification type.

Returns

Definition at line 61 of file class.ilMailNotification.php.

References $type.

Referenced by ilRegistrationMailNotification\send(), ilGroupMembershipMailNotification\send(), ilCourseMembershipMailNotification\send(), and send().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilMailNotification::initLanguage (   $a_usr_id)
protected

Init language.

Parameters
int$a_usr_id
Returns

Reimplemented in ilCourseMembershipMailNotification, ilGroupMembershipMailNotification, and ilRegistrationMailNotification.

Definition at line 157 of file class.ilMailNotification.php.

References ilLanguageFactory\_getLanguageOfUser().

{
$this->language = ilLanguageFactory::_getLanguageOfUser($a_usr_id);
$this->language->loadLanguageModule('mail');
}

+ Here is the call graph for this function:

ilMailNotification::initMail ( )
protected

Init mail.

Returns

Definition at line 301 of file class.ilMailNotification.php.

References getSender().

Referenced by getMail(), ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
return $this->mail = new ilMail($this->getSender());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::send ( )

Send notifications.

Returns

Reimplemented in ilCourseMembershipMailNotification, ilGroupMembershipMailNotification, and ilRegistrationMailNotification.

Definition at line 259 of file class.ilMailNotification.php.

References getType().

{
switch($this->getType())
{
}
}

+ Here is the call graph for this function:

ilMailNotification::sendMail (   $a_rcp,
  $a_type 
)

Send Mail.

Parameters
arrayrecipients
arraymail type (one 'normal', 'system', 'email')
Returns

Definition at line 273 of file class.ilMailNotification.php.

References $error, $GLOBALS, $recipients, ilObjUser\_lookupLogin(), getBody(), getMail(), and getSubject().

Referenced by ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
$recipients = array();
foreach($a_rcp as $rcp)
{
}
$recipients = implode(',',$recipients);
$error = $this->getMail()->sendMail(
'',
'',
$this->getSubject(),
$this->getBody(),
array(),
$a_type
);
if(strlen($error))
{
$GLOBALS['ilLog']->write(__METHOD__.': '.$error);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::setAdditionalInformation (   $a_info)

Additional information for creating notification mails.

Parameters
array$a_info
Returns

Definition at line 226 of file class.ilMailNotification.php.

{
$this->additional_info = $a_info;
}
ilMailNotification::setBody (   $a_body)
protected

Set mail body.

Parameters
string$a_body
Returns

Definition at line 109 of file class.ilMailNotification.php.

Referenced by ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
$this->body = $a_body;
}

+ Here is the caller graph for this function:

ilMailNotification::setRecipients (   $a_rcp)

set mail recipients

Parameters
array$a_rcpuser ids
Returns

Definition at line 138 of file class.ilMailNotification.php.

{
$this->recipients = $a_rcp;
}
ilMailNotification::setRefId (   $a_id)

Set ref id.

Parameters
int$a_id
Returns

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

References ilObject\_lookupObjId(), and ilObject\_lookupType().

{
$this->ref_id = $a_id;
$this->obj_id = ilObject::_lookupObjId($this->ref_id);
$this->obj_type = ilObject::_lookupType($this->obj_id);
}

+ Here is the call graph for this function:

ilMailNotification::setSender (   $a_usr_id)

Set sender of mail.

Parameters
int$a_usr_id
Returns

Definition at line 71 of file class.ilMailNotification.php.

Referenced by __construct().

{
$this->sender = $a_usr_id;
}

+ Here is the caller graph for this function:

ilMailNotification::setSubject (   $a_subject)
protected

Set mail subject.

Parameters
string$a_subject
Returns
string body

Definition at line 90 of file class.ilMailNotification.php.

Referenced by ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
return $this->subject = $a_subject;
}

+ Here is the caller graph for this function:

ilMailNotification::setType (   $a_type)

Set notification type.

Parameters
int$a_type
Returns

Definition at line 52 of file class.ilMailNotification.php.

{
$this->type = $a_type;
}
ilMailNotification::userToString (   $a_usr_id)
protected

Utility function.

Parameters
int$a_usr_id
Returns

Definition at line 339 of file class.ilMailNotification.php.

References $name, and ilObjUser\_lookupName().

Referenced by ilCourseMembershipMailNotification\send(), and ilGroupMembershipMailNotification\send().

{
return ($name['title'] ? $name['title'].' ' : '').
($name['firstname'] ? $name['firstname'].' ' : '').
($name['lastname'] ? $name['lastname'].' ' : '');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMailNotification::$additional_info = array()
private

Definition at line 35 of file class.ilMailNotification.php.

Referenced by getAdditionalInformation().

ilMailNotification::$language = null
private

Definition at line 27 of file class.ilMailNotification.php.

Referenced by getLanguage().

ilMailNotification::$mail = null
private

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

ilMailNotification::$obj_id = null
private

Definition at line 32 of file class.ilMailNotification.php.

Referenced by getObjId().

ilMailNotification::$obj_type = null
private

Definition at line 33 of file class.ilMailNotification.php.

Referenced by getObjType().

ilMailNotification::$recipients = array()
private

Definition at line 29 of file class.ilMailNotification.php.

Referenced by getRecipients(), and sendMail().

ilMailNotification::$ref_id = null
private

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

Referenced by getRefId().

ilMailNotification::$sender = null
private

Definition at line 21 of file class.ilMailNotification.php.

Referenced by getSender().

ilMailNotification::$subject = ''
private

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

Referenced by getSubject().

ilMailNotification::$type = null
private

Definition at line 20 of file class.ilMailNotification.php.

Referenced by getType().

const ilMailNotification::SUBJECT_TITLE_LENGTH = 60

Definition at line 18 of file class.ilMailNotification.php.


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