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


PHP CSocNetFeatures::GetByID方法代码示例

本文整理汇总了PHP中CSocNetFeatures::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeatures::GetByID方法的具体用法?PHP CSocNetFeatures::GetByID怎么用?PHP CSocNetFeatures::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetFeatures的用法示例。


在下文中一共展示了CSocNetFeatures::GetByID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SetPerm

 function SetPerm($featureID, $operation, $perm)
 {
     $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
     $featureID = IntVal($featureID);
     $operation = Trim($operation);
     $perm = Trim($perm);
     $dbResult = CSocNetFeaturesPerms::GetList(array(), array("FEATURE_ID" => $featureID, "OPERATION_ID" => $operation), false, false, array("ID", "FEATURE_ENTITY_TYPE", "FEATURE_ENTITY_ID", "FEATURE_FEATURE", "OPERATION_ID", "ROLE"));
     if ($arResult = $dbResult->Fetch()) {
         $r = CSocNetFeaturesPerms::Update($arResult["ID"], array("ROLE" => $perm));
     } else {
         $r = CSocNetFeaturesPerms::Add(array("FEATURE_ID" => $featureID, "OPERATION_ID" => $operation, "ROLE" => $perm));
     }
     if (!$r) {
         $errorMessage = "";
         if ($e = $GLOBALS["APPLICATION"]->GetException()) {
             $errorMessage = $e->GetString();
         }
         if (StrLen($errorMessage) <= 0) {
             $errorMessage = GetMessage("SONET_GF_ERROR_SET") . ".";
         }
         $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_SET_RECORD");
         return false;
     } else {
         if (!$arResult) {
             $arFeature = CSocNetFeatures::GetByID($featureID);
             $entity_type = $arFeature["ENTITY_TYPE"];
             $entity_id = $arFeature["ENTITY_ID"];
             $feature = $arFeature["FEATURE"];
         } else {
             $entity_type = $arResult["FEATURE_ENTITY_TYPE"];
             $entity_id = $arResult["FEATURE_ENTITY_ID"];
             $feature = $arResult["FEATURE_FEATURE"];
         }
         if (empty($arResult) || $arResult["ROLE"] != $perm) {
             if ($arResult && $arResult["ROLE"] != $perm) {
                 CSocNetSearch::SetFeaturePermissions($entity_type, $entity_id, $feature, $arResult["OPERATION_ID"], $perm);
             } else {
                 CSocNetSearch::SetFeaturePermissions($entity_type, $entity_id, $feature, $operation, $perm);
             }
         }
         if (!in_array($feature, array("tasks", "files", "blog")) && is_array($arSocNetFeaturesSettings[$feature]["subscribe_events"])) {
             $arEventsTmp = array_keys($arSocNetFeaturesSettings[$feature]["subscribe_events"]);
             $rsLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => $arEventsTmp), false, false, array("ID", "EVENT_ID"));
             while ($arLog = $rsLog->Fetch()) {
                 CSocNetLogRights::DeleteByLogID($arLog["ID"]);
                 CSocNetLogRights::SetForSonet($arLog["ID"], $entity_type, $entity_id, $feature, $arSocNetFeaturesSettings[$feature]["subscribe_events"][$arLog["EVENT_ID"]]["OPERATION"]);
             }
         }
     }
     return $r;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:group_features_perms.php

