ILIAS  release_4-3 Revision
 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
 setAttachments ($a_att)
 getAttachments ()
 setRefId ($a_id)
 Set ref id.
 getRefId ()
 get reference id
 getObjId ()
 get object id
 setObjId ($a_obj_id)
 set obj 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, $a_parse_recipients=true)
 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.
 initLanguageByIso2Code ($a_code= '')
 Init language by ISO2 code.
 setLanguage ($a_language)
 A 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 ($a_params=array(), $a_append= '')
 Create a permanent link for an object.
 userToString ($a_usr_id)
 Utility function.

Protected Attributes

 $language = null

Private Attributes

 $type = null
 $sender = null
 $mail = null
 $subject = ''
 $body = ''
 $attachments = array()
 $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 ilCalendarMailNotification, ilCourseMembershipMailNotification, ilGroupMembershipMailNotification, ilRegistrationMailNotification, ilDiskQuotaSummaryNotification, ilExerciseMailNotification, ilRegistrationMimeMailNotification, ilMailSummaryNotification, ilTestMailNotification, and ilPaymentNotification.

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

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

Referenced by ilTestManScoringParticipantNotification\__construct().

{
global $lng;
$this->setSender(ANONYMOUS_USER_ID);
$this->language = ilLanguageFactory::_getLanguage($lng->getDefaultLanguage());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Function Documentation

ilMailNotification::createPermanentLink (   $a_params = array(),
  $a_append = '' 
)
protected

Create a permanent link for an object.

Returns

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

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

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

{
include_once './Services/Link/classes/class.ilLink.php';
if($this->getRefId())
{
return ilLink::_getLink($this->ref_id,$this->getObjType(),$a_params,$a_append);
}
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 276 of file class.ilMailNotification.php.

References $additional_info.

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

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

+ Here is the caller graph for this function:

ilMailNotification::getAttachments ( )

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

References $attachments.

Referenced by ilCalendarMailNotification\deleteAttachments(), and sendMail().

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

+ Here is the caller graph for this function:

ilMailNotification::getBody ( )
protected

Get body.

Returns
string

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

References $body.

Referenced by ilPaymentNotification\send(), ilMailSummaryNotification\send(), ilCronCourseGroupNotification\sendMail(), sendMail(), and ilMimeMailNotification\sendMimeMail().

{
return $this->body;
}

+ Here is the caller graph for this function:

ilMailNotification::getMail ( )
protected
ilMailNotification::getObjectTitle (   $a_shorten = false)
protected

Get object title.

Parameters
boolshorten title
Returns

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

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

Referenced by ilCourseMembershipMailNotification\send(), ilGroupMembershipMailNotification\send(), ilExerciseMailNotification\send(), and ilCalendarMailNotification\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 239 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 257 of file class.ilMailNotification.php.

References $obj_type.

Referenced by createPermanentLink().

{
}

+ Here is the caller graph for this function:

ilMailNotification::getRefId ( )

get reference id

Returns

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

References $ref_id.

Referenced by createPermanentLink(), ilCourseMembershipMailNotification\send(), and ilCalendarMailNotification\send().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilMailNotification::getSender ( )

get sender of mail

Returns

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

References $sender.

Referenced by ilCalendarMailNotification\addAttachment(), ilCalendarMailNotification\deleteAttachments(), and initMail().

{
return $this->sender;
}

+ Here is the caller graph for this function:

ilMailNotification::getSubject ( )
protected

Get mail subject.

Returns
string

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

References $subject.

Referenced by ilPaymentNotification\send(), ilMailSummaryNotification\send(), ilCronCourseGroupNotification\sendMail(), sendMail(), and ilMimeMailNotification\sendMimeMail().

{
}

+ Here is the caller graph for this function:

ilMailNotification::getType ( )

Get notification type.

Returns

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

References $type.

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

{
return $this->type;
}

+ Here is the caller graph for this function:

ilMailNotification::initLanguageByIso2Code (   $a_code = '')
protected

Init language by ISO2 code.

Parameters
string$a_code

Reimplemented in ilMimeMailNotification.

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

References ilLanguageFactory\_getLanguage().

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

+ Here is the call graph for this function:

ilMailNotification::send ( )
ilMailNotification::sendMail (   $a_rcp,
  $a_type,
  $a_parse_recipients = true 
)

Send Mail.

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

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

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

Referenced by ilTestManScoringParticipantNotification\send(), ilRegistrationMailNotification\send(), ilCourseMembershipMailNotification\send(), ilGroupMembershipMailNotification\send(), ilDiskQuotaSummaryNotification\send(), ilExerciseMailNotification\send(), ilCalendarMailNotification\send(), ilTestMailNotification\sendAdvancedNotification(), and ilTestMailNotification\sendSimpleNotification().

{
$recipients = array();
foreach($a_rcp as $rcp)
{
if($a_parse_recipients)
{
}
else
{
$recipients[] = $rcp;
}
}
$recipients = implode(',',$recipients);
$error = $this->getMail()->sendMail(
'',
'',
$this->getSubject(),
$this->getBody(),
$this->getAttachments(),
$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 267 of file class.ilMailNotification.php.

Referenced by ilTestScoringGUI\saveManScoringParticipantScreen().

{
$this->additional_info = $a_info;
}

+ Here is the caller graph for this function:

ilMailNotification::setAttachments (   $a_att)

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

Referenced by ilCalendarMailNotification\addAttachment(), and ilTestMailNotification\sendAdvancedNotification().

{
$this->attachments = $a_att;
}

+ Here is the caller graph for this function:

ilMailNotification::setLanguage (   $a_language)
protected

A language.

Parameters
ilLanguage$a_language

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

Referenced by ilCalendarMailNotification\send().

{
$this->language = $a_language;
}

+ Here is the caller graph for this function:

ilMailNotification::setObjId (   $a_obj_id)

set obj id

Returns

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

{
$this->obj_id = $a_obj_id;
}
ilMailNotification::setRecipients (   $a_rcp)

set mail recipients

Parameters
array$a_rcpuser ids
Returns

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

Referenced by ilDiskQuotaSummaryNotification\__construct(), ilPaymentNotification\send(), ilMailSummaryNotification\send(), ilCronCourseGroupNotification\sendMail(), and ilTestManScoringParticipantNotification\setRecipient().

{
$this->recipients = $a_rcp;
}

+ Here is the caller graph for this function:

ilMailNotification::setRefId (   $a_id)

Set ref id.

Parameters
int$a_id
Returns

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

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

Referenced by ilTestManScoringParticipantNotification\__construct().

{
$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:

+ Here is the caller graph for this function:

ilMailNotification::setSender (   $a_usr_id)

Set sender of mail.

Parameters
int$a_usr_id
Returns

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

Referenced by __construct(), and ilCalendarMailNotification\__construct().

{
$this->sender = $a_usr_id;
}

+ Here is the caller graph for this function:

ilMailNotification::setType (   $a_type)

Set notification type.

Parameters
int$a_type
Returns

Definition at line 56 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 388 of file class.ilMailNotification.php.

References ilObjUser\_lookupName().

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

{
$name = ilObjUser::_lookupName($a_usr_id);
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 37 of file class.ilMailNotification.php.

Referenced by getAdditionalInformation().

ilMailNotification::$attachments = array()
private

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

Referenced by getAttachments().

ilMailNotification::$language = null
protected

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

Referenced by getLanguage().

ilMailNotification::$mail = null
private
ilMailNotification::$obj_id = null
private
ilMailNotification::$obj_type = null
private
ilMailNotification::$recipients = array()
private

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

Referenced by getRecipients(), and sendMail().

ilMailNotification::$ref_id = null
private
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
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: