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


PHP CUser::clearUserGroupCache方法代码示例

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


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

示例1: Add

 public function Add($arFields)
 {
     /** @global CMain $APPLICATION */
     global $DB, $APPLICATION;
     if (!$this->CheckFields($arFields)) {
         return false;
     }
     foreach (GetModuleEvents("main", "OnBeforeGroupAdd", true) as $arEvent) {
         $bEventRes = ExecuteModuleEventEx($arEvent, array(&$arFields));
         if ($bEventRes === false) {
             if ($err = $APPLICATION->GetException()) {
                 $this->LAST_ERROR .= $err->GetString() . "<br>";
             } else {
                 $this->LAST_ERROR .= "Unknown error in OnBeforeGroupAdd handler." . "<br>";
             }
             return false;
         }
     }
     if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
         $arFields["ACTIVE"] = "N";
     }
     $arInsert = $DB->PrepareInsert("b_group", $arFields);
     $strSql = "\n\t\t\tINSERT INTO b_group (\n\t\t\t\t" . $arInsert[0] . "\n\t\t\t) VALUES(\n\t\t\t\t" . $arInsert[1] . "\n\t\t\t)\n\t\t";
     $DB->Query($strSql);
     $ID = $DB->LastID();
     if (count($arFields["USER_ID"]) > 0) {
         if (is_array($arFields["USER_ID"][0]) && count($arFields["USER_ID"][0]) > 0) {
             $arTmp = array();
             foreach ($arFields["USER_ID"] as $userId) {
                 if (intval($userId["USER_ID"]) > 0 && !in_array(intval($userId["USER_ID"]), $arTmp)) {
                     $arInsert = $DB->PrepareInsert("b_user_group", $userId);
                     $strSql = "INSERT INTO b_user_group(GROUP_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")";
                     $DB->Query($strSql);
                     $arTmp[] = intval($userId["USER_ID"]);
                 }
             }
         } else {
             $strUsers = "0";
             foreach ($arFields["USER_ID"] as $userId) {
                 $strUsers .= "," . intval($userId);
             }
             $strSql = "INSERT INTO b_user_group(GROUP_ID, USER_ID) " . "SELECT " . $ID . ", ID " . "FROM b_user " . "WHERE ID in (" . $strUsers . ")";
             $DB->Query($strSql);
         }
         CUser::clearUserGroupCache();
     }
     $arFields["ID"] = $ID;
     foreach (GetModuleEvents("main", "OnAfterGroupAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     return $ID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:52,代码来源:user.php

示例2: Delete

 function Delete($ID)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $DB;
     $ID = intval($ID);
     if ($ID <= 2) {
         return false;
     }
     @set_time_limit(600);
     foreach (GetModuleEvents("main", "OnBeforeGroupDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
             if ($ex = $APPLICATION->GetException()) {
                 $err .= ': ' . $ex->GetString();
             }
             $APPLICATION->throwException($err);
             return false;
         }
     }
     foreach (GetModuleEvents("main", "OnGroupDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     CMain::DelGroupRight("", array($ID));
     if (!$DB->Query("DELETE FROM b_user_group WHERE GROUP_ID=" . $ID . " AND GROUP_ID>2", true)) {
         return false;
     }
     CUser::clearUserGroupCache();
     return $DB->Query("DELETE FROM b_group WHERE ID=" . $ID . " AND ID>2", true);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:29,代码来源:user.php


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