本文整理汇总了PHP中CSocNetFeaturesPerms::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeaturesPerms::GetList方法的具体用法?PHP CSocNetFeaturesPerms::GetList怎么用?PHP CSocNetFeaturesPerms::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetFeaturesPerms
的用法示例。
在下文中一共展示了CSocNetFeaturesPerms::GetList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetOperationPerm
function GetOperationPerm($type, $id, $feature, $operation)
{
global $arSocNetAllowedEntityTypes;
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
$type = Trim($type);
if (StrLen($type) <= 0 || !in_array($type, $arSocNetAllowedEntityTypes)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_ENTITY_TYPE"), "ERROR_EMPTY_TYPE");
if (is_array($id)) {
$arReturn = array();
foreach ($id as $TmpGroupID) {
$arReturn[$TmpGroupID] = false;
}
return $arReturn;
} else {
return false;
}
}
$feature = StrToLower(Trim($feature));
if (StrLen($feature) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_FEATURE_ID"), "ERROR_EMPTY_FEATURE_ID");
if (is_array($id)) {
$arReturn = array();
foreach ($id as $TmpGroupID) {
$arReturn[$TmpGroupID] = false;
}
return $arReturn;
} else {
return false;
}
}
if (!array_key_exists($feature, $arSocNetFeaturesSettings) || !array_key_exists("allowed", $arSocNetFeaturesSettings[$feature]) || !in_array($type, $arSocNetFeaturesSettings[$feature]["allowed"])) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_FEATURE_ID"), "ERROR_NO_FEATURE_ID");
if (is_array($id)) {
$arReturn = array();
foreach ($id as $TmpGroupID) {
$arReturn[$TmpGroupID] = false;
}
return $arReturn;
} else {
return false;
}
}
$operation = StrToLower(Trim($operation));
if (!array_key_exists("operations", $arSocNetFeaturesSettings[$feature]) || !array_key_exists($operation, $arSocNetFeaturesSettings[$feature]["operations"])) {
if (is_array($id)) {
$arReturn = array();
foreach ($id as $TmpGroupID) {
$arReturn[$TmpGroupID] = false;
}
return $arReturn;
} else {
return false;
}
}
global $arSonetFeaturesPermsCache;
if (!isset($arSonetFeaturesPermsCache) || !is_array($arSonetFeaturesPermsCache)) {
$arSonetFeaturesPermsCache = array();
}
if (is_array($id)) {
$arFeaturesPerms = array();
$arGroupToGet = array();
foreach ($id as $TmpGroupID) {
$arFeaturesPerms[$TmpGroupID] = array();
if (!array_key_exists($type . "_" . $TmpGroupID, $arSonetFeaturesPermsCache)) {
$arGroupToGet[] = $TmpGroupID;
} else {
$arFeaturesPerms[$TmpGroupID] = $arSonetFeaturesPermsCache[$type . "_" . $TmpGroupID];
}
}
if (!empty($arGroupToGet)) {
$dbResult = CSocNetFeaturesPerms::GetList(array(), array("FEATURE_ENTITY_ID" => $arGroupToGet, "FEATURE_ENTITY_TYPE" => $type, "GROUP_FEATURE_ACTIVE" => "Y"), false, false, array("OPERATION_ID", "FEATURE_ENTITY_ID", "FEATURE_FEATURE", "ROLE"));
while ($arResult = $dbResult->Fetch()) {
if (!array_key_exists($arResult["FEATURE_ENTITY_ID"], $arFeaturesPerms) || !array_key_exists($arResult["FEATURE_FEATURE"], $arFeaturesPerms[$arResult["FEATURE_ENTITY_ID"]])) {
$arFeaturesPerms[$arResult["FEATURE_ENTITY_ID"]][$arResult["FEATURE_FEATURE"]] = array();
}
$arFeaturesPerms[$arResult["FEATURE_ENTITY_ID"]][$arResult["FEATURE_FEATURE"]][$arResult["OPERATION_ID"]] = $arResult["ROLE"];
}
}
$arReturn = array();
foreach ($id as $TmpEntityID) {
$arSonetFeaturesPermsCache[$type . "_" . $TmpGroupID] = $arFeaturesPerms[$TmpEntityID];
if ($type == SONET_ENTITY_GROUP) {
if (!array_key_exists($feature, $arFeaturesPerms[$TmpEntityID])) {
$featureOperationPerms = $arSocNetFeaturesSettings[$feature]["operations"][$operation][SONET_ENTITY_GROUP];
} elseif (!array_key_exists($operation, $arFeaturesPerms[$TmpEntityID][$feature])) {
$featureOperationPerms = $arSocNetFeaturesSettings[$feature]["operations"][$operation][SONET_ENTITY_GROUP];
} else {
$featureOperationPerms = $arFeaturesPerms[$TmpEntityID][$feature][$operation];
}
} else {
if (!array_key_exists($feature, $arFeaturesPerms[$TmpEntityID])) {
$featureOperationPerms = $arSocNetFeaturesSettings[$feature]["operations"][$operation][SONET_ENTITY_USER];
} elseif (!array_key_exists($operation, $arFeaturesPerms[$TmpEntityID][$feature])) {
$featureOperationPerms = $arSocNetFeaturesSettings[$feature]["operations"][$operation][SONET_ENTITY_USER];
} else {
$featureOperationPerms = $arFeaturesPerms[$TmpEntityID][$feature][$operation];
}
if ($featureOperationPerms == SONET_RELATIONS_TYPE_FRIENDS2) {
$featureOperationPerms = SONET_RELATIONS_TYPE_FRIENDS;
}
//.........这里部分代码省略.........