ILIAS  Release_4_4_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 ($a_is_personal_workspace=false)
 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)
 Set attachments.
 getAttachments ()
 Get attachments.
 setLangModules (array $a_modules)
 Set lang modules.
 getUserLanguage ($a_usr_id)
 Get user language.
 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.
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail.
 getBlockBorder ()
 Get (ascii) block border.

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.
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user.

Protected Attributes

 $type = null
 $sender = null
 $mail = null
 $subject = ''
 $body = ''
 $attachments = array()
 $language = null
 $lang_modules = array()
 $recipients = array()
 $ref_id = null
 $obj_id = null
 $obj_type = null
 $additional_info = array()
 $is_in_wsp
 $wsp_tree
 $wsp_access_handler

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 (   $a_is_personal_workspace = false)

Constructor.

Parameters
bool$a_is_personal_workspace
Returns

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

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

{
global $lng, $ilUser;
$this->is_in_wsp = (bool)$a_is_personal_workspace;
$this->setSender(ANONYMOUS_USER_ID);
$this->language = ilLanguageFactory::_getLanguage($lng->getDefaultLanguage());
if($this->is_in_wsp)
{
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
$this->wsp_tree = new ilWorkspaceTree($ilUser->getId()); // owner of tree is irrelevant
$this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
}
}

+ Here is the call 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 431 of file class.ilMailNotification.php.

References ilLink\_getLink(), ilWorkspaceAccessHandler\getGotoLink(), getObjId(), getObjType(), and getRefId().

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

{
include_once './Services/Link/classes/class.ilLink.php';
if($this->getRefId())
{
if(!$this->is_in_wsp)
{
return ilLink::_getLink($this->ref_id,$this->getObjType(),$a_params,$a_append);
}
else
{
return ilWorkspaceAccessHandler::getGotoLink($this->getRefId(), $this->getObjId(), $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 348 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 ( )

Get attachments.

Returns
array

Definition at line 185 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::getBlockBorder ( )

Get (ascii) block border.

Returns
string

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

Referenced by ilSystemNotification\compose().

{
return "----------------------------------------\n";
}

+ Here is the caller graph for this function:

ilMailNotification::getBody ( )
protected

Get body.

Returns
string

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

References $body.

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

{
return $this->body;
}

+ Here is the caller graph for this function:

ilMailNotification::getObjectTitle (   $a_shorten = false)
protected

Get object title.

Parameters
boolshorten title
Returns

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

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMailNotification::getObjId ( )
ilMailNotification::getObjType ( )

Get object type.

Returns

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

References $obj_type.

Referenced by ilSystemNotification\compose(), createPermanentLink(), and isRefIdAccessible().

{
}

+ Here is the caller graph for this function:

ilMailNotification::getRefId ( )

get reference id

Returns

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

References $ref_id.

Referenced by ilSystemNotification\compose(), createPermanentLink(), ilCourseMembershipMailNotification\send(), ilCalendarMailNotification\send(), ilSystemNotification\sendMail(), and setRefId().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilMailNotification::getSender ( )

get sender of mail

Returns

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

References $subject.

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

{
}

+ Here is the caller graph for this function:

ilMailNotification::getType ( )

Get notification type.

Returns

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

References $type.

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

{
return $this->type;
}

+ Here is the caller graph for this function:

ilMailNotification::getUserLanguage (   $a_usr_id)

Get user language.

Parameters
int$a_usr_id
Returns
ilLanguage

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

References $language, and ilLanguageFactory\_getLanguageOfUser().

Referenced by initLanguage().

{
$language->loadLanguageModule('mail');
if(sizeof($this->lang_modules))
{
foreach($this->lang_modules as $lmod)
{
$language->loadLanguageModule($lmod);
}
}
return $language;
}

+ Here is the call graph for this function:

+ 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 234 of file class.ilMailNotification.php.

References ilLanguageFactory\_getLanguage().

{
$this->language = ilLanguageFactory::_getLanguage($a_code);
$this->language->loadLanguageModule('mail');
if(sizeof($this->lang_modules))
{
foreach($this->lang_modules as $lmod)
{
$this->language->loadLanguageModule($lmod);
}
}
}

+ Here is the call graph for this function:

ilMailNotification::isRefIdAccessible (   $a_user_id,
  $a_ref_id,
  $a_permission = "read" 
)
protected

Check if ref id is accessible for user.

Parameters
int$a_user_id
int$a_ref_id
string$a_permission
Returns
bool

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

References getObjType().

Referenced by ilSystemNotification\compose().

{
global $ilAccess;
// no given permission == accessible
if(!$this->is_in_wsp)
{
if(trim($a_permission) &&
!$ilAccess->checkAccessOfUser($a_user_id, $a_permission, "", $a_ref_id, $this->getObjType()))
{
return false;
}
}
else
{
if(trim($a_permission) &&
!$this->wsp_access_handler->checkAccessOfUser($this->wsp_tree, $a_user_id, $a_permission, "", $a_ref_id, $this->getObjType()))
{
return false;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Send Mail.

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

Definition at line 378 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 339 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)

Set attachments.

Parameters
array$a_att

Definition at line 176 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::setLangModules ( array  $a_modules)

Set lang modules.

Parameters
array$a_modules

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

{
$this->lang_modules = $a_modules;
}
ilMailNotification::setLanguage (   $a_language)
protected

A language.

Parameters
ilLanguage$a_language

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

References ilObject\_lookupType().

Referenced by setRefId().

{
$this->obj_id = $a_obj_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::setRecipients (   $a_rcp)

set mail recipients

Parameters
array$a_rcpuser ids
Returns

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

Referenced by ilDiskQuotaSummaryNotification\__construct(), ilPaymentNotification\send(), ilMailSummaryNotification\send(), 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 281 of file class.ilMailNotification.php.

References $obj_id, ilObject\_lookupObjId(), getRefId(), and setObjId().

Referenced by ilTestManScoringParticipantNotification\__construct().

{
if(!$this->is_in_wsp)
{
$this->ref_id = $a_id;
$obj_id = ilObject::_lookupObjId($this->ref_id);
}
else
{
$this->ref_id = (int)$a_id;
$obj_id = $this->wsp_tree->lookupObjectId($this->getRefId());
}
$this->setObjId($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 91 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 72 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 458 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()
protected

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

Referenced by getAdditionalInformation().

ilMailNotification::$attachments = array()
protected

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

Referenced by getAttachments().

ilMailNotification::$is_in_wsp
protected

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

ilMailNotification::$lang_modules = array()
protected

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

ilMailNotification::$language = null
protected

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

Referenced by getLanguage(), and getUserLanguage().

ilMailNotification::$mail = null
protected

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

Referenced by ilMailSummaryNotification\send().

ilMailNotification::$obj_id = null
protected

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

Referenced by getObjId(), and setRefId().

ilMailNotification::$obj_type = null
protected

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

Referenced by getObjType().

ilMailNotification::$recipients = array()
protected

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

Referenced by getRecipients(), and sendMail().

ilMailNotification::$ref_id = null
protected

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

Referenced by ilSystemNotification\compose(), and getRefId().

ilMailNotification::$sender = null
protected

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

Referenced by getSender(), and ilMailSummaryNotification\send().

ilMailNotification::$subject = ''
protected

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

Referenced by getSubject().

ilMailNotification::$type = null
protected

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

Referenced by getType().

ilMailNotification::$wsp_access_handler
protected

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

ilMailNotification::$wsp_tree
protected

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

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: