當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRatings::GetRatingUserPropEx方法代碼示例

本文整理匯總了PHP中CRatings::GetRatingUserPropEx方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRatings::GetRatingUserPropEx方法的具體用法?PHP CRatings::GetRatingUserPropEx怎麽用?PHP CRatings::GetRatingUserPropEx使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRatings的用法示例。


在下文中一共展示了CRatings::GetRatingUserPropEx方法的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: CAdminViewTabControl

			$i++;
		}

		if (is_array($arRatings) && !empty($arRatings))
		{
			$ratingWeightType 	 = COption::GetOptionString("main", "rating_weight_type", "auto");
			$authorityRatingId	 = CRatings::GetAuthorityRating();
			$arAuthorityUserProp = CRatings::GetRatingUserPropEx($authorityRatingId, $ID);

			$viewTabControl = new CAdminViewTabControl("tabControlRating", $aTabs2);
			$viewTabControl->Begin();

			foreach($arRatings as $ratingId => $arRating)
			{
				$arRatingResult = CRatings::GetRatingResult($ratingId, $ID);
				$arRatingUserProp = CRatings::GetRatingUserPropEx($ratingId, $ID);

				if ($ratingId == $authorityRatingId && $arRatingUserProp['BONUS'] == 0)
					$arRatingUserProp['BONUS'] = COption::GetOptionString("main", "rating_start_authority", 3);

				$viewTabControl->BeginNextTab();
				?>
					<table cellspacing="7" cellpadding="0" border="0" width="100%" class="edit-table">
				<?	if ($USER->CanDoOperation('edit_ratings') && ($selfEdit || $ID!=$uid)): ?>
					<tr>
						<td class="field-name" width="40%"><?php 
echo GetMessage('RATING_BONUS');
?>
:<sup><span class="required">2</span></sup></td>
						<td><?php 
echo InputType('text', "RATING_BONUS[{$ratingId}]", floatval($arRatingUserProp['BONUS']), false, false, '', 'size="5" maxlength="11"');
開發者ID:ASDAFF,項目名稱:bitrix-5,代碼行數:31,代碼來源:user_edit.php


注:本文中的CRatings::GetRatingUserPropEx方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。