Get the list of notification for display.

@param stdClass $user The viewing user
@param int|null $groupid The forum's group id
@return      array
198623
private function get_notifications(stdClass $user, ?int $groupid) : array {
        $notifications = $this->notifications;
        $forum = $this->forum;
        $renderer = $this->renderer;
        $capabilitymanager = $this->capabilitymanager;

        if ($forum->is_cutoff_date_reached()) {
            $notifications[] = (new notification(
                    get_string('cutoffdatereached', 'forum'),
                    notification::NOTIFY_INFO
            ))->set_show_closebutton();
        } else if ($forum->is_due_date_reached()) {
            $notifications[] = (new notification(
                    get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())),
                    notification::NOTIFY_INFO
            ))->set_show_closebutton();
        } else if ($forum->has_due_date()) {
            $notifications[] = (new notification(
                    get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())),
                    notification::NOTIFY_INFO
            ))->set_show_closebutton();
        }

        if ($forum->has_blocking_enabled()) {
            $notifications[] = (new notification(
                get_string('thisforumisthrottled', 'forum', [
                    'blockafter' => $forum->get_block_after(),
                    'blockperiod' => get_string('secondstotime' . $forum->get_block_period())
                ])
            ))->set_show_closebutton();
        }

        if ($forum->is_in_group_mode() && !$capabilitymanager->can_access_all_groups($user)) {
            if ($groupid === null) {
                if (!$capabilitymanager->can_post_to_my_groups($user)) {
                    $notifications[] = (new notification(
                        get_string('cannotadddiscussiongroup', 'mod_forum'),
                        \core\output\notification::NOTIFY_WARNING
                    ))->set_show_closebutton();
                } else {
                    $notifications[] = (new notification(
                        get_string('cannotadddiscussionall', 'mod_forum'),
                        \core\output\notification::NOTIFY_WARNING
                    ))->set_show_closebutton();
                }
            } else if (!$capabilitymanager->can_access_group($user, $groupid)) {
                $notifications[] = (new notification(
                    get_string('cannotadddiscussion', 'mod_forum'),
                    \core\output\notification::NOTIFY_WARNING
                ))->set_show_closebutton();
            }
        }

        if ('qanda' === $forum->get_type() && !$capabilitymanager->can_manage_forum($user)) {
            $notifications[] = (new notification(
                get_string('qandanotify', 'forum'),
                notification::NOTIFY_INFO
            ))->set_show_closebutton();
        }

        if ('eachuser' === $forum->get_type()) {
            $notifications[] = (new notification(
                get_string('allowsdiscussions', 'forum'),
                notification::NOTIFY_INFO)
            )->set_show_closebutton();
        }

        return array_map(function($notification) {
            return $notification->export_for_template($this->renderer);
        }, $notifications);
    }
433993
public function getDepartmentUsers(int $departmentId, bool $fetchChild = false)
    {
        $params = [
            'department_id' => $departmentId,
            'fetch_child' => (int) $fetchChild,
        ];

        return $this->httpGet('cgi-bin/user/simplelist', $params);
    }
606225
public function show($id)
    {
        $user = UserRepository::find($id);
        $this->checkUser($user);

        if ($user->activated_at) {
            $activated = html_ago($user->activated_at);
        } else {
            if (Credentials::hasAccess('admin') && Config::get('credentials.activation')) {
                $activated = 'No - <a href="#resend_user" data-toggle="modal" data-target="#resend_user">Resend Email</a>';
            } else {
                $activated = 'Not Activated';
            }
        }

        if (Credentials::getThrottleProvider()->findByUserId($id)->isSuspended()) {
            $suspended = 'Currently Suspended';
        } else {
            $suspended = 'Not Suspended';
        }

        $groups = $user->getGroups();
        if (count($groups) >= 1) {
            $data = [];
            foreach ($groups as $group) {
                $data[] = $group->name;
            }
            $groups = implode(', ', $data);
        } else {
            $groups = 'No Group Memberships';
        }

        return View::make('credentials::users.show', compact('user', 'groups', 'activated', 'suspended'));
    }
54969
public function getNotificationFeed($user_id)
    {
        $user_feed = $this->config->get("stream-laravel::notification_feed");
        return $this->client->feed($user_feed, $user_id);
    }
842043
public function retrieveGroupOwners($groupId)
    {
        $uri  = self::APPS_BASE_FEED_URI . self::APPS_GROUP_PATH . '/';
        $uri .= $this->getDomain() . '/' . $groupId . '/owner';

        return $this->getOwnerFeed($uri);
    }
910866
public function GetNotifications($NotifyUserID, $Offset = '0', $Limit = '30') {
      $this->ActivityQuery(FALSE);
      $this->FireEvent('BeforeGetNotifications');
      $Result = $this->SQL
         ->Where('NotifyUserID', $NotifyUserID)
         ->Limit($Limit, $Offset)
         ->OrderBy('a.ActivityID', 'desc')
         ->Get();
      $Result->DatasetType(DATASET_TYPE_ARRAY);
      
      self::GetUsers($Result->ResultArray());
      Gdn::UserModel()->JoinUsers($Result->ResultArray(), array('ActivityUserID', 'RegardingUserID'), array('Join' => array('Name', 'Photo', 'Email', 'Gender')));
      $this->CalculateData($Result->ResultArray());
      
      return $Result;
   }
