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


PHP CSocNetFeatures::CheckFields方法代码示例

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


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

示例1: Add

 /**
  * <p>Сохраняет в базу запись о новом дополнительном функционале пользователя или группы.</p>
  *
  *
  * @param array $arFields  Параметры дополнительного функционала.
  *
  * @return int <p>Код записи, если сохранение прошло успешно. False - в противном
  * случае.</p> <br><br>
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/csocnetfeatures/csocnetfeatures.add.php
  * @author Bitrix
  */
 public static function Add($arFields)
 {
     global $DB;
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSocNetFeatures::CheckFields("ADD", $arFields)) {
         return false;
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetFeaturesAdd");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($arFields)) === false) {
             return false;
         }
     }
     $arInsert = $DB->PrepareInsert("b_sonet_features", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($arInsert[0]) > 0) {
             $arInsert[0] .= ", ";
         }
         $arInsert[0] .= $key;
         if (strlen($arInsert[1]) > 0) {
             $arInsert[1] .= ", ";
         }
         $arInsert[1] .= $value;
     }
     $ID = false;
     if (strlen($arInsert[0]) > 0) {
         $strSql = "INSERT INTO b_sonet_features(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $ID = IntVal($DB->LastID());
         if (array_key_exists("ENTITY_TYPE", $arFields) && array_key_exists("ENTITY_ID", $arFields)) {
             unset($GLOBALS["SONET_FEATURES_CACHE"][$arFields["ENTITY_TYPE"]][$arFields["ENTITY_ID"]]);
         }
         $events = GetModuleEvents("socialnetwork", "OnSocNetFeaturesAdd");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, $arFields));
         }
         if (defined("BX_COMP_MANAGED_CACHE") && array_key_exists("ENTITY_TYPE", $arFields) && array_key_exists("ENTITY_ID", $arFields)) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_features_" . $arFields["ENTITY_TYPE"] . "_" . $arFields["ENTITY_ID"]);
         }
     }
     return $ID;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:61,代码来源:group_features.php

示例2: Update

 function Update($ID, $arFields)
 {
     global $DB;
     if (!CSocNetGroup::__ValidateID($ID)) {
         return false;
     }
     $ID = IntVal($ID);
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSocNetFeatures::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetFeaturesUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, $arFields)) === false) {
             return false;
         }
     }
     $strUpdate = $DB->PrepareUpdate("b_sonet_features", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         $strSql = "UPDATE b_sonet_features SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if (array_key_exists("ENTITY_TYPE", $arFields) && array_key_exists("ENTITY_ID", $arFields)) {
             unset($GLOBALS["SONET_FEATURES_CACHE"][$arFields["ENTITY_TYPE"]][$arFields["ENTITY_ID"]]);
         }
         $events = GetModuleEvents("socialnetwork", "OnSocNetFeaturesUpdate");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, $arFields));
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_feature_" . $ID);
         }
     } else {
         $ID = False;
     }
     return $ID;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:48,代码来源:group_features.php


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