4include_once
'./Services/Mail/classes/class.ilMailNotification.php';
48 parent::__construct(
false);
58 $mail = parent::initMail();
59 $this->logger->debug(
'Initialized mail service');
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');
78 $value = parent::setSubject($a_subject);
79 $this->logger->debug(
sprintf(
'Setting subject to: %s', $a_subject));
88 if (count($this->provider->getAttachments()) > 0) {
89 $this->logger->debug(
'Adding attachments ...');
90 foreach ($this->provider->getAttachments() as $attachment) {
93 $this->
appendBody(
"\n------------------------------------------------------------\n");
107 if (!
$ilSetting->get(
'forum_notification', 0)) {
108 $this->logger->debug(
'Forum notifications are globally disabled');
113 $this->logger->debug(
'No notification recipients, nothing to do');
117 $lng->loadLanguageModule(
'forum');
132 $this->provider->getForumTitle(),
133 $this->provider->getThreadTitle()
144 $this->
appendBody($this->
getLanguageText(
'content_deleted_thread') .
"\n------------------------------------------------------------\n");
157 if ($this->provider->getPostCensored() == 1) {
158 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
161 $this->
appendBody(strip_tags($pos_message) .
"\n");
163 $this->
appendBody(
"------------------------------------------------------------\n");
168 $this->
sendMail(array($rcp), array(
'system'));
181 $this->provider->getForumTitle(),
182 $this->provider->getThreadTitle()
193 $this->
appendBody($this->
getLanguageText(
'new_post') .
": \n------------------------------------------------------------\n");
204 if ($this->provider->getPostCensored() == 1) {
205 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
208 $this->
appendBody(strip_tags($pos_message) .
"\n");
210 $this->
appendBody(
"------------------------------------------------------------\n");
217 $this->
sendMail(array($rcp), array(
'system'));
230 $this->provider->getForumTitle(),
231 $this->provider->getThreadTitle()
243 $this->
appendBody($this->
getLanguageText(
'new_post') .
": \n------------------------------------------------------------\n");
254 if ($this->provider->getPostCensored() == 1) {
255 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
258 $this->
appendBody(strip_tags($pos_message) .
"\n");
260 $this->
appendBody(
"------------------------------------------------------------\n");
267 $this->
sendMail(array($rcp), array(
'system'));
280 $this->provider->getForumTitle(),
281 $this->provider->getThreadTitle()
294 $this->
appendBody($this->
getLanguageText(
'new_post') .
": \n------------------------------------------------------------\n");
305 if ($this->provider->getPostCensored() == 1) {
306 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
309 $this->
appendBody(strip_tags($pos_message) .
"\n");
311 $this->
appendBody(
"------------------------------------------------------------\n");
318 $this->
sendMail(array($rcp), array(
'system'));
331 $this->provider->getForumTitle(),
332 $this->provider->getThreadTitle()
337 $this->
appendBody(
sprintf($this->
getLanguageText(
'post_updated_by'), $this->provider->getPostUpdateUserName($this->getLanguage()), $this->provider->getForumTitle()));
343 $this->
appendBody($this->
getLanguageText(
'content_post_updated') .
"\n------------------------------------------------------------\n");
354 if ($this->provider->getPostCensored() == 1) {
355 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
358 $this->
appendBody(strip_tags($pos_message) .
"\n");
360 $this->
appendBody(
"------------------------------------------------------------\n");
367 $this->
sendMail(array($rcp), array(
'system'));
380 $this->provider->getForumTitle(),
381 $this->provider->getThreadTitle()
386 $this->
appendBody(
sprintf($this->
getLanguageText(
'post_censored_by'), $this->provider->getPostUpdateUserName($this->getLanguage()), $this->provider->getForumTitle()));
392 $this->
appendBody($this->
getLanguageText(
'content_censored_post') .
"\n------------------------------------------------------------\n");
403 if ($this->provider->getPostCensored() == 1) {
404 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
407 $this->
appendBody(strip_tags($pos_message) .
"\n");
409 $this->
appendBody(
"------------------------------------------------------------\n");
416 $this->
sendMail(array($rcp), array(
'system'));
428 $this->provider->getForumTitle(),
429 $this->provider->getThreadTitle()
440 $this->
appendBody($this->
getLanguageText(
'forums_the_post') .
"\n------------------------------------------------------------\n");
452 $this->
appendBody(strip_tags($pos_message) .
"\n");
454 $this->
appendBody(
"------------------------------------------------------------\n");
461 $this->
sendMail(array($rcp), array(
'system'));
474 $this->provider->getForumTitle(),
475 $this->provider->getThreadTitle()
486 $this->
appendBody($this->
getLanguageText(
'content_deleted_post') .
"\n------------------------------------------------------------\n");
499 if ($this->provider->getPostCensored() == 1) {
500 $this->
appendBody($this->provider->getCensorshipComment() .
"\n");
503 $this->
appendBody(strip_tags($pos_message) .
"\n");
505 $this->
appendBody(
"------------------------------------------------------------\n");
510 $this->
sendMail(array($rcp), array(
'system'));
526 parent::initLanguage($a_usr_id);
527 $this->language->loadLanguageModule(
'forum');
553 $ilClientIniFile =
$DIC[
'ilClientIniFile'];
555 if (
$type == self::PERMANENT_LINK_FORUM) {
556 $language_text = $this->
getLanguageText(
"forums_notification_show_frm");
557 $forum_parameters = $this->provider->getRefId();
559 $language_text = $this->
getLanguageText(
"forums_notification_show_post");
560 $forum_parameters = $this->provider->getRefId() .
"_" . $this->provider->getThreadId() .
"_" . $this->provider->getPostId();
564 'Building permanent with parameters %s',
571 ilUtil::_getHttpPath() .
"/goto.php?target=frm_" . $forum_parameters .
'&client_id=' . CLIENT_ID
576 $ilClientIniFile->readVariable(
"client",
"name"),
582 ilUtil::_getHttpPath() .
"/goto.php?target=frm_" . $forum_parameters .
'&client_id=' . CLIENT_ID
587 $ilClientIniFile->readVariable(
"client",
"name"),
597 return $posting_link;
605 $pos_message = $this->provider->getPostMessage();
606 if (strip_tags($pos_message) != $pos_message) {
607 $pos_message = preg_replace(
"/\n/i",
"", $pos_message);
608 $pos_message = preg_replace(
"/<br(\s*)(\/?)>/i",
"\n", $pos_message);
609 $pos_message = preg_replace(
"/<p([^>]*)>/i",
"\n\n", $pos_message);
610 $pos_message = preg_replace(
"/<\/p([^>]*)>/i",
'', $pos_message);
613 return strip_tags($pos_message);
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=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
const TYPE_POST_UNCENSORED
getPermanentLink($type=self::PERMANENT_LINK_POST)
const PERMANENT_LINK_FORUM
__construct(ilForumNotificationMailData $provider, \ilLogger $logger)
ilForumMailNotification constructor.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
setSubject($a_subject)
string body
setIsCronjob($is_cronjob)
const TYPE_THREAD_DELETED
const TYPE_POST_ACTIVATION
const PERMANENT_LINK_POST
Component logger with individual log levels by component id.
Base class for course/group mail notifications.
appendBody($a_body)
Append body text.
getType()
Get notification type.
getRecipients()
get array of recipients
setAttachments($a_att)
Set attachments.
getLanguageText($a_keyword)
static _getInstallationSignature()
static getSalutation($a_usr_id, ilLanguage $a_language=null)
Interface ilForumNotificationMailData.