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


PHP CUser::GetUserGroupList方法代码示例

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


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

示例1: array

    if ($user["UF_USER_PARENT"]) {
        $counter[$user["UF_USER_PARENT"]][] = $user;
    }
}
$table = array();
foreach ($counter as $uid => $joined) {
    $ampUsers = array();
    $arFilter = array("DATE_REGISTER_1" => $date_from, "DATE_REGISTER_2" => $date_to, "UF_USER_PARENT" => $uid);
    $ampUsersObj = CUser::GetList($sort = "id", $direct = "asc", $arFilter, array("SELECT" => array("UF_*")));
    while ($ampUser = $ampUsersObj->Fetch()) {
        $ampUsers[$ampUser["UF_USER_PARENT"]] = $ampUser;
    }
    if (!empty($ampUsers[$uid])) {
        $amp = CUser::GetByID($uid)->Fetch();
        $arName = array($amp["NAME"], $amp["LAST_NAME"]);
        $ampGroupsObj = CUser::GetUserGroupList($amp["ID"]);
        $ampGroups = array();
        while ($ampGroup = $ampGroupsObj->Fetch()) {
            if (array_key_exists($ampGroup["GROUP_ID"], $groups)) {
                $ampGroups[] = $groups[$ampGroup["GROUP_ID"]];
            }
        }
        $arr = array("profile" => "/club/user/{$amp["ID"]}/", "group" => implode("<br />", $ampGroups), "id" => $amp["ID"], "login" => $amp["LOGIN"], "name" => implode(" ", $arName), "list" => $joined, "city" => $amp["PERSONAL_CITY"]);
        $table[] = $arr;
    }
}
?>

