ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilForumMailNotification Class Reference
+ Inheritance diagram for ilForumMailNotification:
+ Collaboration diagram for ilForumMailNotification:

Public Member Functions

 __construct (ilForumNotificationMailData $provider, \ilLogger $logger)
 ilForumMailNotification constructor. More...
 
 sendMail (array $a_rcp, $a_type, $a_parse_recipients=true)
 
 isCronjob ()
 
 setIsCronjob ($is_cronjob)
 
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 
 setType ($a_type)
 Set notification type. More...
 
 getType ()
 Get notification type. More...
 
 setSender ($a_usr_id)
 Set sender of mail. More...
 
 getSender ()
 get sender of mail More...
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 get array of recipients More...
 
 setAttachments ($a_att)
 Set attachments. More...
 
 getAttachments ()
 Get attachments. More...
 
 setLangModules (array $a_modules)
 Set lang modules. More...
 
 getUserLanguage ($a_usr_id)
 Get user language. More...
 
 setRefId ($a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId ($a_obj_id)
 
 getObjType ()
 Get object type. More...
 
 setAdditionalInformation (array $a_info)
 Additional information for creating notification mails. More...
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, $a_type, $a_parse_recipients=true)
 
 getBlockBorder ()
 Get (ascii) block border. More...
 

Data Fields

const TYPE_THREAD_DELETED = 54
 
const TYPE_POST_NEW = 60
 
const TYPE_POST_ACTIVATION = 61
 
const TYPE_POST_UPDATED = 62
 
const TYPE_POST_CENSORED = 63
 
const TYPE_POST_DELETED = 64
 
const TYPE_POST_ANSWERED = 65
 
const TYPE_POST_UNCENSORED = 66
 
const PERMANENT_LINK_POST = 'PL_Post'
 
