本文整理匯總了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);
}