本文整理汇总了PHP中CRatings::GetVoteGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRatings::GetVoteGroup方法的具体用法?PHP CRatings::GetVoteGroup怎么用?PHP CRatings::GetVoteGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRatings
的用法示例。
在下文中一共展示了CRatings::GetVoteGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCommunityInfo
public static function GetCommunityInfo($ratingId)
{
global $DB;
$bAllGroups = false;
$arInfo = Array();
$arGroups = Array();
$communityLastVisit = COption::GetOptionString("main", "rating_community_last_visit", '90');
$res = CRatings::GetVoteGroup();
while ($arVoteGroup = $res->Fetch())
{
if ($arVoteGroup['GROUP_ID'] == 2)
{
$bAllGroups = true;
break;
}
$arGroups[] = $arVoteGroup['GROUP_ID'];
}
$strModulesSql = '';
if (IsModuleInstalled("forum"))
{
$strModulesSql .= "
SELECT USER_START_ID as ENTITY_ID
FROM b_forum_topic
WHERE START_DATE > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
GROUP BY USER_START_ID
UNION ALL
SELECT AUTHOR_ID as ENTITY_ID
FROM b_forum_message
WHERE POST_DATE > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
GROUP BY AUTHOR_ID
UNION ALL
";
}
if (IsModuleInstalled("blog"))
{
$strModulesSql .= "
SELECT AUTHOR_ID as ENTITY_ID
FROM b_blog_post
WHERE DATE_PUBLISH > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
GROUP BY AUTHOR_ID
UNION ALL
SELECT AUTHOR_ID as ENTITY_ID
FROM b_blog_comment
WHERE DATE_CREATE > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
GROUP BY AUTHOR_ID
UNION ALL";
}
if (IsModuleInstalled("intranet"))
{
$ratingId = COption::GetOptionString("main", "rating_authority_rating", 0);
$strModulesSql .= "
SELECT ENTITY_ID
FROM b_rating_subordinate
WHERE RATING_ID = $ratingId
UNION ALL";
}
if (!empty($strModulesSql))
{
$strModulesSql = "
(
".$strModulesSql."
SELECT USER_ID as ENTITY_ID
FROM b_rating_vote
WHERE CREATED > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
GROUP BY USER_ID
) MS,
";
}
$DB->Query("TRUNCATE TABLE b_rating_prepare", false, $err_mess.__LINE__);
if ($bAllGroups || empty($arGroups))
{
$strSql .= "
INSERT INTO b_rating_prepare (ID)
SELECT DISTINCT U.ID
FROM ".$strModulesSql."
b_user U
WHERE ".(!empty($strModulesSql)? "U.ID = MS.ENTITY_ID AND": "")."
U.ACTIVE = 'Y'
AND U.LAST_LOGIN > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
";
}
else
{
$strSql .= "
INSERT INTO b_rating_prepare (ID)
SELECT DISTINCT U.ID
FROM ".$strModulesSql."
b_user U
WHERE ".(!empty($strModulesSql)? "U.ID = MS.ENTITY_ID AND": "")."
U.ACTIVE = 'Y'
AND U.LAST_LOGIN > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
";
}
$DB->Query($strSql, false, $err_mess.__LINE__);
$strSql = 'SELECT COUNT(*) as COMMUNITY_SIZE, SUM(CURRENT_VALUE) COMMUNITY_AUTHORITY
FROM b_rating_results RC LEFT JOIN b_rating_prepare TT ON RC.ENTITY_ID = TT.ID
//.........这里部分代码省略.........
示例2: GetMessage
echo GetMessage('RATING_SETTINGS_FRM_ASSIGN_VOTE_2');
?>
: <input name="RATING_ASSIGN_RATING_GROUP_DELETE" value="<?php
echo $ratingAssignRatingGroupDelete;
?>
" style="width:45px;" type="text">
</td>
</tr>
<?
$arRatingVoteAuthorityGroupID = array();
$rsGroups = CRatings::GetVoteGroup('A');
while($arGroup = $rsGroups -> Fetch())
$arRatingVoteAuthorityGroupID[] = $arGroup["GROUP_ID"];
?>
<tr class="heading">
<td colspan="2"><?php
echo GetMessage('RATING_SETTINGS_FRM_AUTHORITY');
?>
</td>
</tr>
<tr>
<td width="50%" valign="top"><?php
echo GetMessage('RATING_SETTINGS_FRM_RATING_VOTE_AUTHORITY_GROUP_ID');
?>
</td>
<td><?php
示例3: CheckAllowVote
function CheckAllowVote($arVoteParam)
{
global $USER;
$userId = $USER->GetId();
$bUserAuth = $USER->IsAuthorized();
$bAllGroups = false;
$arInfo = array(
'RESULT' => true,
'ERROR_TYPE' => '',
'ERROR_MSG' => '',
);
$bSelfVote = COption::GetOptionString("main", "rating_self_vote", 'N');
if ($bSelfVote == 'N' && IntVal($arVoteParam['OWNER_ID']) == $userId)
{
$arInfo = array(
'RESULT' => false,
'ERROR_TYPE' => 'SELF',
'ERROR_MSG' => GetMessage('RATING_ALLOW_VOTE_SELF'),
);
}
else if (!$bUserAuth)
{
$arInfo = array(
'RESULT' => false,
'ERROR_TYPE' => 'GUEST',
'ERROR_MSG' => GetMessage('RATING_ALLOW_VOTE_GUEST'),
);
}
else
{
static $cacheAllowVote = array();
static $cacheUserVote = array();
static $cacheVoteAccess = null;
static $cacheVoteGroup = array();
static $cacheVoteSize = 0;
if(!array_key_exists($userId, $cacheAllowVote))
{
global $DB;
$arGroups = array();
$bAllGroups = false;
$sVoteType = $arVoteParam['ENTITY_TYPE_ID'] == 'USER'? 'A': 'R';
if (!isset($cacheVoteGroup[$sVoteType]))
{
$cacheVoteGroup[$sVoteType] = Array();
$rsGroups = CRatings::GetVoteGroup($sVoteType);
while ($arVoteGroup = $rsGroups->Fetch())
$cacheVoteGroup[$sVoteType][] = $arVoteGroup;
}
foreach($cacheVoteGroup[$sVoteType] as $arVoteGroup)
{
if ($arVoteGroup['GROUP_ID'] == 2)
{
$bAllGroups = true;
break;
}
$arGroups[] = $arVoteGroup['GROUP_ID'];
}
if (!$bAllGroups && !empty($arGroups) && is_null($cacheVoteAccess))
{
$strSql = '
SELECT * FROM b_user_group UG
WHERE UG.GROUP_ID IN ('.implode(',', $arGroups).')
AND UG.USER_ID = '.$userId.'
AND ((UG.DATE_ACTIVE_FROM IS NULL) OR (UG.DATE_ACTIVE_FROM <= '.$DB->CurrentTimeFunction().'))
AND ((UG.DATE_ACTIVE_TO IS NULL) OR (UG.DATE_ACTIVE_TO >= '.$DB->CurrentTimeFunction().'))';
$res = $DB->Query($strSql, false, $err_mess.__LINE__);
if ($row = $res->Fetch())
$cacheVoteAccess = true;
else
{
$cacheVoteAccess = false;
$arInfo = $cacheAllowVote[$userId] = array(
'RESULT' => false,
'ERROR_TYPE' => 'ACCESS',
'ERROR_MSG' => GetMessage('RATING_ALLOW_VOTE_ACCESS'),
);
}
}
$authorityRatingId = CRatings::GetAuthorityRating();
$arAuthorityUserProp = CRatings::GetRatingUserProp($authorityRatingId, $userId);
if ($arAuthorityUserProp['VOTE_WEIGHT'] <= 0)
{
$arInfo = $cacheAllowVote[$userId] = array(
'RESULT' => false,
'ERROR_TYPE' => 'ACCESS',
'ERROR_MSG' => GetMessage('RATING_ALLOW_VOTE_LOW_WEIGHT'),
);
}
if ($arInfo['RESULT'] && $sVoteType == 'A')
{
$strSql = '
SELECT COUNT(*) as VOTE
FROM b_rating_vote RV
WHERE RV.USER_ID = '.$userId.'
//.........这里部分代码省略.........