ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseMembershipMailNotification Class Reference
+ Inheritance diagram for ilCourseMembershipMailNotification:
+ Collaboration diagram for ilCourseMembershipMailNotification:

Public Member Functions

 __construct ()
 send ()
 Send notifications.
- Public Member Functions inherited from ilMailNotification
 __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 TYPE_ADMISSION_MEMBER = 20
const TYPE_DISMISS_MEMBER = 21
const TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22
const TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23
const TYPE_STATUS_CHANGED = 24
const TYPE_BLOCKED_MEMBER = 25
const TYPE_UNBLOCKED_MEMBER = 26
const TYPE_UNSUBSCRIBE_MEMBER = 27
const TYPE_SUBSCRIBE_MEMBER = 28
const TYPE_WAITING_LIST_MEMBER = 29
const TYPE_NOTIFICATION_REGISTRATION = 30
const TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31
const TYPE_NOTIFICATION_UNSUBSCRIBE = 32
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60

Protected Member Functions

 initLanguage ($a_usr_id)
 Add language module crs.
 createCourseStatus ($a_usr_id)
 Get course status body.
- Protected Member Functions inherited from ilMailNotification
 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.
 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.

Additional Inherited Members

- Protected Attributes inherited from ilMailNotification
 $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

Constructor & Destructor Documentation

ilCourseMembershipMailNotification::__construct ( )

Member Function Documentation

ilCourseMembershipMailNotification::createCourseStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

Definition at line 425 of file class.ilCourseMembershipMailNotification.php.

References ilMailNotification\$body, ilCourseParticipants\_getInstanceByObjId(), ilMailNotification\getLanguageText(), and ilMailNotification\getObjId().

Referenced by send().