344003
public function getDefinitions($grouping = null)
    {
        if (is_null($grouping)) {
            return $this->notifications;
        } elseif (isset($this->notifications[$grouping])) {
            return $this->notifications[$grouping];
        } else {
            return [];
        }
    }
523701
@Override
	public List<CommerceNotificationQueueEntry> findByGroupId(long groupId) {
		return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
1223269
public function fetchGroupMembers($groupId)
    {
        $result = $this->_get($this->_groupUrl($groupId, '/members'));
        return Deserialize::groupMembers($result);
    }
929654
public function retrieve_group_ids(string $id_option = null, string $id_group): ?array
  {
    return $this->_retrieve_ids($id_option, null, $id_group);
  }
1174944
public function updateGroup($groupId)
    {
        $group = wei()->group()->findOrInitById($groupId);
        $ret = wei()->event->until('groupMove', [[$this['id']], $group]);
        if ($ret) {
            return $ret;
        }

        $this->save(['groupId' => $groupId]);

        return ['code' => 1, 'message' => '操作成功'];
    }
689104
private function loadAllUserGroupsIdsOfUser(User $user): array
    {
        $allUserGroups = [];
        $offset = 0;

        do {
            $userGroups = $this->userService->loadUserGroupsOfUser($user, $offset, self::USER_GROUPS_LIMIT);
            foreach ($userGroups as $userGroup) {
                $allUserGroups[] = $userGroup->contentInfo->id;
            }
            $offset += self::USER_GROUPS_LIMIT;
        } while (\count($userGroups) === self::USER_GROUPS_LIMIT);

        return $allUserGroups;
    }
1234787
public function getNotifications($id = null, $userId = null, $userRole = null) {
		$fields = [
			$this->alias . '.id',
			$this->alias . '.user_id',
			$this->alias . '.user_role',
			$this->alias . '.tag',
			$this->alias . '.title',
			$this->alias . '.body',
			$this->alias . '.data',
		];
		$conditions = [
			'AND' => [
				$this->alias . '.expires >=' => date('Y-m-d H:i:s'),
				'OR' => [
					[
						'AND' => [
							$this->alias . '.user_id' => '',
							$this->alias . '.user_role' => '',
						]
					]
				]
			]
		];
		if (!empty($id)) {
			$conditions['AND'][][$this->alias . '.id >'] = (int)$id;
		}
		if (!empty($userId)) {
			$conditions['AND']['OR'][][$this->alias . '.user_id'] = (int)$userId;
		}
		if (!empty($userRole)) {
			$conditions['AND']['OR'][]['AND'] = [
				$this->alias . '.user_role & ' . (int)$userRole . ' > 0',
				$this->alias . '.user_id' => '',
			];
		}

		$order = [$this->alias . '.id' => 'asc'];

		return $this->find('all', compact('fields', 'conditions', 'order'));
	}
372234
public function get_by_user(string $id_user){
    $cfg =& $this->class_cfg;
    // Current datetime
    $now = date('Y-m-d H:i:s');
    // Get the user's group
    $id_group = $this->db->select_one('bbn_users', 'id_group', ['id' => $id_user]);
    // Get all user's internal messages
    $messages = $this->db->get_rows("
      SELECT {$cfg['table']}.*
      FROM {$cfg['tables']['users']}
        RIGHT JOIN {$cfg['table']}
	        ON {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_user']}
	        AND {$cfg['table']}.{$cfg['arch']['imessages']['id']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_imessage']}
      WHERE (
        {$cfg['table']}.{$cfg['arch']['imessages']['start']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['start']} <= ?
      )
      AND (
        {$cfg['table']}.{$cfg['arch']['imessages']['end']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['end']} > ?
      )
      AND (
        (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = ?
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} = ?
        )
        OR (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} IS NULL
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} IS NULL
        )
      )
      AND (
        {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} IS NULL
        OR {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} = 0
      )",
      $now,
      $now,
      hex2bin($id_user),
      hex2bin($id_group)
    );
    // Get and return the imessage's info from notes archive
    return $this->from_notes($messages);
  }
549413
public function groupUserGagRollback($userId,$groupId) {
        try{
            if(empty($userId))
                throw new Exception('用户 Id 不能为空');
            if(empty($groupId))
                throw new Exception('群组 Id 不能为空');
            $params['userId'] = $userId;
            $params['groupId'] = $groupId;
            $ret = $this->curl('/group/user/gag/rollback',$params);
            if(empty($ret))
                throw new Exception('请求失败');
            return $ret;
        }catch (Exception $e) {
            print_r($e->getMessage());
        }
    }
1071297
public function getGroup(string $groupid)
    {
        $cl = $this->getGroupClass();
        $group = new $cl;
        return $group->obtainByGroupID($groupid);
    }
268443
public function queryUser($groupId) {
    	try{
			if (empty($groupId))
				throw new Exception('Paramer "groupId" is required');


    		$params = array (
    		'groupId' => $groupId
    		);

    		$ret = $this->SendRequest->curl('/group/user/query.json',$params,'urlencoded','im','POST');
    		if(empty($ret))
    			throw new Exception('bad request');
    		return $ret;

    	}catch (Exception $e) {
    		print_r($e->getMessage());
    	}
   }