예제 #1
0
 /**
  * Sends an email to inform the member of a new comment.
  *
  * @param object $note Notification configuration.
  * @param string $messageWordCode i18n code for email content.
  * @param string $subjectWordCode i18n code for email subject.
  */
 public function sendCommentNotification($note, $messageWordCode, $subjectWordCode)
 {
     $fromMember = $this->createEntity('Member', $note['IdRelMember']);
     $toMember = $this->createEntity('Member', $note['IdMember']);
     if ($fromMember && $toMember) {
         $words = new MOD_words();
         $commentsUrl = PVars::getObj('env')->baseuri . $note['Link'];
         $replyUrl = PVars::getObj('env')->baseuri . $note['replyLink'];
         $reportUrl = PVars::getObj('env')->baseuri . $note['reportLink'];
         $languageCode = $toMember->getLanguagePreference();
         // Prepare email content
         $subject = $words->getRaw($subjectWordCode, array(), $languageCode);
         $body = $words->getRaw($messageWordCode, array($toMember->Username, $fromMember->Username, $words->get('CommentQuality' . $note['Quality'] . 'InSentence'), $note['commentText'], $commentsUrl, $replyUrl, $reportUrl), $languageCode);
         // TODO: Error handling
         $toMember->sendMail($subject, $body);
     }
 }