const PERMANENT_LINK_FORUM = 'PL_Forum'
 
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 initMail ()
 
 setSubject ($a_subject)
 
 appendAttachments ()
 
 initLanguage ($a_usr_id)
 
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 
 getSubject ()
 
 setBody ($a_body)
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 
 getLanguage ()
 
 getLanguageText ($a_keyword)
 
 getObjectTitle ($a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink ($a_params=array(), $a_append='')
 
 userToString ($a_usr_id)
 
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user. More...
 

Protected Attributes

 $is_cronjob = false
 
 $provider
 
 $logger
 
- 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
 

Private Member Functions

 getSecurePostMessage ()
 

Detailed Description

Author
Nadia Matuschek nmatu.nosp@m.sche.nosp@m.k@dat.nosp@m.abay.nosp@m..de
Version
$Id$

Definition at line 11 of file class.ilForumMailNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilForumMailNotification::__construct ( ilForumNotificationMailData  $provider,
\ilLogger  $logger 
)

ilForumMailNotification constructor.

Parameters
ilForumNotificationMailData$provider
ilLogger$logger

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

References $logger, and $provider.

47  {
48  parent::__construct(false);
49  $this->provider = $provider;
50  $this->logger = $logger;
51  }

Member Function Documentation

◆ appendAttachments()

ilForumMailNotification::appendAttachments ( )
protected

Definition at line 86 of file class.ilForumMailNotification.php.

References $ilSetting, $ilUser, $lng, ilMailNotification\appendBody(), array, ilDatePresentation\formatDate(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getRecipients(), getSecurePostMessage(), ilMailNotification\getType(), IL_CAL_DATETIME, initLanguage(), initMail(), sendMail(), ilMailNotification\setAttachments(), ilMailNotification\setBody(), ilDatePresentation\setLanguage(), setSubject(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

87  {
88  if (count($this->provider->getAttachments()) > 0) {
89  $this->logger->debug('Adding attachments ...');
90  foreach ($this->provider->getAttachments() as $attachment) {
91  $this->appendBody($this->getLanguageText('attachment') . ": " . $attachment . "\n");
92  }
93  $this->appendBody("\n------------------------------------------------------------\n");
94  $this->setAttachments($this->provider->getAttachments());
95  }
96  }
setAttachments($a_att)
Set attachments.
appendBody($a_body)
Append body text.
+ Here is the call graph for this function:

◆ getSecurePostMessage()

ilForumMailNotification::getSecurePostMessage ( )
private
Returns
string

Definition at line 638 of file class.ilForumMailNotification.php.

Referenced by appendAttachments().

639  {
640  $pos_message = $this->provider->getPostMessage();
641  if(strip_tags($pos_message) != $pos_message)
642  {
643  $pos_message = preg_replace("/\n/i", "", $pos_message);
644  $pos_message = preg_replace("/<br(\s*)(\/?)>/i", "\n", $pos_message);
645  $pos_message = preg_replace("/<p([^>]*)>/i", "\n\n", $pos_message);
646  $pos_message = preg_replace("/<\/p([^>]*)>/i", '', $pos_message);
647  return $pos_message;
648  }
649  return strip_tags($pos_message);
650  }
+ Here is the caller graph for this function:

◆ initLanguage()

ilForumMailNotification::initLanguage (   $a_usr_id)
protected
Parameters
int$a_usr_id

Definition at line 561 of file class.ilForumMailNotification.php.

Referenced by appendAttachments().

562  {
563  parent::initLanguage($a_usr_id);
564  $this->language->loadLanguageModule('forum');
565  }
+ Here is the caller graph for this function:

◆ initMail()

ilForumMailNotification::initMail ( )
protected

Definition at line 56 of file class.ilForumMailNotification.php.

References ilMailNotification\$mail.

Referenced by appendAttachments().

57  {
58  $mail = parent::initMail();
59  $this->logger->debug('Initialized mail service');
60  return $mail;
61  }
+ Here is the caller graph for this function:

◆ isCronjob()

ilForumMailNotification::isCronjob ( )
Returns
boolean

Definition at line 570 of file class.ilForumMailNotification.php.

References $is_cronjob.

Referenced by setIsCronjob().

571  {
572  return (bool)$this->is_cronjob;
573  }
+ Here is the caller graph for this function:

◆ sendMail()

ilForumMailNotification::sendMail ( array  $a_rcp,
  $a_type,
  $a_parse_recipients = true 
)

Definition at line 66 of file class.ilForumMailNotification.php.

References $a_type.

Referenced by appendAttachments().

67  {
68  $this->logger->debug('Delegating notification transport to mail service ...');
69  parent::sendMail($a_rcp, $a_type, $a_parse_recipients);
70  $this->logger->debug('Notification transport delegated');
71  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ setIsCronjob()

ilForumMailNotification::setIsCronjob (   $is_cronjob)
Parameters
boolean$is_cronjob

Definition at line 578 of file class.ilForumMailNotification.php.

References $is_cronjob, ilMailNotification\$type, ilUtil\_getHttpPath(), ilMailNotification\getLanguageText(), and isCronjob().

579  {
580  $this->is_cronjob = (bool)$is_cronjob;
581  }
+ Here is the call graph for this function:

◆ setSubject()

ilForumMailNotification::setSubject (   $a_subject)
protected

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

Referenced by appendAttachments().

77  {
78  $value = parent::setSubject($a_subject);
79  $this->logger->debug(sprintf('Setting subject to: %s', $a_subject));
80  return $value;
81  }
+ Here is the caller graph for this function:

Field Documentation

◆ $is_cronjob

ilForumMailNotification::$is_cronjob = false
protected

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

Referenced by isCronjob(), and setIsCronjob().

◆ $logger

ilForumMailNotification::$logger
protected

Definition at line 39 of file class.ilForumMailNotification.php.

Referenced by __construct().

◆ $provider

ilForumMailNotification::$provider
protected

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

Referenced by __construct().

◆ PERMANENT_LINK_FORUM

const ilForumMailNotification::PERMANENT_LINK_FORUM = 'PL_Forum'

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

◆ PERMANENT_LINK_POST

const ilForumMailNotification::PERMANENT_LINK_POST = 'PL_Post'

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

◆ TYPE_POST_ACTIVATION

const ilForumMailNotification::TYPE_POST_ACTIVATION = 61

◆ TYPE_POST_ANSWERED

const ilForumMailNotification::TYPE_POST_ANSWERED = 65

◆ TYPE_POST_CENSORED

const ilForumMailNotification::TYPE_POST_CENSORED = 63

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

Referenced by ilForumCronNotification\run().

◆ TYPE_POST_DELETED

const ilForumMailNotification::TYPE_POST_DELETED = 64

◆ TYPE_POST_NEW

const ilForumMailNotification::TYPE_POST_NEW = 60

Definition at line 15 of file class.ilForumMailNotification.php.

Referenced by ilForumCronNotification\run().

◆ TYPE_POST_UNCENSORED

const ilForumMailNotification::TYPE_POST_UNCENSORED = 66

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

Referenced by ilForumCronNotification\run().

◆ TYPE_POST_UPDATED

const ilForumMailNotification::TYPE_POST_UPDATED = 62

Definition at line 17 of file class.ilForumMailNotification.php.

Referenced by ilForumCronNotification\run().

◆ TYPE_THREAD_DELETED

const ilForumMailNotification::TYPE_THREAD_DELETED = 54

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