예제 #1
0
 public function getUsersToNotify(SubscriptionInterface $subscription, SubjectInterface $subject)
 {
     $key = Key::getByHandle('notify_in_notification_center');
     $users = array();
     if (is_object($key)) {
         $access = $key->getPermissionAssignmentObject()->getPermissionAccessObject();
         if (is_object($access)) {
             /**
              * @var $access Access
              */
             $items = $access->getAccessListItems(Key::ACCESS_TYPE_INCLUDE);
             /**
              * @var $item NotifyInNotificationCenterNotificationListItem
              */
             foreach ($items as $item) {
                 if ($item->getSubscriptionsAllowedPermission() == 'A' || $item->getSubscriptionsAllowedPermission() == 'C' && in_array($subscription, $item->getSubscriptionsAllowedArray())) {
                     /**
                      * @var $entity Entity
                      */
                     $entity = $item->getAccessEntityObject();
                     $users = array_merge($entity->getAccessEntityUsers($access), $users);
                 }
             }
             // Now we loop through the array and remove
             $items = $access->getAccessListItems(Key::ACCESS_TYPE_EXCLUDE);
             /**
              * @var $item NotifyInNotificationCenterNotificationListItem
              */
             $usersToRemove = array();
             foreach ($subject->getUsersToExcludeFromNotification() as $user) {
                 $usersToRemove[] = $user->getUserID();
             }
             foreach ($items as $item) {
                 if ($item->getSubscriptionsAllowedPermission() == 'N' || $item->getSubscriptionsAllowedPermission() == 'C' && in_array($subscription, $item->getSubscriptionsAllowedArray())) {
                     /**
                      * @var $entity Entity
                      */
                     $entity = $item->getAccessEntityObject();
                     foreach ($entity->getAccessEntityUsers($access) as $user) {
                         $usersToRemove[] = $user->getUserID();
                     }
                 }
             }
             $users = array_unique($users);
             $usersToRemove = array_unique($usersToRemove);
             $users = array_filter($users, function ($element) use($usersToRemove) {
                 if (in_array($element->getUserID(), $usersToRemove)) {
                     return false;
                 }
                 return true;
             });
         }
     }
     return $users;
 }
 /**
  * @param SubscriptionInterface $subscription
  * @param PrivateMessage $subject
  */
 public function getUsersToNotify(SubscriptionInterface $subscription, SubjectInterface $subject)
 {
     return array($subject->getMessageUserToObject());
 }
예제 #3
0
 public function __construct(SubjectInterface $subject)
 {
     $this->nDate = $subject->getNotificationDate();
 }
 /**
  * UserSignupNotification constructor.
  * @param $message NewMessage
  */
 public function __construct(SubjectInterface $message)
 {
     $this->cnvMessageID = $message->getConversationMessage()->getConversationMessageID();
     parent::__construct($message);
 }