当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetFeaturesPerms::GetList方法代码示例

本文整理汇总了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;
                 }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:group_features_perms.php


注:本文中的CSocNetFeaturesPerms::GetList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。