示例2: SetSoNetFeaturePermIndexSearch

 function SetSoNetFeaturePermIndexSearch($ID, $arFields)
 {
     $featurePerm = CSocNetFeaturesPerms::GetByID($ID);
     if ($featurePerm["OPERATION_ID"] == "view_post") {
         if (CModule::IncludeModule("socialnetwork")) {
             $feature = CSocNetFeatures::GetByID($featurePerm["FEATURE_ID"]);
             if ($feature["FEATURE"] == "blog" && IntVal($feature["ENTITY_ID"]) > 0) {
                 if ($feature["ACTIVE"] == "Y" && ($feature["ENTITY_TYPE"] == "U" && $arFields["ROLE"] == "A" || $feature["ENTITY_TYPE"] == "G" && $arFields["ROLE"] == "N")) {
                     $arFilter = array("USE_SOCNET" => "Y");
                     if ($feature["ENTITY_TYPE"] == "U") {
                         $arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
                     } else {
                         $arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
                     }
                     $dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
                     if ($arBlog = $dbBlog->Fetch()) {
                         CBlog::AddSocnetRead($arBlog["ID"]);
                     }
                 } else {
                     $arFilter = array("USE_SOCNET" => "Y");
                     if ($feature["ENTITY_TYPE"] == "U") {
                         $arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
                     } else {
                         $arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
                     }
                     $dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
                     if ($arBlog = $dbBlog->Fetch()) {
                         CBlog::DeleteSocnetRead($arBlog["ID"]);
                     }
                 }
                 if ($arBlog && intval($arBlog["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork") && method_exists("CSocNetGroup", "GetSite")) {
                     $arSites = array();
                     $rsGroupSite = CSocNetGroup::GetSite($arBlog["SOCNET_GROUP_ID"]);
                     while ($arGroupSite = $rsGroupSite->Fetch()) {
                         $arSites[] = $arGroupSite["LID"];
                     }
                 } else {
                     $arSites = array(SITE_ID);
                 }
                 foreach ($arSites as $site_id_tmp) {
                     BXClearCache(True, "/" . $site_id_tmp . "/blog/sonet/");
                 }
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:46,代码来源:blog_search.php

示例3: CheckFields

 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     global $DB, $arSocNetAllowedEntityTypes;
     if ($ACTION != "ADD" && IntVal($ID) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException("System error 870164", "ERROR");
         return false;
     }
     if ((is_set($arFields, "ENTITY_TYPE") || $ACTION == "ADD") && StrLen($arFields["ENTITY_TYPE"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_ENTITY_TYPE"), "EMPTY_ENTITY_TYPE");
         return false;
     } elseif (is_set($arFields, "ENTITY_TYPE")) {
         if (!in_array($arFields["ENTITY_TYPE"], $arSocNetAllowedEntityTypes)) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_ENTITY_TYPE"), "ERROR_NO_ENTITY_TYPE");
             return false;
         }
     }
     if ((is_set($arFields, "ENTITY_ID") || $ACTION == "ADD") && IntVal($arFields["ENTITY_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_ENTITY_ID"), "EMPTY_ENTITY_ID");
         return false;
     } elseif (is_set($arFields, "ENTITY_ID")) {
         $type = "";
         if (is_set($arFields, "ENTITY_TYPE")) {
             $type = $arFields["ENTITY_TYPE"];
         } elseif ($ACTION != "ADD") {
             $arRe = CSocNetFeatures::GetByID($ID);
             if ($arRe) {
                 $type = $arRe["ENTITY_TYPE"];
             }
         }
         if (StrLen($type) <= 0) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_CALC_ENTITY_TYPE"), "ERROR_CALC_ENTITY_TYPE");
             return false;
         }
         if ($type == SONET_ENTITY_GROUP) {
             $arResult = CSocNetGroup::GetByID($arFields["ENTITY_ID"]);
             if ($arResult == false) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
                 return false;
             }
         } elseif ($type == SONET_ENTITY_USER) {
             $dbResult = CUser::GetByID($arFields["ENTITY_ID"]);
             if (!$dbResult->Fetch()) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
                 return false;
             }
         } else {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_CALC_ENTITY_TYPE"), "ERROR_CALC_ENTITY_TYPE");
             return false;
         }
     }
     if ((is_set($arFields, "FEATURE") || $ACTION == "ADD") && StrLen($arFields["FEATURE"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_FEATURE_ID"), "EMPTY_FEATURE");
         return false;
     } elseif (is_set($arFields, "FEATURE")) {
         $arFields["FEATURE"] = strtolower($arFields["FEATURE"]);
         $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
         if (!array_key_exists($arFields["FEATURE"], $arSocNetFeaturesSettings)) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_FEATURE_ID"), "ERROR_NO_FEATURE");
             return false;
         }
     }
     if (is_set($arFields, "DATE_CREATE") && !$DB->IsDate($arFields["DATE_CREATE"], false, LANG, "FULL")) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GB_EMPTY_DATE_CREATE"), "EMPTY_DATE_CREATE");
         return false;
     }
     if (is_set($arFields, "DATE_UPDATE") && !$DB->IsDate($arFields["DATE_UPDATE"], false, LANG, "FULL")) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GB_EMPTY_DATE_UPDATE"), "EMPTY_DATE_UPDATE");
         return false;
     }
     if ((is_set($arFields, "ACTIVE") || $ACTION == "ADD") && $arFields["ACTIVE"] != "Y" && $arFields["ACTIVE"] != "N") {
         $arFields["ACTIVE"] = "Y";
     }
     return True;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:74,代码来源:group_features.php


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