本文整理汇总了PHP中CRatings::GetCommunityInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP CRatings::GetCommunityInfo方法的具体用法?PHP CRatings::GetCommunityInfo怎么用?PHP CRatings::GetCommunityInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRatings
的用法示例。
在下文中一共展示了CRatings::GetCommunityInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BuildRating
//.........这里部分代码省略.........
INSERT INTO b_rating_user
(RATING_ID, ENTITY_ID)
SELECT
".$ID." RATING_ID,
U.ID as ENTITY_ID
FROM
b_user U LEFT JOIN b_rating_user RU ON RU.RATING_ID = ".$ID." and RU.ENTITY_ID = U.ID
WHERE RU.ID IS NULL ";
$res = $DB->Query($strSql, false, $err_mess.__LINE__);
// authority calc
if ($arRating['AUTHORITY'] == 'Y')
{
$sRatingAssignType = COption::GetOptionString("main", "rating_assign_type", "manual");
if ($sRatingAssignType == 'auto')
{
// auto assign for rating group
$assignRatingGroup = COption::GetOptionString("main", "rating_assign_rating_group", 0);
$assignRatingValueAdd = COption::GetOptionString("main", "rating_assign_rating_group_add", 1);
$assignRatingValueDelete = COption::GetOptionString("main", "rating_assign_rating_group_delete", 1);
CRatings::AutoAssignGroup($assignRatingGroup, $assignRatingValueAdd, $assignRatingValueDelete);
// auto assign for authority group
$assignAuthorityGroup = COption::GetOptionString("main", "rating_assign_authority_group", 0);
$assignAuthorityValueAdd = COption::GetOptionString("main", "rating_assign_authority_group_add", 2);
$assignAuthorityValueDelete = COption::GetOptionString("main", "rating_assign_authority_group_delete", 2);
CRatings::AutoAssignGroup($assignAuthorityGroup, $assignAuthorityValueAdd, $assignAuthorityValueDelete);
}
$sRatingWeightType = COption::GetOptionString("main", "rating_weight_type", "auto");
if ($sRatingWeightType == 'auto')
{
$arCI = CRatings::GetCommunityInfo($ID);
$communitySize = $arCI['COMMUNITY_SIZE'];
$communityAuthority = $arCI['COMMUNITY_AUTHORITY'];
$sRatingNormalizationType = COption::GetOptionString("main", "rating_normalization_type", "auto");
if ($sRatingNormalizationType == 'manual')
$ratingNormalization = COption::GetOptionString("main", "rating_normalization", 1000);
else
{
if ($communitySize <= 10)
$ratingNormalization = 10;
else if ($communitySize > 10 && $communitySize <= 1000)
$ratingNormalization = 100;
else if ($communitySize > 1000)
$ratingNormalization = 1000;
COption::SetOptionString("main", "rating_normalization", $ratingNormalization);
}
$voteWeight = 1;
if ($communitySize > 0)
$voteWeight = $ratingNormalization/$communitySize;
COption::SetOptionString("main", "rating_community_size", $communitySize);
COption::SetOptionString("main", "rating_community_authority", $communityAuthority);
COption::SetOptionString("main", "rating_vote_weight", $voteWeight);
$ratingCountVote = COption::GetOptionString("main", "rating_count_vote", 10);
$strSql = "UPDATE b_rating_user SET VOTE_COUNT = 0, VOTE_WEIGHT =0 WHERE RATING_ID=".$ID;
$res = $DB->Query($strSql, false, $err_mess.__LINE__);
// default vote count + user authority
$strSql = "
UPDATE
b_rating_user RU,