本文整理汇总了PHP中CSocNetUserToGroup::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserToGroup::getList方法的具体用法?PHP CSocNetUserToGroup::getList怎么用?PHP CSocNetUserToGroup::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUserToGroup
的用法示例。
在下文中一共展示了CSocNetUserToGroup::getList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserGroupWithStorage
protected function getUserGroupWithStorage()
{
if (!\CBXFeatures::isFeatureEnabled("Workgroups")) {
return array();
}
if (!Loader::includeModule('socialnetwork')) {
return array();
}
$userId = $this->getUser()->getId();
$currentPossibleUserGroups = $currentUserGroups = array();
$cache = Cache::createInstance();
$cacheTtl = defined('BX_COMP_MANAGED_CACHE') ? 3153600 : 3600 * 4;
$cachePath = "/disk/uf/{$userId}";
if ($cache->initCache($cacheTtl, 'group_storage_list_' . SITE_ID . '_' . $userId, $cachePath)) {
list($currentUserGroups) = $cache->getVars();
} else {
$cache->startDataCache();
$taggedCache = Application::getInstance()->getTaggedCache();
$taggedCache->startTagCache($cachePath);
$diskSecurityContext = new DiskSecurityContext($userId);
$storages = Storage::getReadableList($diskSecurityContext, array('filter' => array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className())));
foreach ($storages as $storage) {
$currentPossibleUserGroups[$storage->getEntityId()] = $storage;
}
unset($storage);
$query = \CSocNetUserToGroup::getList(array('GROUP_NAME' => 'ASC'), array('USER_ID' => $userId, 'GROUP_ID' => array_keys($currentPossibleUserGroups)), false, false, array('GROUP_ID', 'GROUP_NAME', 'GROUP_ACTIVE', 'GROUP_CLOSED', 'ROLE'));
while ($row = $query->getNext()) {
if ($row['GROUP_ACTIVE'] == 'Y' && $row['GROUP_CLOSED'] == 'N' && $row['ROLE'] != SONET_ROLES_BAN && $row['ROLE'] != SONET_ROLES_REQUEST && isset($currentPossibleUserGroups[$row['GROUP_ID']])) {
$taggedCache->registerTag("sonet_features_G_{$row['GROUP_ID']}");
$taggedCache->registerTag("sonet_group_{$row['GROUP_ID']}");
$currentUserGroups[$row['GROUP_ID']] = array('STORAGE' => $currentPossibleUserGroups[$row['GROUP_ID']], 'NAME' => $row['GROUP_NAME']);
}
}
$taggedCache->registerTag("sonet_user2group_U{$userId}");
$taggedCache->endTagCache();
$cache->endDataCache(array($currentUserGroups));
}
return $currentUserGroups;
}
示例2: getUserGroupWithStorage
protected function getUserGroupWithStorage()
{
if (!\CBXFeatures::isFeatureEnabled("Workgroups")) {
return array();
}
if (!Loader::includeModule('socialnetwork')) {
return array();
}
$userId = $this->getUser()->getId();
$currentPossibleUserGroups = $currentUserGroups = array();
$diskSecurityContext = new DiskSecurityContext($this->getUser()->getId());
$storages = Storage::getReadableList($diskSecurityContext, array('filter' => array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className())));
foreach ($storages as $storage) {
$currentPossibleUserGroups[$storage->getEntityId()] = $storage;
}
unset($storage);
$query = \CSocNetUserToGroup::getList(array('GROUP_NAME' => 'ASC'), array('USER_ID' => $userId, 'GROUP_ID' => array_keys($currentPossibleUserGroups)), false, false, array('GROUP_ID', 'GROUP_NAME', 'GROUP_ACTIVE', 'GROUP_CLOSED', 'ROLE'));
while ($row = $query->getNext()) {
if ($row['GROUP_ACTIVE'] == 'Y' && $row['GROUP_CLOSED'] == 'N' && $row['ROLE'] != SONET_ROLES_BAN && $row['ROLE'] != SONET_ROLES_REQUEST && isset($currentPossibleUserGroups[$row['GROUP_ID']])) {
$currentUserGroups[$row['GROUP_ID']] = array('STORAGE' => $currentPossibleUserGroups[$row['GROUP_ID']], 'NAME' => $row['GROUP_NAME']);
}
}
return $currentUserGroups;
}
示例3: getUsersFromUserGroup
public static function getUsersFromUserGroup($group, $documentId)
{
if (substr($documentId, 0, 8) == "STORAGE_") {
$storageId = self::getStorageIdByType($documentId);
} else {
if (is_array($documentId)) {
$documentId = intval($documentId[2]);
}
/** @var File $file */
$file = File::loadById($documentId);
if (!$file) {
return array();
}
$storageId = $file->getStorageId();
}
if (strtolower($group) == "author") {
$documentId = intval($documentId);
if ($documentId <= 0) {
return array();
}
/** @var File $file */
$file = File::loadById($documentId);
if (!$file) {
return array();
}
return array($file->getCreatedBy());
}
if ($storageId) {
$storage = Storage::loadById($storageId, array('ROOT_OBJECT'));
if ($storage->getProxyType() instanceof ProxyType\Group) {
$entityId = $storage->getEntityId();
$group = strtoupper($group);
if (Loader::includeModule("socialnetwork")) {
$listUserGroup = array();
if ($group == SONET_ROLES_OWNER) {
$listGroup = \CSocNetGroup::getByID($entityId);
if ($listGroup) {
$listUserGroup[] = $listGroup["OWNER_ID"];
}
} elseif ($group == SONET_ROLES_MODERATOR) {
$dbRes = \CSocNetUserToGroup::getList(array(), array("GROUP_ID" => $entityId, "<=ROLE" => SONET_ROLES_MODERATOR, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
while ($res = $dbRes->fetch()) {
$listUserGroup[] = $res["USER_ID"];
}
} elseif ($group == SONET_ROLES_USER) {
$dbRes = \CSocNetUserToGroup::getList(array(), array("GROUP_ID" => $entityId, "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
while ($res = $dbRes->fetch()) {
$listUserGroup[] = $res["USER_ID"];
}
}
return $listUserGroup;
}
}
}
$group = intval($group);
if ($group <= 0) {
return array();
}
$userIds = array();
$filter = array("ACTIVE" => "Y");
if ($group != 2) {
$filter["GROUPS_ID"] = $group;
}
$query = \CUser::getList($b = "ID", $o = "ASC", $filter);
while ($user = $query->fetch()) {
$userIds[] = $user["ID"];
}
return $userIds;
}
示例4: onSocNetUserToGroupAdd
public static function onSocNetUserToGroupAdd($id, $fields)
{
if (isset($fields['ROLE']) && isset($fields['USER_ID']) && ($fields['ROLE'] == SONET_ROLES_USER || $fields['ROLE'] == SONET_ROLES_MODERATOR || $fields['ROLE'] == SONET_ROLES_OWNER)) {
if (!isset($fields['GROUP_ID'])) {
$query = \CSocNetUserToGroup::getList(array(), array('ID' => $id), false, false, array('GROUP_ID', 'INITIATED_BY_USER_ID'));
if ($query) {
$row = $query->fetch();
if ($row) {
$groupId = $row['GROUP_ID'];
}
}
} else {
$groupId = $fields['GROUP_ID'];
}
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (!empty($groupId) && \CSocNetFeatures::isActiveFeature(SONET_ENTITY_GROUP, $groupId, 'files')) {
$storage = Driver::getInstance()->getStorageByGroupId($groupId);
if (!$storage) {
return;
}
$rootObject = $storage->getRootObject();
if (!$rootObject->canRead($storage->getSecurityContext($fields['USER_ID']))) {
return;
}
$errorCollection = new ErrorCollection();
Sharing::connectToUserStorage($fields['USER_ID'], array('CREATED_BY' => empty($fields['INITIATED_BY_USER_ID']) ? $fields['USER_ID'] : $fields['INITIATED_BY_USER_ID'], 'REAL_OBJECT' => $storage->getRootObject()), $errorCollection);
}
}
}