{
$body = $this->getLanguageText('crs_new_status')."\n";
$body .= $this->getLanguageText('role').': ';
if($part->isAdmin($a_usr_id))
{
$body .= $this->getLanguageText('crs_admin')."\n";
}
elseif($part->isTutor($a_usr_id))
{
$body .= $this->getLanguageText('crs_tutor')."\n";
}
else
{
$body .= $this->getLanguageText('crs_member')."\n";
}
if($part->isAdmin($a_usr_id) or $part->isTutor($a_usr_id))
{
$body .= $this->getLanguageText('crs_status').': ';
if($part->isNotificationEnabled($a_usr_id))
{
$body .= $this->getLanguageText('crs_notify')."\n";
}
else
{
$body .= $this->getLanguageText('crs_no_notify')."\n";
}
}
else
{
$body .= $this->getLanguageText('crs_access').': ';
if($part->isBlocked($a_usr_id))
{
$body .= $this->getLanguageText('crs_blocked')."\n";
}
else
{
$body .= $this->getLanguageText('crs_unblocked')."\n";
}
}
$body .= $this->getLanguageText('crs_passed').': ';
if($part->hasPassed($a_usr_id))
{
$body .= $this->getLanguageText('yes');
}
else
{
$body .= $this->getLanguageText('no');
}
return $body;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Add language module crs.

Parameters
object$a_usr_id
Returns

Reimplemented from ilMailNotification.

Definition at line 414 of file class.ilCourseMembershipMailNotification.php.

References ilMailNotification\getLanguage().

Referenced by send().

{
$this->getLanguage()->loadLanguageModule('crs');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseMembershipMailNotification::send ( )

Send notifications.

Returns

Definition at line 46 of file class.ilCourseMembershipMailNotification.php.

References $ilSetting, ilMailNotification\appendBody(), createCourseStatus(), ilMailNotification\createPermanentLink(), ilMailNotification\getAdditionalInformation(), ilObjectFactory\getInstanceByRefId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMailNotification\getRefId(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), and ilMailNotification\userToString().

{
global $ilSetting;
if( (int) $this->getRefId() &&
in_array($this->getType(), array(self::TYPE_ADMISSION_MEMBER)) )
{
if( $obj->getAutoNotification() == false )
{
return false;
}
}
// #11359
// parent::send();
switch($this->getType())
{
case self::TYPE_ADMISSION_MEMBER:
// automatic mails about status change disabled
if(!$ilSetting->get('mail_crs_member_notification',true))
{
return;
}
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_added_member'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_added_member_body'),$this->getObjectTitle())
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_accept_subscriber'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_accept_subscriber_body'),$this->getObjectTitle())
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_REFUSED_SUBSCRIPTION_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_reject_subscriber'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_reject_subscriber_body'),$this->getObjectTitle())
);
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_STATUS_CHANGED:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_status_changed'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_status_changed_body'),$this->getObjectTitle())
);
$this->appendBody("\n\n");
$this->appendBody($this->createCourseStatus($rcp));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_DISMISS_MEMBER:
// automatic mails about status change disabled
if(!$ilSetting->get('mail_crs_member_notification',true))
{
return;
}
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_dismiss_member'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_dismiss_member_body'),$this->getObjectTitle())
);
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_BLOCKED_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_blocked_member'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_blocked_member_body'),$this->getObjectTitle())
);
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_UNBLOCKED_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_unblocked_member'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_unblocked_member_body'),$this->getObjectTitle())
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_NOTIFICATION_REGISTRATION:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_new_subscription'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$info = $this->getAdditionalInformation();
$this->appendBody(
sprintf($this->getLanguageText('crs_new_subscription_body'),
$this->userToString($info['usr_id']),
$this->getObjectTitle()
)
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink(array(),'_mem'));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_NOTIFICATION_REGISTRATION_REQUEST:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_new_subscription_request'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$info = $this->getAdditionalInformation();
$this->appendBody(
sprintf($this->getLanguageText('crs_new_subscription_request_body'),
$this->userToString($info['usr_id']),
$this->getObjectTitle()
)
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_new_subscription_request_body2'));
$this->appendBody("\n");
$this->appendBody($this->createPermanentLink(array(),'_mem'));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_NOTIFICATION_UNSUBSCRIBE:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_cancel_subscription'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$info = $this->getAdditionalInformation();
$this->appendBody(
sprintf($this->getLanguageText('crs_cancel_subscription_body'),
$this->userToString($info['usr_id']),
$this->getObjectTitle()
)
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_cancel_subscription_body2'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink(array(),'_mem'));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_UNSUBSCRIBE_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_unsubscribe_member'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_unsubscribe_member_body'),$this->getObjectTitle())
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_unsubscribe_member_explanation'));
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_SUBSCRIBE_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_subscribe_member'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_subscribe_member_body'),$this->getObjectTitle())
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
case self::TYPE_WAITING_LIST_MEMBER:
foreach($this->getRecipients() as $rcp)
{
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('crs_subscribe_wl'),$this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
$info = $this->getAdditionalInformation();
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('crs_subscribe_wl_body'),
$this->getObjectTitle(),
$info['position']
)
);
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($rcp),array('system'));
}
break;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

const ilCourseMembershipMailNotification::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22
const ilCourseMembershipMailNotification::TYPE_ADMISSION_MEMBER = 20
const ilCourseMembershipMailNotification::TYPE_BLOCKED_MEMBER = 25
const ilCourseMembershipMailNotification::TYPE_DISMISS_MEMBER = 21
const ilCourseMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION = 30
const ilCourseMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31
const ilCourseMembershipMailNotification::TYPE_NOTIFICATION_UNSUBSCRIBE = 32
const ilCourseMembershipMailNotification::TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23
const ilCourseMembershipMailNotification::TYPE_STATUS_CHANGED = 24
const ilCourseMembershipMailNotification::TYPE_SUBSCRIBE_MEMBER = 28
const ilCourseMembershipMailNotification::TYPE_UNBLOCKED_MEMBER = 26
const ilCourseMembershipMailNotification::TYPE_UNSUBSCRIBE_MEMBER = 27
const ilCourseMembershipMailNotification::TYPE_WAITING_LIST_MEMBER = 29

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