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


PHP CRatings::UpdateRatingUserBonus方法代码示例

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


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

示例1: 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

示例2: elseif

     $USER_FIELD_MANAGER->EditFormAddFields($PROPERTY_ID, $arFields);
     if ($ID > 0 && $COPY_ID <= 0) {
         $res = $user->Update($ID, $arFields, true);
     } elseif ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users')) {
         $ID = $user->Add($arFields);
         $res = $ID > 0;
         if (COption::GetOptionString("main", "event_log_register", "N") === "Y" && $res) {
             $res_log["user"] = $_POST["NAME"] != "" || $_POST["LAST_NAME"] != "" ? trim($_POST["NAME"] . " " . $_POST["LAST_NAME"]) : $_POST["LOGIN"];
             CEventLog::Log("SECURITY", "USER_REGISTER", "main", $ID, serialize($res_log));
         }
         $new = "Y";
     }
     if ($USER->CanDoOperation('edit_ratings') && ($selfEdit || $ID != $USER->GetID()) && is_array($_POST['RATING_BONUS'])) {
         foreach ($_POST['RATING_BONUS'] as $ratingId => $ratingBonus) {
             $arParam = array('RATING_ID' => $ratingId, 'ENTITY_ID' => $ID, 'BONUS' => $ratingBonus);
             CRatings::UpdateRatingUserBonus($arParam);
         }
     }
     $strError .= $user->LAST_ERROR;
     if ($APPLICATION->GetException()) {
         $err = $APPLICATION->GetException();
         $strError .= $err->GetString();
         $APPLICATION->ResetException();
     }
 }
 if ($strError == '' && $ID > 0) {
     if (is_array($_REQUEST["profile_module_id"]) && count($_REQUEST["profile_module_id"]) > 0) {
         $db_opt_res = CModule::GetList();
         while ($opt_res = $db_opt_res->Fetch()) {
             if (in_array($opt_res["ID"], $_REQUEST["profile_module_id"])) {
                 $mdir = $opt_res["ID"];
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:user_edit.php


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