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


PHP CRatings::CheckAllowVote方法代码示例

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


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

示例1: array

 if (!empty($arComponentVoteResult)) {
     $arParams['TOTAL_VALUE'] = $arComponentVoteResult['TOTAL_VALUE'];
     $arParams['TOTAL_VOTES'] = $arComponentVoteResult['TOTAL_VOTES'];
     $arParams['TOTAL_POSITIVE_VOTES'] = $arComponentVoteResult['TOTAL_POSITIVE_VOTES'];
     $arParams['TOTAL_NEGATIVE_VOTES'] = $arComponentVoteResult['TOTAL_NEGATIVE_VOTES'];
     $arParams['USER_HAS_VOTED'] = $arComponentVoteResult['USER_HAS_VOTED'];
     $arParams['USER_VOTE'] = $arComponentVoteResult['USER_VOTE'];
 } else {
     $arParams['TOTAL_VALUE'] = 0;
     $arParams['TOTAL_VOTES'] = 0;
     $arParams['TOTAL_POSITIVE_VOTES'] = 0;
     $arParams['TOTAL_NEGATIVE_VOTES'] = 0;
     $arParams['USER_HAS_VOTED'] = 'N';
     $arParams['USER_VOTE'] = '0';
 }
 $arAllowVote = CRatings::CheckAllowVote($arParams);
 if ($arAllowVote['RESULT']) {
     $APPLICATION->RestartBuffer();
     $action = 'list';
     if ($_POST['RATING_VOTE_ACTION'] == 'plus' || $_POST['RATING_VOTE_ACTION'] == 'minus') {
         $arAdd = array("ENTITY_TYPE_ID" => $_POST['RATING_VOTE_TYPE_ID'], "ENTITY_ID" => intval($_POST['RATING_VOTE_ENTITY_ID']), "VALUE" => $_POST['RATING_VOTE_ACTION'] == 'plus' ? 1 : -1, "USER_IP" => $_SERVER['REMOTE_ADDR'], "USER_ID" => $USER->GetId());
         CRatings::AddRatingVote($arAdd);
         $action = $_POST['RATING_VOTE_ACTION'];
     } else {
         if ($_POST['RATING_VOTE_ACTION'] == 'cancel') {
             $arCancel = array("ENTITY_TYPE_ID" => $_POST['RATING_VOTE_TYPE_ID'], "ENTITY_ID" => intval($_POST['RATING_VOTE_ENTITY_ID']), "USER_ID" => $USER->GetId());
             CRatings::CancelRatingVote($arCancel);
             $action = $_POST['RATING_VOTE_ACTION'];
         }
     }
     $ar = array("ENTITY_TYPE_ID" => $_POST['RATING_VOTE_TYPE_ID'], "ENTITY_ID" => intval($_POST['RATING_VOTE_ENTITY_ID']), "LIST_LIMIT" => 0, "LIST_TYPE" => isset($_POST['RATING_VOTE_ACTION']) && $_POST['RATING_VOTE_ACTION'] == 'minus' ? 'minus' : 'plus');
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:vote.ajax.php

示例2: __SLMGetLogCommentRecord

 function __SLMGetLogCommentRecord($arComments, $arParams)
 {
     $arParams["MOBILE"] = "Y";
     $arParams["NEW_TEMPLATE"] = "Y";
     $dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
     $timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]);
     $timeFormated = FormatDate(GetMessage("SONET_SLM_FORMAT_TIME"), $timestamp);
     $dateTimeFormated = FormatDate($arParams["DATE_TIME_FORMAT"] == "FULL" ? $GLOBALS["DB"]->DateFormatToPHP(str_replace(":SS", "", FORMAT_DATETIME)) : $arParams["DATE_TIME_FORMAT"], $timestamp);
     if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
         $dateFormated = ToLower($dateFormated);
         $dateTimeFormated = ToLower($dateTimeFormated);
     }
     // strip current year
     if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
         $dateTimeFormated = ltrim($dateTimeFormated, '0');
         $curYear = date('Y');
         $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
     }
     $title = "";
     $path2Entity = $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"])) : CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
     if (intval($arComments["USER_ID"]) > 0) {
         $suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_SLM_EXTRANET_SUFFIX") : "";
         $arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
         $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
         $arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
     } else {
         $arCreatedBy = array("FORMATTED" => GetMessage("SONET_SLM_CREATED_BY_ANONYMOUS"));
     }
     $arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
     $arParamsTmp = $arParams;
     $arParamsTmp["AVATAR_SIZE"] = $arParams["AVATAR_SIZE_COMMENT"];
     if (is_array($arComments)) {
         unset($arComments["~MESSAGE"]);
         unset($arComments["TEXT_MESSAGE"]);
         unset($arComments["~TEXT_MESSAGE"]);
     }
     $arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => $title, "TITLE" => $title, "TITLE_FORMAT" => $title, "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
     $arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
     if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
         $arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, array());
     }
     $message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["MESSAGE"];
     $bToday = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp();
     if ($bToday || intval((time() - $timestamp) / 60 / 60) < 24) {
         $arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $timeFormated;
     } else {
         $arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $dateTimeFormated;
     }
     $arFIELDS_FORMATTED["EVENT_FORMATTED"]["ALLOW_VOTE"] = CRatings::CheckAllowVote(array("ENTITY_TYPE_ID" => $arComments["RATING_TYPE_ID"], "OWNER_ID" => $arComments["USER_ID"]));
     $arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
     $arTmpCommentEvent["UF"] = $arComments["UF"];
     return $arTmpCommentEvent;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:53,代码来源:include.php

