本文整理汇总了PHP中CUser::GetUserGroupEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetUserGroupEx方法的具体用法?PHP CUser::GetUserGroupEx怎么用?PHP CUser::GetUserGroupEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetUserGroupEx方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NextPayment
//.........这里部分代码省略.........
">=PRICE_TO" => $productPrice,
"USER_GROUPS" => $USER->GetUserGroup($arOrder['USER_ID']),
)
);
if ($arDiscount = $dbDiscount->Fetch())
{
if ($arDiscount["DISCOUNT_TYPE"] == "P")
{
$discountProduct = roundEx($productPrice * $arDiscount["DISCOUNT_VALUE"] / 100, SALE_VALUE_PRECISION);
$discount = roundEx($discountProduct * DoubleVal($arProduct["QUANTITY"]), SALE_VALUE_PRECISION); // Changed by Sigurd, 2007-08-16
$discountPrice = $productPrice - $discountProduct;
}
else
{
$discountValue = CCurrencyRates::ConvertCurrency($arDiscount["DISCOUNT_VALUE"], $arDiscount["CURRENCY"], $baseSiteCurrency);
$discountValue = roundEx($discountValue, SALE_VALUE_PRECISION);
$discountProduct = roundEx(1.0 * $discountValue / DoubleVal($arProduct["QUANTITY"]), SALE_VALUE_PRECISION);// Changed by Sigurd, 2007-08-16
$discount = roundEx($curDiscount * DoubleVal($arProduct["QUANTITY"]), SALE_VALUE_PRECISION);
$discountPrice = $productPrice - $discountProduct;
}
}
$bUseVat = false;
$vatRate = 0;
if(DoubleVal($arProduct["VAT_RATE"]) > 0)
{
$bUseVat = true;
$vatRate = $arProduct["VAT_RATE"];
}
// Tax
$arTaxExempt = array();
$dbUserGroups = CUser::GetUserGroupEx($arOrder["USER_ID"]);
while ($arUserGroups = $dbUserGroups->Fetch())
{
$dbTaxExemptTmp = CSaleTax::GetExemptList(array("GROUP_ID" => $arUserGroups["GROUP_ID"]));
while ($arTaxExemptTmp = $dbTaxExemptTmp->Fetch())
{
$arTaxExemptTmp["TAX_ID"] = IntVal($arTaxExemptTmp["TAX_ID"]);
if (!in_array($arTaxExemptTmp["TAX_ID"], $arTaxExempt))
$arTaxExempt[] = $arTaxExemptTmp["TAX_ID"];
}
}
$taxPrice = 0;
$taxVatPrice = 0;
if(!$bUseVat)
{
$taxLocation = 0;
$dbOrderPropValues = CSaleOrderPropsValue::GetList(
array(),
array(
"ORDER_ID" => $arRecur["ORDER_ID"],
"PROP_IS_LOCATION4TAX" => "Y"
),
false,
false,
array("VALUE")
);
if ($arOrderPropValues = $dbOrderPropValues->Fetch())
$taxLocation = IntVal($arOrderPropValues["VALUE"]);
$arTaxList = array();
$dbTaxRateTmp = CSaleTaxRate::GetList(
array("APPLY_ORDER" => "ASC"),
示例2: CatalogPayOrderCallback
function CatalogPayOrderCallback($productID, $userID, $bPaid, $orderID)
{
global $DB;
global $USER;
$productID = intval($productID);
$userID = intval($userID);
$bPaid = $bPaid ? true : false;
$orderID = intval($orderID);
if ($userID <= 0) {
return false;
}
$dbIBlockElement = CIBlockElement::GetList(array(), array("ID" => $productID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "N"), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
if ($arIBlockElement = $dbIBlockElement->GetNext()) {
$arCatalog = CCatalog::GetByID($arIBlockElement["IBLOCK_ID"]);
if ($arCatalog["SUBSCRIPTION"] == "Y") {
$arProduct = CCatalogProduct::GetByID($productID);
if ($bPaid) {
if ('E' == CIBlock::GetArrayByID($arIBlockElement['IBLOCK_ID'], "RIGHTS_MODE")) {
$arUserRights = CIBlockElementRights::GetUserOperations($productID, $userID);
if (empty($arUserRights)) {
return false;
} elseif (!is_array($arUserRights) || !array_key_exists('element_read', $arUserRights)) {
return false;
}
} else {
if ('R' > CIBlock::GetPermission($arIBlockElement['IBLOCK_ID'], $userID)) {
return false;
}
}
$arUserGroups = array();
$arTmp = array();
$ind = -1;
$curTime = time();
$dbProductGroups = CCatalogProductGroups::GetList(array(), array("PRODUCT_ID" => $productID), false, false, array("GROUP_ID", "ACCESS_LENGTH", "ACCESS_LENGTH_TYPE"));
while ($arProductGroups = $dbProductGroups->Fetch()) {
$ind++;
$arProductGroups['GROUP_ID'] = intval($arProductGroups['GROUP_ID']);
$accessType = $arProductGroups["ACCESS_LENGTH_TYPE"];
$accessLength = intval($arProductGroups["ACCESS_LENGTH"]);
$accessVal = 0;
if (0 < $accessLength) {
if ($accessType == CCatalogProduct::TIME_PERIOD_HOUR) {
$accessVal = mktime(date("H") + $accessLength, date("i"), date("s"), date("m"), date("d"), date("Y"));
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_DAY) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + $accessLength, date("Y"));
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_WEEK) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 7 * $accessLength, date("Y"));
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_MONTH) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m") + $accessLength, date("d"), date("Y"));
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_QUART) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m") + 3 * $accessLength, date("d"), date("Y"));
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_SEMIYEAR) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m") + 6 * $accessLength, date("d"), date("Y"));
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_YEAR) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + $accessLength);
} elseif ($accessType == CCatalogProduct::TIME_PERIOD_DOUBLE_YEAR) {
$accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + 2 * $accessLength);
}
}
$arUserGroups[$ind] = array("GROUP_ID" => $arProductGroups["GROUP_ID"], "DATE_ACTIVE_FROM" => date($DB->DateFormatToPHP(CLang::GetDateFormat("FULL", SITE_ID)), $curTime), "DATE_ACTIVE_TO" => 0 < $accessLength ? date($DB->DateFormatToPHP(CLang::GetDateFormat("FULL", SITE_ID)), $accessVal) : false);
$arTmp[$arProductGroups["GROUP_ID"]] = $ind;
}
if (!empty($arUserGroups)) {
$dbOldGroups = CUser::GetUserGroupEx($userID);
while ($arOldGroups = $dbOldGroups->Fetch()) {
$arOldGroups["GROUP_ID"] = intval($arOldGroups["GROUP_ID"]);
if (array_key_exists($arOldGroups["GROUP_ID"], $arTmp)) {
if (strlen($arOldGroups["DATE_ACTIVE_FROM"]) <= 0) {
$arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_FROM"] = false;
} else {
$oldDate = CDatabase::FormatDate($arOldGroups["DATE_ACTIVE_FROM"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
$newDate = CDatabase::FormatDate($arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_FROM"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
if ($oldDate > $newDate) {
$arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_FROM"] = $arOldGroups["DATE_ACTIVE_FROM"];
}
}
if (strlen($arOldGroups["DATE_ACTIVE_TO"]) <= 0) {
$arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"] = false;
} elseif (false !== $arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"]) {
$oldDate = CDatabase::FormatDate($arOldGroups["DATE_ACTIVE_TO"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
$newDate = CDatabase::FormatDate($arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
if ($oldDate > $newDate) {
$arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"] = $arOldGroups["DATE_ACTIVE_TO"];
}
}
} else {
$ind++;
$arUserGroups[$ind] = array("GROUP_ID" => $arOldGroups["GROUP_ID"], "DATE_ACTIVE_FROM" => $arOldGroups["DATE_ACTIVE_FROM"], "DATE_ACTIVE_TO" => $arOldGroups["DATE_ACTIVE_TO"]);
}
}
CUser::SetUserGroup($userID, $arUserGroups);
if (CCatalog::IsUserExists()) {
if (intval($USER->GetID()) == $userID) {
$arUserGroupsTmp = array();
foreach ($arUserGroups as &$arOneGroup) {
$arUserGroupsTmp[] = $arOneGroup["GROUP_ID"];
}
if (isset($arOneGroup)) {
unset($arOneGroup);
}
//.........这里部分代码省略.........
示例3: md5
else
{
$salt = "";
$db_password = $arUser["PASSWORD"];
}
if(
$arUser['ACTIVE'] == 'Y'
&& md5($db_password.'MySalt') == md5(md5($salt.$oRequest->arParameters['password']).'MySalt')
)
{
$arSaveUser = CControllerClient::PrepareUserInfo($arUser);
$arUserGroups = array();
$dbUserGroups = CUser::GetUserGroupEx($arUser['ID']);
while ($arG = $dbUserGroups->Fetch())
{
if (strlen($arG["STRING_ID"]) > 0)
$arUserGroups[] = $arG["STRING_ID"];
elseif ($arG["GROUP_ID"] == 1)
$arUserGroups[] = "administrators";
elseif ($arG["GROUP_ID"] == 2)
$arUserGroups[] = "everyone";
}
$arSaveUser["GROUP_ID"] = $arUserGroups;
if (CModule::IncludeModule("blog"))
{
$arBlogUser = CBlogUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
if (is_array($arBlogUser) && $arBlogUser["AVATAR"] > 0)