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


PHP CRatings::GetVoteGroupEx方法代码示例

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


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

示例1: CheckAllowVote

	public static 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 $cacheVoteSize = 0;
			if(!array_key_exists($userId, $cacheAllowVote))
			{
				global $DB;
				$arGroups = array();
				$sVoteType = $arVoteParam['ENTITY_TYPE_ID'] == 'USER'? 'A': 'R';

				$userVoteGroup = Array();
				$ar = CRatings::GetVoteGroupEx();
				foreach($ar as $group)
					if ($sVoteType == $group['TYPE'])
						$userVoteGroup[] = $group['GROUP_ID'];

				$userGroup = $USER->GetUserGroupArray();

				$result = array_intersect($userGroup, $userVoteGroup);
				if (empty($result))
				{
					$arInfo = $cacheAllowVote[$userId] = array(
						'RESULT' => false,
						'ERROR_TYPE' => 'ACCESS',
						'ERROR_MSG' => GetMessage('RATING_ALLOW_VOTE_ACCESS'),
					);
				}

				$authorityRatingId	 = CRatings::GetAuthorityRating();
				$arAuthorityUserProp = CRatings::GetRatingUserPropEx($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.'
						AND RV.CREATED > DATE_SUB(NOW(), INTERVAL 1 DAY)';
					$res = $DB->Query($strSql, false, $err_mess.__LINE__);
					$countVote = $res->Fetch();
					$cacheVoteSize = $_SESSION['RATING_VOTE_COUNT'] = $countVote['VOTE'];

					$cacheUserVote[$userId] = $_SESSION['RATING_USER_VOTE_COUNT'] = $arAuthorityUserProp['VOTE_COUNT'];

					if ($cacheVoteSize >= $cacheUserVote[$userId])
					{
						$arInfo = $cacheAllowVote[$userId] = array(
							'RESULT' => false,
							'ERROR_TYPE' => 'COUNT_VOTE',
							'ERROR_MSG' => GetMessage('RATING_ALLOW_VOTE_COUNT_VOTE'),
						);
					}
				}
			}
			else
			{
				if ($cacheAllowVote[$userId]['RESULT'])
				{
					if ($cacheVoteSize >= $cacheUserVote[$userId])
					{
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:ratings.php

示例2: array

		if ($arGroup['ID'] == 2)
			continue;

		$arRatingVoteGroupIdList["REFERENCE"][] = $arGroup["NAME"];
		$arRatingVoteGroupIdList["REFERENCE_ID"][] = $arGroup["ID"];

		if ($arGroup['ID'] == 1)
			continue;

		$arRatingVoteGroupIdList2["REFERENCE"][] = $arGroup["NAME"];
		$arRatingVoteGroupIdList2["REFERENCE_ID"][] = $arGroup["ID"];
	}

	$arRatingVoteGroupID = array();
	$arRatingVoteAuthorityGroupID = array();
	$arGroups = CRatings::GetVoteGroupEx();
	foreach ($arGroups as $group)
	{
		if ($group['TYPE'] == 'R')
			$arRatingVoteGroupID[] = $group["GROUP_ID"];
		else if ($group['TYPE'] == 'A')
			$arRatingVoteAuthorityGroupID[] = $group["GROUP_ID"];
	}
?>
	<tr class="heading">
		<td colspan="2"><?php 
echo GetMessage('RATING_SETTINGS_FRM_RATING');
?>
</td>
	</tr>
	<tr>
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:rating_settings.php


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