Exemplo n.º 1
0
 /**
  * Checks with a setting delegate of the notification whether to notify a person or not
  *
  * @param ComPeopleDomainEntityPerson         $person
  * @param ComNotificationsDomainEntitySetting $setting
  * 
  * @return int
  */
 public function shouldNotify($person, $setting)
 {
     //if a person is not notifiable then return false
     if (!$person->isNotifiable()) {
         return false;
     }
     //check if the target allows access to the person
     if (!$this->target->allows($person, 'access')) {
         return false;
     }
     if (isset($this->object) && $this->object->isPrivatable() && !$this->object->allows($person, 'access')) {
         return false;
     }
     if ($this->type) {
         $delegate = $this->getService('com://site/notifications.domain.delegate.setting.' . $this->type);
         return $delegate->shouldNotify($person, $this, $setting);
     } else {
         return ComNotificationsDomainDelegateSettingInterface::NOTIFY_WITH_EMAIL;
     }
 }