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


PHP CCatalogGroup::arBaseGroupCache方法代码示例

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


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

示例1: Update

 function Update($ID, $arFields)
 {
     global $DB, $CACHE_MANAGER, $stackCacheManager;
     $ID = (int) $ID;
     if ($ID <= 0) {
         return false;
     }
     foreach (GetModuleEvents("catalog", "OnBeforeGroupUpdate", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     if (!CCatalogGroup::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_group", $arFields);
     if (!empty($strUpdate)) {
         if (isset($arFields["BASE"]) && $arFields["BASE"] == "Y") {
             $strBaseUpdate = "BASE = 'N', TIMESTAMP_X = " . $DB->GetNowFunction();
             if (array_key_exists('MODIFIED_BY', $arFields)) {
                 $strBaseUpdate .= ", MODIFIED_BY = " . $arFields["MODIFIED_BY"];
             }
             $strSql = "UPDATE b_catalog_group SET " . $strBaseUpdate . " WHERE ID != " . $ID . " AND BASE = 'Y'";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             self::$arBaseGroupCache = array();
             if (defined('CATALOG_GLOBAL_VARS') && 'Y' == CATALOG_GLOBAL_VARS) {
                 global $CATALOG_BASE_GROUP;
                 $CATALOG_BASE_GROUP = self::$arBaseGroupCache;
             }
         }
         $strSql = "UPDATE b_catalog_group SET " . $strUpdate . " WHERE ID = " . $ID;
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     if (isset($arFields["USER_GROUP"]) && is_array($arFields["USER_GROUP"]) && !empty($arFields["USER_GROUP"])) {
         $DB->Query("DELETE FROM b_catalog_group2group WHERE CATALOG_GROUP_ID = " . $ID . " AND BUY <> 'Y'");
         foreach ($arFields["USER_GROUP"] as &$intValue) {
             $strSql = "INSERT INTO b_catalog_group2group(CATALOG_GROUP_ID, GROUP_ID, BUY) VALUES(" . $ID . ", " . $intValue . ", 'N')";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         if (isset($intValue)) {
             unset($intValue);
         }
     }
     if (isset($arFields["USER_GROUP_BUY"]) && is_array($arFields["USER_GROUP_BUY"]) && !empty($arFields["USER_GROUP_BUY"])) {
         $DB->Query("DELETE FROM b_catalog_group2group WHERE CATALOG_GROUP_ID = " . $ID . " AND BUY = 'Y'");
         foreach ($arFields["USER_GROUP_BUY"] as &$intValue) {
             $strSql = "INSERT INTO b_catalog_group2group(CATALOG_GROUP_ID, GROUP_ID, BUY) VALUES(" . $ID . ", " . $intValue . ", 'Y')";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         if (isset($intValue)) {
             unset($intValue);
         }
     }
     if (isset($arFields["USER_LANG"]) && is_array($arFields["USER_LANG"]) && !empty($arFields["USER_LANG"])) {
         $DB->Query("DELETE FROM b_catalog_group_lang WHERE CATALOG_GROUP_ID = " . $ID);
         foreach ($arFields["USER_LANG"] as $key => $value) {
             $strSql = "INSERT INTO b_catalog_group_lang(CATALOG_GROUP_ID, LANG, NAME) VALUES(" . $ID . ", '" . $DB->ForSql($key) . "', '" . $DB->ForSql($value) . "')";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
     }
     if (!defined("CATALOG_SKIP_CACHE") || !CATALOG_SKIP_CACHE) {
         $CACHE_MANAGER->CleanDir("catalog_group");
         $CACHE_MANAGER->Clean("catalog_group_perms");
     }
     $stackCacheManager->Clear("catalog_GetQueryBuildArrays");
     $stackCacheManager->Clear("catalog_discount");
     foreach (GetModuleEvents("catalog", "OnGroupUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:71,代码来源:cataloggroup.php


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