本文整理汇总了PHP中Groups::getGroupmates方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::getGroupmates方法的具体用法?PHP Groups::getGroupmates怎么用?PHP Groups::getGroupmates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::getGroupmates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isVisibleTo
/**
* @param User $user
* @return bool true if event is visible to user, false otherwiser
*/
public function isVisibleTo($user)
{
if (Yii::app()->params->isAdmin) {
return true;
}
if (!$user) {
return false;
}
$assignedUser = null;
if ($this->associationType === 'User') {
$assignedUser = User::model()->findByPk($this->associationId);
}
switch (Yii::app()->settings->historyPrivacy) {
case 'group':
if (in_array($this->user, Groups::getGroupmates($user->id)) || $this->associationType === 'User' && $assignedUser && in_array($assignedUser->username, Groups::getGroupmates($user->id))) {
return true;
}
// fall through
// fall through
case 'user':
if ($this->user === $user->username || $this->associationType === 'User' && $this->associationId === $user->id) {
return true;
}
break;
default:
// default history privacy (public or assigned)
return $this->user === $user->username || $this->visibility || $this->associationType === 'User' && $this->associationId === $user->id;
}
return false;
}
示例2: getGroupmatesRegex
public static function getGroupmatesRegex()
{
$groupmates = Groups::getGroupmates(Yii::app()->getSuId());
return empty($groupmates) ? null : self::getUsernameListRegex($groupmates);
}