61        $mail = parent::initMail();
 
   62        $this->logger->debug(
'Initialized mail service');
 
   70    public function sendMail(array $a_rcp, $a_parse_recipients = 
true)
 
   72        $this->logger->debug(sprintf(
 
   73            'Delegating notification transport to mail service for recipient "%s" ...',
 
   76        parent::sendMail($a_rcp, $a_parse_recipients);
 
   77        $this->logger->debug(
'Notification transport delegated');
 
   85        $value = parent::setSubject($a_subject);
 
   86        $this->logger->debug(sprintf(
'Setting subject to: %s', $a_subject));
 
  101        if (!
$ilSetting->get(
'forum_notification', 0)) {
 
  102            $this->logger->debug(
'Forum notifications are globally disabled');
 
  108            $this->logger->debug(
'No notification recipients, nothing to do');
 
  113        $lng->loadLanguageModule(
'forum');
 
  118        $mailObjects = array();
 
  124                    $customText = sprintf(
 
  126                        $this->provider->getDeletedBy(),
 
  127                        $this->provider->getForumTitle()
 
  131                        'frm_noti_subject_del_thread',
 
  133                        (
string) $customText,
 
  134                        'content_deleted_thread' 
  142                    $customText = sprintf(
 
  144                        $this->provider->getForumTitle()
 
  148                        'frm_noti_subject_new_post',
 
  150                        (
string) $customText,
 
  162                        'frm_noti_subject_act_post',
 
  164                        (
string) $customText,
 
  176                        'frm_noti_subject_answ_post',
 
  178                        (
string) $customText,
 
  187                    $customText = sprintf(
 
  189                        $this->provider->getPostUpdateUserName($this->getLanguage()),
 
  190                        $this->provider->getForumTitle()
 
  192                    $date = $this->provider->getPostUpdate();
 
  195                        'frm_noti_subject_upt_post',
 
  197                        (
string) $customText,
 
  198                        'content_post_updated',
 
  207                    $customText = sprintf(
 
  209                        $this->provider->getPostUpdateUserName($this->getLanguage()),
 
  210                        $this->provider->getForumTitle()
 
  212                    $date = $this->provider->getPostCensoredDate();
 
  215                        'frm_noti_subject_cens_post',
 
  217                        (
string) $customText,
 
  218                        'content_censored_post',
 
  227                    $customText = sprintf(
 
  229                        $this->provider->getPostUpdateUserName($this->getLanguage())
 
  231                    $date = $this->provider->getPostCensoredDate();
 
  234                        'frm_noti_subject_uncens_post',
 
  236                        (
string) $customText,
 
  246                    $customText = sprintf(
 
  248                        $this->provider->getDeletedBy(),
 
  249                        $this->provider->getForumTitle()
 
  253                        'frm_noti_subject_del_post',
 
  255                        (
string) $customText,
 
  256                        'content_deleted_post' 
  263        if (
null === $contextId) {
 
  268        if (is_array($contextParameters)) {
 
  269            $contextParameters = array();
 
  292        parent::initLanguage($a_usr_id);
 
  293        $this->
language->loadLanguageModule(
'forum');
 
  319        $ilClientIniFile = 
$DIC[
'ilClientIniFile'];
 
  321        if (
$type == self::PERMANENT_LINK_FORUM) {
 
  322            $language_text = $this->
getLanguageText(
"forums_notification_show_frm");
 
  323            $forum_parameters = $this->provider->getRefId();
 
  325            $language_text = $this->
getLanguageText(
"forums_notification_show_post");
 
  326            $forum_parameters = $this->provider->getRefId() . 
"_" . $this->provider->getThreadId() . 
"_" . $this->provider->getPostId();
 
  329        $this->logger->debug(sprintf(
 
  330            'Building permanent with parameters %s',
 
  335            $posting_link = sprintf(
 
  337                ilUtil::_getHttpPath() . 
"/goto.php?target=frm_" . $forum_parameters . 
'&client_id=' . CLIENT_ID
 
  340            $posting_link .= sprintf(
 
  342                $ilClientIniFile->readVariable(
"client", 
"name"),
 
  346            $posting_link = sprintf(
 
  348                ilUtil::_getHttpPath() . 
"/goto.php?target=frm_" . $forum_parameters . 
'&client_id=' . CLIENT_ID
 
  351            $posting_link .= sprintf(
 
  353                $ilClientIniFile->readVariable(
"client", 
"name"),
 
  358        $this->logger->debug(sprintf(
 
  363        return $posting_link;
 
  371        $pos_message = $this->provider->getPostMessage();
 
  372        if (strip_tags($pos_message) != $pos_message) {
 
  373            $pos_message = preg_replace(
"/\n/i", 
"", $pos_message);
 
  374            $pos_message = preg_replace(
"/<li([^>]*)>/i", 
"\n<li$1>", $pos_message);
 
  375            $pos_message = preg_replace(
"/<\/ul([^>]*)>(?!\s*?(<p|<ul))/i", 
"</ul$1>\n", $pos_message);
 
  376            $pos_message = preg_replace(
"/<br(\s*)(\/?)>/i", 
"\n", $pos_message);
 
  377            $pos_message = preg_replace(
"/<p([^>]*)>/i", 
"\n\n", $pos_message);
 
  378            $pos_message = preg_replace(
"/<\/p([^>]*)>/i", 
'', $pos_message);
 
  383        return strip_tags($pos_message);
 
  397        string $subjectLanguageId,
 
  398        int $recipientUserId,
 
  414        $bodyText .= $attachmentText;
 
  417        $bodyText .= $attachmentText;
 
  426            $this->provider->getAttachments(),
 
  445        string $subjectLanguageId,
 
  446        int $recipientUserId,
 
  490        $body .= $customText;
 
  496        $body .= $this->
getLanguageText($action) . 
": \n------------------------------------------------------------\n";
 
  509        if ($this->provider->getPostCensored() == 1) {
 
  510            $message = $this->provider->getCensorshipComment();
 
  514        $body .= 
"------------------------------------------------------------\n";
 
  521        $attachmentText = 
'';
 
  522        if (count($this->provider->getAttachments()) > 0) {
 
  523            $this->logger->debug(
'Adding attachments ...');
 
  524            foreach ($this->provider->getAttachments() as $attachment) {
 
  525                $attachmentText .= $this->
getLanguageText(
'attachment') . 
": " . $attachment . 
"\n";
 
  527            $attachmentText .= 
"\n------------------------------------------------------------\n";
 
  530        return $attachmentText;
 
  564            $date = $this->provider->getPostDate();
 
  580            $this->provider->getForumTitle(),
 
  581            $this->provider->getThreadTitle()
 
An exception for terminatinating execution or to throw for unit testing.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setLanguage($a_lng)
set language
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
@classDescription Date and time handling
Component logger with individual log levels by component id.
createMailValueObjectsWithAttachments(string $subjectLanguageId, int $recipientUserId, string $customText, string $action, string $date='')
Add body and send mail with attachments.
createAttachmentLinkText()
createMailBodyText(string $subject, int $userId, string $customText, string $action, string $date)
sendMail(array $a_rcp, $a_parse_recipients=true)
addMailSubject(string $subject)
createMailValueObjectWithoutAttachments(string $subjectLanguageId, int $recipientUserId, string $customText, string $action, string $date='')
Add body and send mail without attachments.
const PERMANENT_LINK_POST
setSubject($a_subject)
string body
const TYPE_POST_ACTIVATION
__construct(ilForumNotificationMailData $provider, \ilLogger $logger)
ilForumMailNotification constructor.
const TYPE_THREAD_DELETED
setIsCronjob($is_cronjob)
const PERMANENT_LINK_FORUM
createMailDate(string $date)
getPermanentLink($type=self::PERMANENT_LINK_POST)
createSubjectText(string $subject)
const TYPE_POST_UNCENSORED
Base class for course/group mail notifications.
getType()
Get notification type.
getRecipients()
get array of recipients
getLanguageText($a_keyword)
static _getInstallationSignature()
static getSalutation($a_usr_id, ilLanguage $a_language=null)
static _lookupLogin($a_user_id)
lookup login
Interface ilForumNotificationMailData.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc