4 include_once
'./Services/Mail/classes/class.ilMailNotification.php';
41 parent::__construct();
48 public function send()
57 if(!$ilSetting->get(
'forum_notification', 0))
67 $lng->loadLanguageModule(
'forum');
74 case self::TYPE_THREAD_DELETED:
84 $this->provider->getForumTitle(),
85 $this->provider->getThreadTitle()
90 $this->
appendBody(sprintf($this->
getLanguageText(
'thread_deleted_by'), $ilUser->getLogin(), $this->provider->getForumTitle()));
96 $this->
appendBody($this->
getLanguageText(
'content_deleted_thread') .
"\n------------------------------------------------------------\n");
109 if($this->provider->getPostCensored() == 1)
111 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
116 $this->
appendBody(strip_tags($pos_message) .
"\n");
118 $this->
appendBody(
"------------------------------------------------------------\n");
120 $this->
appendBody($this->getPermanentLink(self::PERMANENT_LINK_FORUM));
123 $this->
sendMail(array($rcp), array(
'system'));
127 case self::TYPE_POST_NEW:
137 $this->provider->getForumTitle(),
138 $this->provider->getThreadTitle()
149 $this->
appendBody($this->
getLanguageText(
'new_post').
": \n------------------------------------------------------------\n");
160 if($this->provider->getPostCensored() == 1)
162 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
167 $this->
appendBody(strip_tags($pos_message) .
"\n");
169 $this->
appendBody(
"------------------------------------------------------------\n");
171 if(count($this->provider->getAttachments()) > 0)
173 foreach($this->provider->getAttachments() as $attachment)
177 $this->
appendBody(
"\n------------------------------------------------------------\n");
183 $this->
sendMail(array($rcp), array(
'system'));
188 case self::TYPE_POST_ACTIVATION:
198 $this->provider->getForumTitle(),
199 $this->provider->getThreadTitle()
211 $this->
appendBody($this->
getLanguageText(
'new_post').
": \n------------------------------------------------------------\n");
222 if($this->provider->getPostCensored() == 1)
224 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
229 $this->
appendBody(strip_tags($pos_message) .
"\n");
231 $this->
appendBody(
"------------------------------------------------------------\n");
233 if(count($this->provider->getAttachments()) > 0)
235 foreach($this->provider->getAttachments() as $attachment)
239 $this->
appendBody(
"\n------------------------------------------------------------\n");
245 $this->
sendMail(array($rcp), array(
'system'));
249 case self::TYPE_POST_ANSWERED;
259 $this->provider->getForumTitle(),
260 $this->provider->getThreadTitle()
273 $this->
appendBody($this->
getLanguageText(
'new_post').
": \n------------------------------------------------------------\n");
284 if($this->provider->getPostCensored() == 1)
286 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
291 $this->
appendBody(strip_tags($pos_message) .
"\n");
293 $this->
appendBody(
"------------------------------------------------------------\n");
295 if(count($this->provider->getAttachments()) > 0)
297 foreach($this->provider->getAttachments() as $attachment)
301 $this->
appendBody(
"\n------------------------------------------------------------\n");
307 $this->
sendMail(array($rcp), array(
'system'));
312 case self::TYPE_POST_UPDATED:
322 $this->provider->getForumTitle(),
323 $this->provider->getThreadTitle()
328 $this->
appendBody(sprintf($this->
getLanguageText(
'post_updated_by'), $this->provider->getPostUpdateUserName($this->getLanguage()), $this->provider->getForumTitle()));
334 $this->
appendBody($this->
getLanguageText(
'content_post_updated') .
"\n------------------------------------------------------------\n");
345 if($this->provider->getPostCensored() == 1)
347 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
352 $this->
appendBody(strip_tags($pos_message) .
"\n");
354 $this->
appendBody(
"------------------------------------------------------------\n");
356 if(count($this->provider->getAttachments()) > 0)
358 foreach($this->provider->getAttachments() as $attachment)
362 $this->
appendBody(
"\n------------------------------------------------------------\n");
368 $this->
sendMail(array($rcp), array(
'system'));
372 case self::TYPE_POST_CENSORED:
382 $this->provider->getForumTitle(),
383 $this->provider->getThreadTitle()
388 $this->
appendBody(sprintf($this->
getLanguageText(
'post_censored_by'), $this->provider->getPostUpdateUserName($this->getLanguage()) ,$this->provider->getForumTitle()));
394 $this->
appendBody($this->
getLanguageText(
'content_censored_post') .
"\n------------------------------------------------------------\n");
405 if($this->provider->getPostCensored() == 1)
407 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
412 $this->
appendBody(strip_tags($pos_message) .
"\n");
414 $this->
appendBody(
"------------------------------------------------------------\n");
416 if(count($this->provider->getAttachments()) > 0)
418 foreach($this->provider->getAttachments() as $attachment)
422 $this->
appendBody(
"\n------------------------------------------------------------\n");
428 $this->
sendMail(array($rcp), array(
'system'));
431 case self::TYPE_POST_UNCENSORED:
441 $this->provider->getForumTitle(),
442 $this->provider->getThreadTitle()
447 $this->
appendBody(sprintf($this->
getLanguageText(
'post_uncensored_by'), $this->provider->getPostUpdateUserName($this->getLanguage())));
453 $this->
appendBody($this->
getLanguageText(
'forums_the_post') .
"\n------------------------------------------------------------\n");
465 $this->
appendBody(strip_tags($pos_message) .
"\n");
467 $this->
appendBody(
"------------------------------------------------------------\n");
469 if(count($this->provider->getAttachments()) > 0)
471 foreach($this->provider->getAttachments() as $attachment)
475 $this->
appendBody(
"\n------------------------------------------------------------\n");
481 $this->
sendMail(array($rcp), array(
'system'));
485 case self::TYPE_POST_DELETED:
495 $this->provider->getForumTitle(),
496 $this->provider->getThreadTitle()
501 $this->
appendBody(sprintf($this->
getLanguageText(
'post_deleted_by'), $ilUser->getLogin(), $this->provider->getForumTitle()));
507 $this->
appendBody($this->
getLanguageText(
'content_deleted_post') .
"\n------------------------------------------------------------\n");
520 if($this->provider->getPostCensored() == 1)
522 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
527 $this->
appendBody(strip_tags($pos_message) .
"\n");
529 $this->
appendBody(
"------------------------------------------------------------\n");
531 $this->
appendBody($this->getPermanentLink(self::PERMANENT_LINK_FORUM));
534 $this->
sendMail(array($rcp), array(
'system'));
550 parent::initLanguage($a_usr_id);
551 $this->language->loadLanguageModule(
'forum');
574 private function getPermanentLink(
$type = self::PERMANENT_LINK_POST)
579 global $ilClientIniFile;
581 if(
$type == self::PERMANENT_LINK_FORUM)
583 $language_text = $this->
getLanguageText(
"forums_notification_show_frm");
584 $forum_parameters = $this->provider->getRefId();
588 $language_text = $this->
getLanguageText(
"forums_notification_show_post");
589 $forum_parameters = $this->provider->getRefId() .
"_" . $this->provider->getThreadId() .
"_" . $this->provider->getPostId();
594 $posting_link = sprintf($language_text,
595 ilUtil::_getHttpPath() .
"/goto.php?target=frm_" .$forum_parameters.
'&client_id=' . CLIENT_ID) .
"\n\n";
597 $posting_link .= sprintf($this->
getLanguageText(
"forums_notification_intro"),
598 $ilClientIniFile->readVariable(
"client",
"name"),
603 $posting_link = sprintf($language_text,
604 ilUtil::_getHttpPath() .
"/goto.php?target=frm_" .$forum_parameters.
'&client_id=' . CLIENT_ID) .
"\n\n";
606 $posting_link .= sprintf($this->
getLanguageText(
"forums_notification_intro"),
607 $ilClientIniFile->readVariable(
"client",
"name"),
611 return $posting_link;
619 $pos_message = $this->provider->getPostMessage();
620 if(strip_tags($pos_message) != $pos_message)
622 $pos_message = preg_replace(
"/\n/i",
"", $pos_message);
623 $pos_message = preg_replace(
"/<br(\s*)(\/?)>/i",
"\n", $pos_message);
624 $pos_message = preg_replace(
"/<p([^>]*)>/i",
"\n\n", $pos_message);
625 $pos_message = preg_replace(
"/<\/p([^>]*)>/i",
'', $pos_message);
628 return strip_tags($pos_message);
const PERMANENT_LINK_FORUM
getType()
Get notification type.
const TYPE_POST_ACTIVATION
getLanguageText($a_keyword)
const PERMANENT_LINK_POST
static setUseRelativeDates($a_status)
set use relative dates
const TYPE_THREAD_DELETED
setIsCronjob($is_cronjob)
static useRelativeDates()
check if relative dates are used
static setLanguage($a_lng)
set language
Base class for course/group mail notifications.
static formatDate(ilDateTime $date)
Format a date public.
static getSalutation($a_usr_id, $a_language=null)
Get salutation.
Interface ilForumNotificationMailData.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getRecipients()
get array of recipients
__construct(ilForumNotificationMailData $provider)
appendBody($a_body)
Append body text.
const TYPE_POST_UNCENSORED
static _getInstallationSignature()
Static getter for the installation signature.