<style type="text/css">
	.stat-table{
		width: 100%;
开发者ID:dayAlone,项目名称:MyQube,代码行数:31,代码来源:stats_detail.php

示例2: SetUserGroup

 function SetUserGroup($USER_ID, $arGroups)
 {
     global $DB;
     $USER_ID = intval($USER_ID);
     if ($USER_ID === 0) {
         return false;
     }
     $log = COption::GetOptionString("main", "event_log_user_groups", "N") === "Y";
     if ($log) {
         //remember previous groups of the user
         $aPrevGroups = array();
         $res = CUser::GetUserGroupList($USER_ID);
         while ($res_arr = $res->Fetch()) {
             if ($res_arr["GROUP_ID"] != 2) {
                 $aPrevGroups[] = $res_arr["GROUP_ID"];
             }
         }
     }
     $DB->Query("DELETE FROM b_user_group WHERE USER_ID=" . $USER_ID, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
     if (is_array($arGroups)) {
         $arTmp = array();
         foreach ($arGroups as $group) {
             if (!is_array($group)) {
                 $group = array("GROUP_ID" => $group);
             }
             $group_id = intval($group["GROUP_ID"]);
             if ($group_id > 0 && $group_id != 2 && !isset($arTmp[$group_id])) {
                 $arInsert = $DB->PrepareInsert("b_user_group", $group);
                 $strSql = "\n\t\t\t\t\t\tINSERT INTO b_user_group (\n\t\t\t\t\t\t\tUSER_ID, " . $arInsert[0] . "\n\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t" . $USER_ID . ",\n\t\t\t\t\t\t\t" . $arInsert[1] . "\n\t\t\t\t\t\t)\n\t\t\t\t\t";
                 $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $arTmp[$group_id] = true;
             }
         }
         $arGroups = array_keys($arTmp);
     } else {
         $arGroups = array();
     }
     self::clearUserGroupCache($USER_ID);
     foreach (GetModuleEvents("main", "OnAfterSetUserGroup", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array("USER_ID" => $USER_ID, "GROUPS" => $arGroups));
     }
     if ($log) {
         //compare previous groups of the user with new
         /** @noinspection PhpUndefinedVariableInspection */
         $aDiff = array_diff($aPrevGroups, $arGroups);
         if (empty($aDiff)) {
             $aDiff = array_diff($arGroups, $aPrevGroups);
         }
         if (!empty($aDiff)) {
             sort($aPrevGroups);
             sort($arGroups);
             $UserName = '';
             $rsUser = CUser::GetByID($USER_ID);
             if ($arUser = $rsUser->GetNext()) {
                 $UserName = $arUser["NAME"] != "" || $arUser["LAST_NAME"] != "" ? trim($arUser["NAME"] . " " . $arUser["LAST_NAME"]) : $arUser["LOGIN"];
             }
             $res_log = array("groups" => "(" . implode(", ", $aPrevGroups) . ") => (" . implode(", ", $arGroups) . ")", "user" => $UserName);
             CEventLog::Log("SECURITY", "USER_GROUP_CHANGED", "main", $USER_ID, serialize($res_log));
         }
     }
     return null;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:62,代码来源:user.php

示例3: OnAfterUserRegister

 public static function OnAfterUserRegister($arFields)
 {
     global $DB;
     $err_mess = CRatings::err_mess() . "<br>Function: OnAfterUserRegister<br>Line: ";
     $userId = isset($arFields["USER_ID"]) ? intval($arFields["USER_ID"]) : (isset($arFields["ID"]) ? intval($arFields["ID"]) : 0);
     if ($userId > 0) {
         $authorityRatingId = CRatings::GetAuthorityRating();
         $ratingStartValue = COption::GetOptionString("main", "rating_start_authority", 3);
         $ratingCountVote = COption::GetOptionString("main", "rating_count_vote", 10);
         $arParam = array('RATING_ID' => $authorityRatingId, 'ENTITY_ID' => $userId, 'BONUS' => intval($ratingStartValue), 'VOTE_WEIGHT' => intval($ratingStartValue) * COption::GetOptionString("main", "rating_vote_weight", 1), 'VOTE_COUNT' => intval($ratingCountVote) + intval($ratingStartValue));
         CRatings::UpdateRatingUserBonus($arParam);
         if (IsModuleInstalled("intranet")) {
             $strSql = "INSERT INTO b_rating_subordinate (RATING_ID, ENTITY_ID, VOTES) VALUES ('" . $authorityRatingId . "', '" . $userId . "', '" . (intval($ratingCountVote) + intval($ratingStartValue)) . "')";
             $DB->Query($strSql, false, $err_mess . __LINE__);
         }
         $sRatingAssignType = COption::GetOptionString("main", "rating_assign_type", 'manual');
         if ($sRatingAssignType == 'auto') {
             $assignRatingGroup = COption::GetOptionString("main", "rating_assign_rating_group", 0);
             $assignAuthorityGroup = COption::GetOptionString("main", "rating_assign_authority_group", 0);
             if ($assignRatingGroup == 0 && $assignAuthorityGroup == 0) {
                 return false;
             }
             $arGroups = array();
             $res = CUser::GetUserGroupList($userId);
             while ($res_arr = $res->Fetch()) {
                 $arGroups[] = array("GROUP_ID" => $res_arr["GROUP_ID"], "DATE_ACTIVE_FROM" => $res_arr["DATE_ACTIVE_FROM"], "DATE_ACTIVE_TO" => $res_arr["DATE_ACTIVE_TO"]);
             }
             if ($assignRatingGroup > 0) {
                 $arGroups[] = array("GROUP_ID" => intval($assignRatingGroup));
             }
             if ($assignAuthorityGroup > 0 && $assignRatingGroup != $assignAuthorityGroup) {
                 $arGroups[] = array("GROUP_ID" => intval($assignAuthorityGroup));
             }
             CUser::SetUserGroup($userId, $arGroups);
         }
         if (CACHED_b_rating_vote !== false) {
             global $CACHE_MANAGER;
             $bucket_size = intval(CACHED_b_rating_bucket_size);
             if ($bucket_size <= 0) {
                 $bucket_size = 100;
             }
             $bucket = intval($userId / $bucket_size);
             $CACHE_MANAGER->Clean("b_rvu_" . $authorityRatingId . $bucket, "b_rating_user");
         }
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:46,代码来源:ratings.php

示例4: LocalRedirect

                    LocalRedirect($strRedirect . "&ID=0&" . $tabControl->ActiveTabParam());
                }
            } elseif ($new == "Y") {
                LocalRedirect($strRedirect . "&ID=" . $ID . "&" . $tabControl->ActiveTabParam());
            }
        }
    }
}
$str_GROUP_ID = array();
$user = CUser::GetByID($ID);
if (!$user->ExtractFields("str_")) {
    $ID = 0;
    $str_ACTIVE = "Y";
    $str_LID = CSite::GetDefSite();
} else {
    $dbUserGroup = CUser::GetUserGroupList($ID);
    while ($arUserGroup = $dbUserGroup->Fetch()) {
        $str_GROUP_ID[intval($arUserGroup["GROUP_ID"])]["DATE_ACTIVE_FROM"] = $arUserGroup["DATE_ACTIVE_FROM"];
        $str_GROUP_ID[intval($arUserGroup["GROUP_ID"])]["DATE_ACTIVE_TO"] = $arUserGroup["DATE_ACTIVE_TO"];
    }
}
if ($COPY_ID > 0) {
    $str_PERSONAL_PHOTO = "";
    $str_WORK_LOGO = "";
}
if ($strError != '' || !$res) {
    $save_PERSONAL_PHOTO = $str_PERSONAL_PHOTO;
    $save_WORK_LOGO = $str_WORK_LOGO;
    $DB->InitTableVarsForEdit("b_user", "", "str_");
    $str_PERSONAL_PHOTO = $save_PERSONAL_PHOTO;
    $str_WORK_LOGO = $save_WORK_LOGO;
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:user_edit.php

示例5: GetCountryByID

 $arResult["User"]["PERSONAL_LOCATION"] .= $arResult["User"]["PERSONAL_CITY"];
 $arResult["User"]["WORK_LOCATION"] = GetCountryByID($arResult["User"]["WORK_COUNTRY"]);
 if (strlen($arResult["User"]["WORK_LOCATION"]) > 0 && strlen($arResult["User"]["WORK_CITY"]) > 0) {
     $arResult["User"]["WORK_LOCATION"] .= ", ";
 }
 $arResult["User"]["WORK_LOCATION"] .= $arResult["User"]["WORK_CITY"];
 if (CModule::IncludeModule('mail')) {
     $dbMailbox = CMailbox::getList(array('TIMESTAMP_X' => 'DESC'), array('LID' => SITE_ID, 'ACTIVE' => 'Y', 'USER_ID' => intval($arParams['ID']), 'SERVER_TYPE' => 'imap|controller|domain'));
     $mailbox = $dbMailbox->fetch();
     if (strpos($mailbox['LOGIN'], '@') !== false) {
         $arResult['User']['MAILBOX'] = $mailbox['LOGIN'];
     }
 }
 if ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users')) {
     $arResult["User"]["GROUP_ID"] = array();
     $rsGroup = CUser::GetUserGroupList($arResult["User"]["ID"]);
     while ($arGroup = $rsGroup->Fetch()) {
         if (strlen($arGroup["DATE_ACTIVE_FROM"]) <= 0 && strlen($arGroup["DATE_ACTIVE_TO"]) <= 0) {
             $arResult["User"]["GROUP_ID"][] = $arGroup["GROUP_ID"];
         }
     }
     $arResult["User"]["GROUP_ID"] = array_intersect($arResult["User"]["GROUP_ID"], $arGroupsCanEditID);
 }
 $arResult["arSex"] = array("M" => GetMessage("SONET_P_USER_SEX_M"), "F" => GetMessage("SONET_P_USER_SEX_F"));
 if ($bVarsFromForm) {
     static $skip = array("PERSONAL_PHOTO" => 1, "WORK_LOGO" => 1, "FORUM_AVATAR" => 1, "BLOG_AVATAR" => 1);
     foreach ($_POST as $k => $v) {
         if (!isset($skip[$k])) {
             if (is_array($v)) {
                 foreach ($v as $k1 => $v1) {
                     $arResult["User"][$k][$k1] = htmlspecialcharsbx($v1);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例6: Intval

$arParams["USE_PREPAYMENT"] = $arParams["USE_PREPAYMENT"] == 'Y' ? 'Y' : 'N';
$arParams["DISPLAY_IMG_HEIGHT"] = Intval($arParams["DISPLAY_IMG_HEIGHT"]) <= 0  ? 90 : Intval($arParams["DISPLAY_IMG_HEIGHT"]);

$LOCATION_ID = $_SESSION["LOCATION"];
$location_prop_id = intval($_POST["location_prop_id"]);

$arParams["DELIVERY_TO_PAYSYSTEM"] = ((strlen($arParams["DELIVERY_TO_PAYSYSTEM"]) <= 0) ? "d2p" : trim($arParams["DELIVERY_TO_PAYSYSTEM"]));

if (!isset($arParams["DISABLE_BASKET_REDIRECT"]) || 'Y' !== $arParams["DISABLE_BASKET_REDIRECT"])
	$arParams["DISABLE_BASKET_REDIRECT"] = "N";

$bUseAccountNumber = (COption::GetOptionString("sale", "account_number_template", "") !== "");

if ($USER->IsAuthorized()){
	$arGroups = Array();
	$res = CUser::GetUserGroupList($USER->GetID());
	while ($group = $res->Fetch()){
		$arGroups[] = $group["GROUP_ID"];
	}

	$db_ptype = CSalePersonType::GetList(Array("SORT" => "ASC"), Array("LID"=>SITE_ID, "ACTIVE"=>"Y"));
	while ($ptype = $db_ptype->Fetch())
		$arPersonTypes[] = $ptype["ID"];

	foreach($arPersonTypes as $personTypeID)
	{
		foreach($arParams["GROUP_".$personTypeID] as $groupID){
			if(in_array($groupID, $arGroups))
				$arParams["DEFAULT_PERSON_TYPE_ID"] = $personTypeID;
		}
	}
开发者ID:CheBurashka334,项目名称:zakrepi,代码行数:31,代码来源:component.php

示例7: array

 if ($_REQUEST['action_target'] == 'selected') {
     $arID = array();
     $rsData = CUser::GetList($by, $order, $arFilter);
     while ($arRes = $rsData->Fetch()) {
         $arID[] = $arRes['ID'];
     }
 }
 $gr_id = intval($_REQUEST['groups']);
 $struct_id = intval($_REQUEST['UF_DEPARTMENT']);
 foreach ($arID as $ID) {
     $ID = intval($ID);
     if ($ID <= 1) {
         continue;
     }
     $arGroups = array();
     $res = CUser::GetUserGroupList($ID);
     while ($res_arr = $res->Fetch()) {
         $arGroups[intval($res_arr["GROUP_ID"])] = array("GROUP_ID" => $res_arr["GROUP_ID"], "DATE_ACTIVE_FROM" => $res_arr["DATE_ACTIVE_FROM"], "DATE_ACTIVE_TO" => $res_arr["DATE_ACTIVE_TO"]);
     }
     if (isset($arGroups[1]) && !$USER->CanDoOperation('edit_php')) {
         // not admin can't edit admins
         continue;
     }
     if (!$USER->CanDoOperation('edit_all_users') && $USER->CanDoOperation('edit_subordinate_users') && count(array_diff(array_keys($arGroups), $arUserSubordinateGroups)) > 0) {
         continue;
     }
     switch ($_REQUEST['action']) {
         case "delete":
             @set_time_limit(0);
             $DB->StartTransaction();
             if (!CUser::Delete($ID)) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:user_admin.php

示例8: SetUserGroup

	function SetUserGroup($USER_ID, $arGroups)
	{
		global $DB, $APPLICATION, $USER;
		$USER_ID = IntVal($USER_ID);

		if(COption::GetOptionString("main", "event_log_user_groups", "N") === "Y")
		{
			//remember previous groups of the user
			$aPrevGroups = array();
			$res = CUser::GetUserGroupList($USER_ID);
			while($res_arr = $res->Fetch())
				if($res_arr["GROUP_ID"] <> 2)
					$aPrevGroups[] = $res_arr["GROUP_ID"];
		}

		$DB->Query("DELETE FROM b_user_group WHERE USER_ID=".$USER_ID, false, "FILE: ".__FILE__."<br> LINE: ".__LINE__);

		if(is_array($arGroups) && count($arGroups) > 0)
		{
			if(is_array($arGroups[0]) && count($arGroups[0]) > 0)
			{
				$arTmp = array();
				foreach($arGroups as $group)
				{
					$group_id = intval($group["GROUP_ID"]);
					if($group_id > 0 && !in_array($group_id, $arTmp))
					{
						$arInsert = $DB->PrepareInsert("b_user_group", $group);
						$strSql = "
							INSERT INTO b_user_group (
								USER_ID, ".$arInsert[0]."
							) VALUES (
								".$USER_ID.",
								".$arInsert[1]."
							)
						";
						$DB->Query($strSql, false, "FILE: ".__FILE__."<br> LINE: ".__LINE__);

						$arTmp[] = $group_id;
					}
				}
				$arGroups = $arTmp;
			}
			else
			{
				array_walk($arGroups, create_function("&\$item", "\$item=intval(\$item);"));
				$arGroups = array_unique($arGroups);
				if(count($arGroups)>0)
				{
					$strSql =
						"INSERT INTO b_user_group(USER_ID, GROUP_ID) ".
						"SELECT ".$USER_ID.", ID ".
						"FROM b_group ".
						"WHERE ID in (".implode(",", $arGroups).")";

					$DB->Query($strSql, false, "FILE: ".__FILE__."<br> LINE: ".__LINE__);
				}
			}
		}
		else
			$arGroups = array();

		if(COption::GetOptionString("main", "event_log_user_groups", "N") === "Y")
		{
			//compare previous groups of the user with new
			$aDiff = array_diff($aPrevGroups, $arGroups);
			if(empty($aDiff))
				$aDiff = array_diff($arGroups, $aPrevGroups);
			if(!empty($aDiff))
			{
				sort($aPrevGroups);
				sort($arGroups);
				$rsUser = CUser::GetByID($USER_ID);
				if($arUser = $rsUser->GetNext())
					$UserName = ($arUser["NAME"] != "" || $arUser["LAST_NAME"] != "") ? trim($arUser["NAME"]." ".$arUser["LAST_NAME"]) : $arUser["LOGIN"];
				$res_log = array(
					"groups" => "(".implode(", ", $aPrevGroups).") => (".implode(", ", $arGroups).")",
					"user" => $UserName
				);
				CEventLog::Log("SECURITY", "USER_GROUP_CHANGED", "main", $USER_ID, serialize($res_log));
			}
		}
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:83,代码来源:user.php


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