示例3: intval

					$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_VOTES"] = (isset($arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_VOTES"]) ? $arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_VOTES"] : 0);
				}
				else
				{
					$arResult["arComments"][$key]["EVENT"]["RATING_USER_VOTE_VALUE"] = 0;
					$arResult["arComments"][$key]["EVENT"]["RATING_USER_HAS_VOTED"] = "N";
					$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_POSITIVE_VOTES"] = 0;
					$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_NEGATIVE_VOTES"] = 0;
					$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_VALUE"] = 0;
					$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_VOTES"] = 0;
				}
				
				if (strlen($rating_entity_type) > 0)
					$arResult["arComments"][$key]["EVENT_FORMATTED"]["ALLOW_VOTE"] = CRatings::CheckAllowVote(
						array(
							"ENTITY_TYPE_ID" => $rating_entity_type,
							"OWNER_ID" => $arResult["arComments"][$key]["EVENT"]["USER_ID"]
						)
					);
			}
		}
	}
	elseif ($action == "change_favorites" && $GLOBALS["USER"]->IsAuthorized())
	{
		$log_id = intval($_REQUEST["log_id"]);
		if ($arLog = CSocNetLog::GetByID($log_id))
		{
			if ($strRes = CSocNetLogFavorites::Change($GLOBALS["USER"]->GetID(), $log_id))
			{
				if ($strRes == "Y")
					CSocNetLogFollow::Set($GLOBALS["USER"]->GetID(), "L".$log_id, "Y");
				$arResult["bResult"] = $strRes;
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:32,代码来源:ajax.php

示例4: array_keys

        if ($arParams["CACHE_TIME"] > 0) {
            $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
            $cache->EndDataCache(array("arMessages" => $arMessages));
        }
    }
    /************** Rating ****************************************/
    if ($arParams["SHOW_RATING"] == "Y") {
        $arMessageIDs = array_keys($arMessages);
        $arRatings = CRatings::GetRatingVoteResult('FORUM_POST', $arMessageIDs);
        foreach ($arMessages as $postId => $res) {
            if (isset($arRatings[$postId])) {
                $arMessages[$postId]['RATING'] = $arRatings[$postId];
            }
            if (!isset($arMessages[$postId]['RATING'])) {
                $arMessages[$postId]['RATING'] = array('USER_VOTE' => 0, 'USER_HAS_VOTED' => 'N', 'TOTAL_VOTES' => 0, 'TOTAL_POSITIVE_VOTES' => 0, 'TOTAL_NEGATIVE_VOTES' => 0, 'TOTAL_VALUE' => 0);
            }
            $arMessages[$postId]['RATING']['ENTITY_TYPE_ID'] = 'FORUM_POST';
            $arMessages[$postId]['RATING']['ENTITY_ID'] = $postId;
            $arMessages[$postId]['RATING']['OWNER_ID'] = $res['AUTHOR_ID'];
            $arMessages[$postId]['RATING']['PATH_TO_USER_PROFILE'] = $arParams['URL_TEMPLATES_PROFILE_VIEW'];
            $arMessages[$postId]['META:ALLOW_VOTE_RATING'] = CRatings::CheckAllowVote(array('ENTITY_TYPE_ID' => $arMessages[$postId]['RATING']['ENTITY_TYPE_ID'], 'OWNER_ID' => $arMessages[$postId]['RATING']['OWNER_ID']));
        }
    }
    $arResult["MESSAGES"] = $arMessages;
    // Link to forum
    $arResult["read"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $arParams["FORUM_ID"], "TID" => $arResult["FORUM_TOPIC_ID"], "MID" => "s", "PARAM1" => "IB", "PARAM2" => $arParams["ELEMENT_ID"]));
}
if ($arParams['SHOW_TEMPLATE'] === 'Y') {
    $this->IncludeComponentTemplate();
}
return $arResult;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


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