示例#1
0
 /**
  * Returns class instance
  *
  * @return EQUESTIONS_BOL_NotificationService
  */
 public static function getInstance()
 {
     if (null === self::$classInstance) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
示例#2
0
 public function getList()
 {
     $users = null;
     $count = null;
     if ($this->friendsMode) {
         $count = OW::getEventManager()->call('plugin.friends.count_friends', array('userId' => $this->userId));
         $users = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => $this->userId, 'count' => 500));
     }
     $hideUsers = array();
     if (!empty($this->entityId)) {
         $sentNotifications = EQUESTIONS_BOL_NotificationService::getInstance()->findSentNotificationList($this->entityId, $this->userId, 'ask');
         foreach ($sentNotifications as $notification) {
             $hideUsers[] = $notification->userId;
         }
     }
     if ($count === null) {
         $count = BOL_UserService::getInstance()->count();
     }
     if ($users === null) {
         $users = array();
         $userDtos = BOL_UserService::getInstance()->findRecentlyActiveList(0, 500);
         foreach ($userDtos as $u) {
             if ($u->id != $this->userId) {
                 $users[] = $u->id;
             }
         }
     }
     $out = array();
     foreach ($users as $user) {
         if (!in_array($user, $hideUsers)) {
             $out[] = $user;
         }
     }
     return array('count' => $count - 1, 'idList' => $out);
 }
示例#3
0
 public function onQuestionRemove(OW_Event $e)
 {
     $params = $e->getParams();
     $list = $this->service->findNotificationListByQuestionId($params['id']);
     foreach ($list as $notification) {
         $this->deleteInvitation($notification->id);
     }
 }