本文整理汇总了PHP中CBXFeatures::isFeatureEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP CBXFeatures::isFeatureEnabled方法的具体用法?PHP CBXFeatures::isFeatureEnabled怎么用?PHP CBXFeatures::isFeatureEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBXFeatures
的用法示例。
在下文中一共展示了CBXFeatures::isFeatureEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}