Exemplo n.º 1
0
 /**
  * @param RedBeanModel $relatedModel
  * @param Comment $comment
  * @param $senderPerson
  * @param array $peopleToSendNotification
  */
 public static function sendNotificationOnNewComment(RedBeanModel $relatedModel, Comment $comment, $senderPerson, $peopleToSendNotification)
 {
     if (count($peopleToSendNotification) > 0) {
         foreach ($peopleToSendNotification as $people) {
             if ($people->primaryEmail->emailAddress !== null && !UserConfigurationFormAdapter::resolveAndGetValue($people, 'turnOffEmailNotifications')) {
                 $subject = self::getEmailSubject($relatedModel);
                 $content = self::getEmailContent($relatedModel, $comment, $people);
                 EmailNotificationUtil::resolveAndSendEmail($senderPerson, array($people), $subject, $content);
             }
         }
     } else {
         return;
     }
 }
Exemplo n.º 2
0
 /**
  * @param Mission $mission
  */
 public static function makeAndSubmitNewMissionNotificationMessage(Mission $mission)
 {
     $recipients = array();
     $peopleToSendNotification = static::resolvePeopleToSendNotificationToOnNewMission($mission);
     foreach ($peopleToSendNotification as $person) {
         if ($person->primaryEmail->emailAddress != null && !UserConfigurationFormAdapter::resolveAndGetValue($person, 'turnOffEmailNotifications')) {
             $recipients[] = $person;
         }
     }
     EmailNotificationUtil::resolveAndSendEmail($mission->owner, $recipients, static::getEmailSubject($mission), static::getEmailContent($mission));
 }