本文整理汇总了PHP中CRatings::GetRatingVoteResult方法的典型用法代码示例。如果您正苦于以下问题:PHP CRatings::GetRatingVoteResult方法的具体用法?PHP CRatings::GetRatingVoteResult怎么用?PHP CRatings::GetRatingVoteResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRatings
的用法示例。
在下文中一共展示了CRatings::GetRatingVoteResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPrepareComments
function OnPrepareComments()
{
$arResult =& $this->component->arResult;
$arParams =& $this->component->arParams;
$arMessages =& $arResult['MESSAGES'];
$arMessageIDs = array_keys($arMessages);
$arRatings = CRatings::GetRatingVoteResult('FORUM_POST', $arMessageIDs);
if ($arRatings) {
foreach ($arRatings as $postID => $arRating) {
$this->arRatings[$postID] = $arRating;
}
}
}
示例2: GetVoteResult
function GetVoteResult($entityTypeId, $entityId)
{
global $USER;
$entityId = intval($entityId);
$userId = intval($USER->GetId());
$arRatingResult = CRatings::GetRatingVoteResult($entityTypeId, $entityId, $userId);
if (empty($arRatingResult)) {
$arRatingResult['USER_HAS_VOTED'] = $USER->IsAuthorized() ? "N" : "Y";
$arRatingResult['USER_VOTE'] = 0;
$arRatingResult['TOTAL_VALUE'] = 0;
$arRatingResult['TOTAL_VOTES'] = 0;
$arRatingResult['TOTAL_POSITIVE_VOTES'] = 0;
$arRatingResult['TOTAL_NEGATIVE_VOTES'] = 0;
}
$path = str_replace(array("\\", "//"), "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/vote.ajax.php");
include_once $path;
$resultStatus = $arRatingResult['TOTAL_VALUE'] < 0 ? 'minus' : 'plus';
$resultTitle = sprintf($MESS["RATING_COMPONENT_DESC"], $arRatingResult['TOTAL_VOTES'], $arRatingResult['TOTAL_POSITIVE_VOTES'], $arRatingResult['TOTAL_NEGATIVE_VOTES']);
return array('resultValue' => $arRatingResult['TOTAL_VALUE'], 'resultVotes' => $arRatingResult['TOTAL_VOTES'], 'resultPositiveVotes' => $arRatingResult['TOTAL_POSITIVE_VOTES'], 'resultNegativeVotes' => $arRatingResult['TOTAL_NEGATIVE_VOTES'], 'resultStatus' => $resultStatus, 'resultTitle' => $resultTitle);
}
示例3: array
}
foreach ($arResult["arComments"] as $key => $arCommentTmp)
{
if ($key === 0)
$rating_entity_type = $arCommentTmp["EVENT"]["RATING_TYPE_ID"];
$arCommentID[] = $arCommentTmp["EVENT"]["RATING_ENTITY_ID"];
}
$arRatingComments = array();
if(
!empty($arCommentID)
&& strlen($rating_entity_type) > 0
)
$arRatingComments = CRatings::GetRatingVoteResult($rating_entity_type, $arCommentID);
foreach($arResult["arComments"] as $key => $arCommentTmp)
{
if (array_key_exists($arCommentTmp["EVENT"]["RATING_ENTITY_ID"], $arRatingComments))
{
$arResult["arComments"][$key]["EVENT"]["RATING_USER_VOTE_VALUE"] = (isset($arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["USER_VOTE"]) ? $arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["USER_VOTE"] : 0);
$arResult["arComments"][$key]["EVENT"]["RATING_USER_HAS_VOTED"] = (isset($arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["USER_HAS_VOTED"]) ? $arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["USER_HAS_VOTED"] : "N");
$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_POSITIVE_VOTES"] = (isset($arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_POSITIVE_VOTES"]) ? $arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_POSITIVE_VOTES"] : 0);
$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_NEGATIVE_VOTES"] = (isset($arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_NEGATIVE_VOTES"]) ? $arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_NEGATIVE_VOTES"] : 0);
$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_VALUE"] = (isset($arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_VALUE"]) ? $arRatingComments[$arCommentTmp["EVENT"]["RATING_ENTITY_ID"]]["TOTAL_VALUE"] : 0);
$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;
示例4: preg_replace
$text = preg_replace("#\\[url(.+?)\\](.*?)\\[/url\\]#is", "\\2", $text);
$text = preg_replace("#\\[video(.+?)\\](.+?)\\[/video\\]#is", "", $text);
$text = preg_replace("#^(.+?)<cut[\\s]*(/>|>).*?\$#is", "\\1", $text);
$text = preg_replace("#^(.+?)\\[cut[\\s]*(/\\]|\\]).*?\$#is", "\\1", $text);
$text = preg_replace("#(\\[|<)(/?)(b|u|i|list|code|quote|url|img|color|font|/*)(.*?)(\\]|>)#is", "", $text);
$text = TruncateText($text, $arParams["MESSAGE_LENGTH"]);
$text1 = $text;
$title = $p->convert($text1, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N"));
$text = $p->convert($text, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N"));
$text = CBlogTools::DeleteDoubleBR($text);
$arTmp["TEXT_FORMATED"] = $text;
$arTmp["DATE_PUBLISH_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arTmp["DATE_PUBLISH"], CSite::GetDateFormat("FULL")));
if ($arTmp["MICRO"] == "Y") {
$arTmp["TITLE"] = TruncateText(str_replace(array("<br />", "<br>", "'", """, "<", ">"), "", $title), 60);
$arTmp["~TITLE"] = htmlspecialcharsback($arTmp["TITLE"]);
}
$itemCnt++;
$arResult[] = $arTmp;
$ids[] = $arTmp["ID"];
}
$arResult["IDS"] = $ids;
}
if ($arParams["CACHE_TIME"] > 0) {
$cache->EndDataCache(array("templateCachedData" => $this->GetTemplateCachedData(), "arResult" => $arResult));
}
}
if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["IDS"])) {
$arResult[0]['RATING'] = CRatings::GetRatingVoteResult('BLOG_POST', $arResult["IDS"]);
}
unset($arResult["IDS"]);
$this->IncludeComponentTemplate();
示例5: array
if ($perm >= BLOG_PERMS_MODERATE) {
if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arComment["CAN_HIDE"] = "Y";
} else {
$arComment["CAN_SHOW"] = "Y";
}
} else {
$arComment["CAN_SHOW"] = $arComment["CAN_HIDE"] = "N";
}
$urlToPost = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => "#source_post_id#", "user_id" => $arPost["AUTHOR_ID"]));
$urlToPost .= strpos($urlToPost, "?") !== false ? "&" : "?";
$arFields = array("POST_ID" => $arBlogPost["ID"], "COMMENT_ID" => $commentId, "arComment" => $arComment, "arAuthor" => $arAuthor, "arUrl" => array("LINK" => $urlToPost, "SHOW" => $urlToPost . "show_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "HIDE" => $urlToPost . "hide_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "DELETE" => $urlToPost . "delete_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "USER" => htmlspecialcharsback($arParams["PATH_TO_USER"])), "RATING_TYPE" => "like", "SHOW_RATING" => $arParams["SHOW_RATING"]);
$arParams["RATING_TYPE"] = "like";
CRatingsComponentsMain::GetShowRating($arParams);
if ($arParams["SHOW_RATING"] == "Y") {
$arFields['arRating'] = CRatings::GetRatingVoteResult('BLOG_COMMENT', array($arFields["arComment"]["ID"]));
}
CMobileHelper::SendPullComment("blog", $arFields);
}
}
}
}
if (!$strError) {
$arResult["SUCCESS"] = "Y";
} else {
$arResult["ERROR"] = $strError;
}
echo \Bitrix\Main\Web\Json::encode($arResult);
define('PUBLIC_AJAX_MODE', true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
die;
示例6: bitrix_sessid_get
if ($arResult["PostPerm"] >= BLOG_PERMS_FULL) {
$arResult["urlToDelete"] = $arResult["urlToEdit"];
if (strpos($arResult["urlToDelete"], "?") === false) {
$arResult["urlToDelete"] .= "?";
} else {
$arResult["urlToDelete"] .= "&";
}
$arResult["urlToDelete"] .= "delete_blog_post_id=#del_post_id#&ajax_blog_post_delete=Y" . "&" . bitrix_sessid_get();
$arResult["canDelete"] = "Y";
}
}
if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["Post"])) {
if (array_key_exists("RATING_ENTITY_ID", $arParams) && intval($arParams["RATING_ENTITY_ID"]) > 0 && array_key_exists("RATING_TOTAL_VALUE", $arParams) && is_numeric($arParams["RATING_TOTAL_VALUE"]) && array_key_exists("RATING_TOTAL_VOTES", $arParams) && intval($arParams["RATING_TOTAL_VOTES"]) >= 0 && array_key_exists("RATING_TOTAL_POSITIVE_VOTES", $arParams) && intval($arParams["RATING_TOTAL_POSITIVE_VOTES"]) >= 0 && array_key_exists("RATING_TOTAL_NEGATIVE_VOTES", $arParams) && intval($arParams["RATING_TOTAL_NEGATIVE_VOTES"]) >= 0 && array_key_exists("RATING_USER_VOTE_VALUE", $arParams) && is_numeric($arParams["RATING_USER_VOTE_VALUE"])) {
$arResult['RATING'][$arResult["Post"]["ID"]] = array("USER_VOTE" => $arParams["RATING_USER_VOTE_VALUE"], "USER_HAS_VOTED" => $arParams["RATING_USER_VOTE_VALUE"] == 0 ? "N" : "Y", "TOTAL_VOTES" => $arParams["RATING_TOTAL_VOTES"], "TOTAL_POSITIVE_VOTES" => $arParams["RATING_TOTAL_POSITIVE_VOTES"], "TOTAL_NEGATIVE_VOTES" => $arParams["RATING_TOTAL_NEGATIVE_VOTES"], "TOTAL_VALUE" => $arParams["RATING_TOTAL_VALUE"]);
} else {
$arResult['RATING'][$arResult["Post"]["ID"]] = CRatings::GetRatingVoteResult('BLOG_POST', $arResult["Post"]["ID"]);
}
}
if ($arParams["IS_UNREAD"]) {
$arResult["Post"]["new"] = "Y";
}
if ($arParams["IS_HIDDEN"]) {
$arResult["Post"]["hidden"] = "Y";
}
$arResult["Post"]["IS_IMPORTANT"] = false;
if (is_array($arResult["POST_PROPERTIES"]["DATA"]["UF_BLOG_POST_IMPRTNT"]) && intval($arResult["POST_PROPERTIES"]["DATA"]["UF_BLOG_POST_IMPRTNT"]["VALUE"]) > 0) {
$arResult["Post"]["IS_IMPORTANT"] = true;
unset($arResult["POST_PROPERTIES"]["DATA"]["UF_BLOG_POST_IMPRTNT"]);
$arResult["Post"]["IMPORTANT"] = array();
if ($GLOBALS["USER"]->IsAuthorized()) {
$arResult["Post"]["IMPORTANT"] = array("COUNT" => 0, "IS_READ" => false, "USER" => array());
示例7: foreach
$arTopicId[] = $res['TOPIC_ID'];
} else {
$arPostId[] = $res['ID'];
}
}
if (!empty($arAuthorId)) {
foreach ($arParams["RATING_ID"] as $key => $ratingId) {
$arParams["RATING_ID"][$key] = intval($ratingId);
$arRatingResult[$arParams["RATING_ID"][$key]] = CRatings::GetRatingResult($arParams["RATING_ID"][$key], array_unique($arAuthorId));
}
}
if (!empty($arPostId)) {
$arRatingVote['FORUM_POST'] = CRatings::GetRatingVoteResult('FORUM_POST', $arPostId);
}
if (!empty($arTopicId)) {
$arRatingVote['FORUM_TOPIC'] = CRatings::GetRatingVoteResult('FORUM_TOPIC', $arTopicId);
}
}
/*************** Default data **************************************/
if (!empty($arResult["ERROR_MESSAGE"])) {
?>
<div class="forum-note-box forum-note-error">
<div class="forum-note-box-text"><?php
echo ShowError($arResult["ERROR_MESSAGE"], "forum-note-error");
?>
</div>
</div>
<?php
}
if (!empty($arResult["OK_MESSAGE"])) {
?>
示例8: intval
if ($key === 0) {
$rating_entity_type = $arCommentTmp["EVENT"]["RATING_TYPE_ID"];
}
if ($key >= $arParams["COMMENTS_IN_EVENT"] && (intval($arResult["LAST_LOG_TS"]) <= 0 || $arResult["COUNTER_TYPE"] == "**" && MakeTimeStamp($arCommentTmp["EVENT"]["LOG_DATE"]) - intval($arResult["TZ_OFFSET"]) <= $arResult["LAST_LOG_TS"])) {
//
} else {
if ($arResult["COUNTER_TYPE"] == "**" && intval($arResult["LAST_LOG_TS"]) > 0 && MakeTimeStamp($arCommentTmp["EVENT"]["LOG_DATE"]) - intval($arResult["TZ_OFFSET"]) >= $arResult["LAST_LOG_TS"] && $arCommentTmp["EVENT"]["USER_ID"] != $GLOBALS["USER"]->GetID()) {
$arResult["NEW_COMMENTS"]++;
}
$arCommentTmp["CAN_EDIT"] = $bHasEditCallback && intval($arCommentTmp["EVENT"]["USER_ID"]) > 0 && intval($arCommentTmp["EVENT"]["USER_ID"]) == $GLOBALS["USER"]->GetId() ? "Y" : "N";
$arCommentTmp["CAN_DELETE"] = $bHasDeleteCallback && $arCommentTmp["CAN_EDIT"] == "Y" ? "Y" : "N";
$arCommentsFullListCut[] = $arCommentTmp;
}
$arCommentID[] = $arCommentTmp["EVENT"]["RATING_ENTITY_ID"];
}
$arEvent["COMMENTS"] = array_reverse($arCommentsFullListCut);
$arResult["RATING_COMMENTS"] = array();
if (!empty($arCommentID) && $arParams["SHOW_RATING"] == "Y" && strlen($rating_entity_type) > 0) {
$arResult["RATING_COMMENTS"] = CRatings::GetRatingVoteResult($rating_entity_type, $arCommentID);
}
} elseif ($arResult["COUNTER_TYPE"] == "**") {
foreach ($arCommentsFullList as $key => $arCommentTmp) {
if (intval($arResult["LAST_LOG_TS"]) > 0 && MakeTimeStamp($arCommentTmp["EVENT"]["LOG_DATE"]) - intval($arResult["TZ_OFFSET"]) >= $arResult["LAST_LOG_TS"]) {
$arResult["NEW_COMMENTS"]++;
}
}
}
}
}
$arResult["Event"] = $arEvent;
$this->IncludeComponentTemplate();
示例9: array
</a>
</div>
<?php
}
global $by, $order;
/********************************************************************
Input params
********************************************************************/
/*************** Ratings *********************************************/
if ($arParams["SHOW_RATING"] == 'Y') {
$arFileId = array();
foreach ($arResult["GRID_DATA"] as $data) {
$arFileId[] = $data['data']['ID'];
}
if (!empty($arFileId)) {
$arResult['RATING'] = CRatings::GetRatingVoteResult('IBLOCK_ELEMENT', $arFileId);
}
if ($arParams["RATING_TYPE"] == "") {
$sRatingVoteType = COption::GetOptionString("main", "rating_vote_type", "standart");
if ($sRatingVoteType == "like_graphic") {
$arParams["RATING_TYPE"] = "like";
} else {
if ($sRatingVoteType == "standart") {
$arParams["RATING_TYPE"] = "standart_text";
}
}
} else {
if ($arParams["RATING_TYPE"] == "like_graphic") {
$arParams["RATING_TYPE"] = "like";
} else {
if ($arParams["RATING_TYPE"] == "standart") {
示例10: __SLMGetLogRecord
//.........这里部分代码省略.........
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
if (!array_key_exists("COMMENTS_PARAMS", $arEvent["FIELDS_FORMATTED"])) {
$entities_xml_id = array("tasks" => array("TASK", "TK", "FORUM|COMMENT"), "forum" => array("FORUM", "FM", "FORUM|COMMENT"), "photo_photo" => array("PHOTO", "PH", "FORUM|COMMENT"), "sonet" => array("SOCNET", "SC", ""), "lists_new_element" => array("WF", "WF", ""));
if (array_key_exists($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"], $entities_xml_id) && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][1], "ENTITY_XML_ID" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][0] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"], "NOTIFY_TAGS" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][2]);
} else {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => substr(strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], 0, 2), "ENTITY_XML_ID" => strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], "NOTIFY_TAGS" => "");
}
}
$timestamp = MakeTimeStamp(isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (isset($arParams["FIELDS_FORMATTED"]["EVENT"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT"]["LOG_DATE_FORMAT"] : $arParams["EVENT"]["LOG_DATE"]));
$timeFormated = FormatDate(GetMessage("SONET_SLM_FORMAT_TIME"), $timestamp);
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
$dateTimeFormated = __SMLFormatDate($timestamp);
} else {
$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) {
$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);
}
$arEvent["FIELDS_FORMATTED"]["LOG_TIME_FORMAT"] = $timeFormated;
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
if (array_key_exists("EVENT_FORMATTED", $arEvent["FIELDS_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && array_key_exists("LOG_DATE_FORMAT", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$bToday = ConvertTimeStamp(MakeTimeStamp($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]), "SHORT") == ConvertTimeStamp();
if ($bToday) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
} else {
$bToday = $arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] == ConvertTimeStamp();
if ($bToday) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
}
} else {
$arFormat = array("tommorow" => "tommorow, " . GetMessage("SONET_SLM_FORMAT_TIME"), "today" => "today, " . GetMessage("SONET_SLM_FORMAT_TIME"), "yesterday" => "yesterday, " . GetMessage("SONET_SLM_FORMAT_TIME"), "" => date("Y", $timestamp) == date("Y") ? GetMessage("SONET_SLM_FORMAT_DATE") : GetMessage("SONET_SLM_FORMAT_DATE_YEAR"));
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = FormatDate($arFormat, $timestamp);
}
if (is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
if ($arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && $arCommentEvent["OPERATION_ADD"] == "log_rights") {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = CSocNetLogRights::CheckForUser($arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
} else {
$array_key = $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"];
if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
} else {
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
$GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"]) ? "Y" : "N";
} else {
$GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
}
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
}
}
}
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = $arParams["EVENT"]["FAVORITES"];
if ($arParams["USE_FOLLOW"] == "Y") {
$arEvent["FIELDS_FORMATTED"]["EVENT"]["FOLLOW"] = $arParams["EVENT"]["FOLLOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW_X1"] = $arParams["EVENT"]["DATE_FOLLOW_X1"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW"] = $arParams["EVENT"]["DATE_FOLLOW"];
}
if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && is_object($GLOBALS["USER"]) && (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) || array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"]))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] = 0;
$bExtranetUser = CModule::IncludeModule("extranet") && !CExtranet::IsIntranetUser();
$arGroupID = CSocNetLogTools::GetAvailableGroups($bExtranetUser ? "Y" : "N");
if (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] as $key => $arDestination) {
if (array_key_exists("TYPE", $arDestination) && array_key_exists("ID", $arDestination) && ($arDestination["TYPE"] == "SG" && !in_array(intval($arDestination["ID"]), $arGroupID) || $arDestination["TYPE"] == "DR" && $bExtranetUser)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"][$key]);
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
}
}
if (intval($arParams["DESTINATION_LIMIT_SHOW"]) > 0 && count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) > $arParams["DESTINATION_LIMIT_SHOW"]) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_MORE"] = count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) + $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] - $arParams["DESTINATION_LIMIT_SHOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] = array_slice($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"], 0, $arParams["DESTINATION_LIMIT_SHOW"]);
}
}
}
if ($arParams["SHOW_RATING"] == "Y" && strlen($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"]) > 0 && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["RATING"] = CRatings::GetRatingVoteResult($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]);
}
if (array_key_exists("FAVORITES_USER_ID", $arEvent) && intval($arEvent["FAVORITES_USER_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = "Y";
} else {
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = "N";
}
return $arEvent["FIELDS_FORMATTED"];
}
示例11: define
<?php
define("NO_KEEP_STATISTIC", "Y");
define("NO_AGENT_STATISTIC", "Y");
define("PUBLIC_AJAX_MODE", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$entityTypeId = $_REQUEST['ENTITY_TYPE_ID'];
$entityId = intval($_REQUEST['ENTITY_ID']);
$voteAction = $_REQUEST['VOTE_ACTION'] == 'plus' ? 'plus' : 'minus';
$userId = $USER->GetId();
$arRatingResult = CRatings::GetRatingVoteResult($entityTypeId, $entityId, $USER->GetId());
if (empty($arRatingResult)) {
$arRatingResult['USER_HAS_VOTED'] = $USER->IsAuthorized() ? "N" : "Y";
$arRatingResult['TOTAL_VALUE'] = 0;
$arRatingResult['TOTAL_VOTES'] = 0;
$arRatingResult['TOTAL_POSITIVE_VOTES'] = 0;
$arRatingResult['TOTAL_NEGATIVE_VOTES'] = 0;
}
$path = str_replace(array("\\", "//"), "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/vote.php");
include_once $path;
$resultValue = $arRatingResult['TOTAL_VALUE'];
$resultStatus = $resultValue < 0 ? 'minus' : 'plus';
$resultTitle = sprintf($MESS["RATING_COMPONENT_DESC"], $arRatingResult['TOTAL_VOTES'], $arRatingResult['TOTAL_POSITIVE_VOTES'], $arRatingResult['TOTAL_NEGATIVE_VOTES']);
echo '{"result" : "true", "resultValue" : "' . $resultValue . '", "resultStatus" : "' . $resultStatus . '", "resultTitle" : "' . $resultTitle . '"}';
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例12: prepareParams
protected function prepareParams(array &$arParams, array &$arResult)
{
// Action params
/*@param string $arParams["mfi"] contains hash of something to add new uploaded file into session array */
$arParams["mfi"] = trim($arParams["mfi"]);
// List params
/*@param string $arParams["ENTITY_XML_ID"] main param that means ID */
$arParams["ENTITY_XML_ID"] = trim($arParams["ENTITY_XML_ID"]);
/*@param array $arParams["RECORDS"] contains data to view */
$arParams["RECORDS"] = is_array($arParams["RECORDS"]) ? $arParams["RECORDS"] : array();
$arParams["NAV_STRING"] = !!$arParams["NAV_STRING"] && is_string($arParams["NAV_STRING"]) ? $arParams["NAV_STRING"] : "";
//$arParams["NAV_RESULT"] = (!!$arParams["NAV_STRING"] && is_object($arParams["NAV_RESULT"]) ? $arParams["NAV_RESULT"] : false);
$arParams["PREORDER"] = $arParams["PREORDER"] == "Y" ? "Y" : "N";
$arParams["RIGHTS"] = is_array($arParams["RIGHTS"]) ? $arParams["RIGHTS"] : array();
foreach (array("MODERATE", "EDIT", "DELETE") as $act) {
$arParams["RIGHTS"][$act] = in_array(strtoupper($arParams["RIGHTS"][$act]), array("Y", "ALL", "OWN", "OWNLAST")) ? $arParams["RIGHTS"][$act] : "N";
}
$arParams["LAST_RECORD"] = array();
// Answer params
/*@param int $arParams["RESULT"] contains id of new record for cutting out and sending back*/
$arParams["RESULT"] = intval($arParams["RESULT"] ?: $this->request->getPost("MID"));
/*@param array $arParams["PUSH&PULL"] contains record id to pushing other clients */
$arParams["PUSH&PULL"] = isset($arParams["~PUSH&PULL"]) ? $arParams["~PUSH&PULL"] : $arParams["PUSH&PULL"];
$arParams["MODE"] = is_array($arParams["PUSH&PULL"]) && $arParams["PUSH&PULL"]["ID"] > 0 && $arParams["MODE"] == "PULL_MESSAGE" ? "PULL_MESSAGE" : "PLAIN";
/*@param string $arParams["NOTIFY_TAG"] params for bottom notifier */
$arParams["NOTIFY_TAG"] = trim($arParams["NOTIFY_TAG"]);
$arParams["NOTIFY_TEXT"] = trim($arParams["NOTIFY_TEXT"]);
$arParams["ERROR_MESSAGE"] = trim($arParams["ERROR_MESSAGE"]);
$arParams["OK_MESSAGE"] = trim($arParams["OK_MESSAGE"]);
// Template params
$arParams["VISIBLE_RECORDS_COUNT"] = !!$arParams["NAV_RESULT"] ? intval($arParams["VISIBLE_RECORDS_COUNT"]) : 0;
$arParams["TEMPLATE_ID"] = !!$arParams["TEMPLATE_ID"] ? $arParams["TEMPLATE_ID"] : 'COMMENT_' . $arParams["ENTITY_XML_ID"] . '_';
$arParams["AVATAR_SIZE"] = $arParams["AVATAR_SIZE"] > 0 ? $arParams["AVATAR_SIZE"] : 39;
//$arParams["IMAGE_SIZE"] = ($arParams["IMAGE_SIZE"] > 0 ? $arParams["IMAGE_SIZE"] : 30);
$arParams['SHOW_MINIMIZED'] = $arParams['SHOW_MINIMIZED'] == "Y" ? "Y" : "N";
$arParams["NAME_TEMPLATE"] = !!$_REQUEST["NAME_TEMPLATE"] ? $_REQUEST["NAME_TEMPLATE"] : \CSite::GetNameFormat();
$arParams["SHOW_LOGIN"] = $_REQUEST["SHOW_LOGIN"] == "Y" ? "Y" : "N";
$arParams["DATE_TIME_FORMAT"] = trim($arParams["DATE_TIME_FORMAT"]);
$arParams["SHOW_POST_FORM"] = $arParams["SHOW_POST_FORM"] == "Y" ? "Y" : "N";
$arParams["BIND_VIEWER"] = $arParams["BIND_VIEWER"] == "Y" ? "Y" : "N";
$arParams["SIGN"] = $this->sign->sign($arParams["ENTITY_XML_ID"], "main.post.list");
$arParams["VIEW_URL"] = trim($arParams["VIEW_URL"]);
$arParams["EDIT_URL"] = trim($arParams["EDIT_URL"]);
$arParams["MODERATE_URL"] = trim($arParams["MODERATE_URL"]);
$arParams["DELETE_URL"] = trim($arParams["DELETE_URL"]);
$arParams["AUTHOR_URL"] = trim($arParams["PATH_TO_USER"] ?: $arParams["AUTHOR_URL"]);
if ($arParams["VISIBLE_RECORDS_COUNT"] > 0) {
if ($arParams["NAV_RESULT"]->bShowAll) {
$arParams["VISIBLE_RECORDS_COUNT"] = 0;
} else {
if (array_key_exists($arParams['RESULT'], $arParams["RECORDS"])) {
$arParams["VISIBLE_RECORDS_COUNT"] = count($arParams["RECORDS"]);
} else {
if (0 < $arParams["NAV_RESULT"]->NavRecordCount && $arParams["NAV_RESULT"]->NavRecordCount <= $arParams["VISIBLE_RECORDS_COUNT"]) {
$arParams["VISIBLE_RECORDS_COUNT"] = $arParams["NAV_RESULT"]->NavRecordCount;
} else {
if (isset($_REQUEST["PAGEN_" . $arParams["NAV_RESULT"]->NavNum]) || isset($_REQUEST["FILTER"]) && $arParams["ENTITY_XML_ID"] == $_REQUEST["ENTITY_XML_ID"]) {
$arParams["VISIBLE_RECORDS_COUNT"] = 0;
}
}
}
}
if (!!$arParams["NAV_STRING"]) {
$path = "PAGEN_" . $arParams["NAV_RESULT"]->NavNum . "=";
if ($arParams["VISIBLE_RECORDS_COUNT"] > 0) {
$path .= $arParams["NAV_RESULT"]->NavPageNomer;
} else {
if ($arParams["NAV_RESULT"]->bDescPageNumbering) {
$path .= $arParams["NAV_RESULT"]->NavPageNomer - 1;
} else {
$path .= $arParams["NAV_RESULT"]->NavPageNomer + 1;
}
}
$arParams["NAV_STRING"] .= (strpos($arParams["NAV_STRING"], "?") === false ? "?" : "&") . $path;
}
}
if (!empty($arParams["RECORDS"])) {
if ($arParams["VISIBLE_RECORDS_COUNT"] > 0) {
$list = array();
$res = 0;
for ($ii = 0; $ii < $arParams["VISIBLE_RECORDS_COUNT"]; $ii++) {
$res = array_shift($arParams["RECORDS"]);
$list[$res["ID"]] = $res;
}
$arParams["RECORDS"] = $list;
}
$arParams["LAST_RECORD"] = end($arParams["RECORDS"]);
reset($arParams["RECORDS"]);
if ($arParams["PREORDER"] === "N") {
$arParams["RECORDS"] = array_reverse($arParams["RECORDS"], true);
}
if (!empty($arParams["RATING_TYPE_ID"])) {
$arParams["RATING_RESULTS"] = CRatings::GetRatingVoteResult($arParams["RATING_TYPE_ID"], array_keys($arParams["RECORDS"]));
}
$arParams["~RECORDS"] = $arParams["RECORDS"];
foreach ($arParams["~RECORDS"] as $key => &$res) {
$arParams["RECORDS"][$key] = $this->buildComment($res);
}
}
$arResult["AUTHOR"] = array("ID" => $this->getUser()->getId(), "NAME" => CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $this->getUser()->getFirstName(), "LAST_NAME" => $this->getUser()->getLastName(), "SECOND_NAME" => $this->getUser()->getSecondName(), "LOGIN" => $this->getUser()->getLogin(), "NAME_LIST_FORMATTED" => ""), $arParams["SHOW_LOGIN"] != "N", false), "AVATAR" => \CFile::ResizeImageGet($_SESSION["SESS_AUTH"]["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT));
//.........这里部分代码省略.........
示例13: __SLEGetLogRecord
//.........这里部分代码省略.........
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
} elseif ($arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] == ConvertTimeStamp()) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT_ID"]);
if (!array_key_exists("HAS_COMMENTS", $arEvent["FIELDS_FORMATTED"]) || $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] != "N") {
$arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] = $arCommentEvent && (!array_key_exists("ENABLE_COMMENTS", $arEvent) || $arEvent["ENABLE_COMMENTS"] != "N") ? "Y" : "N";
}
}
if (is_object($cache)) {
$arCacheData = array("FIELDS_FORMATTED" => $arEvent["FIELDS_FORMATTED"]);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
if (is_array($arCurrentUserSubscribe)) {
$arEvent["FIELDS_FORMATTED"]["TRANSPORT"] = __SLEGetTransport($arEvent, $arCurrentUserSubscribe);
}
$array_key = $arEvent["ENTITY_TYPE"] . "_" . $arEvent["ENTITY_ID"] . "_" . $arEvent["EVENT_ID"];
if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
} else {
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["EVENT_ID"]);
if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
$GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvent["ENTITY_TYPE"], $arEvent["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"], $bCurrentUserIsAdmin) ? "Y" : "N";
} else {
$GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
}
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
}
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = $arParams["EVENT"]["FAVORITES"];
if ($arParams["USE_FOLLOW"] == "Y") {
$arEvent["FIELDS_FORMATTED"]["EVENT"]["FOLLOW"] = $arParams["EVENT"]["FOLLOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW_X1"] = $arParams["EVENT"]["DATE_FOLLOW_X1"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW"] = $arParams["EVENT"]["DATE_FOLLOW"];
}
if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && !$bCurrentUserIsAdmin && is_object($GLOBALS["USER"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) || array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"]))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] = 0;
$arGroupID = array();
if (!empty($GLOBALS["SONET_GROUPS_ID_AVAILABLE"])) {
$arGroupID = $GLOBALS["SONET_GROUPS_ID_AVAILABLE"];
} else {
// get tagged cached available groups and intersect
$cache = new CPHPCache();
$cache_id = $GLOBALS["USER"]->GetID();
$cache_path = "/sonet/groups_available/";
if ($cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arGroupID = $arCacheVars["arGroupID"];
} else {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
}
$rsGroup = CSocNetGroup::GetList(array(), array("CHECK_PERMISSIONS" => $GLOBALS["USER"]->GetID()), false, false, array("ID"));
while ($arGroup = $rsGroup->Fetch()) {
$arGroupID[] = $arGroup["ID"];
}
$arCacheData = array("arGroupID" => $arGroupID);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
$GLOBALS["SONET_GROUPS_ID_AVAILABLE"] = $arGroupID;
}
if (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] as $key => $arDestination) {
if (array_key_exists("TYPE", $arDestination) && array_key_exists("ID", $arDestination) && $arDestination["TYPE"] == "SG" && !in_array(intval($arDestination["ID"]), $arGroupID)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"][$key]);
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
}
}
if (intval($arParams["DESTINATION_LIMIT_SHOW"]) > 0 && count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) > $arParams["DESTINATION_LIMIT_SHOW"]) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_MORE"] = count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) - $arParams["DESTINATION_LIMIT_SHOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] = array_slice($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"], 0, $arParams["DESTINATION_LIMIT_SHOW"]);
}
} elseif (array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"] as $key => $right_tmp) {
if (preg_match('/^SG(\\d+)$/', $right_tmp, $matches) && !in_array(intval($matches[1]), $arGroupID)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"][$key]);
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
}
}
}
}
if ($arParams["SHOW_RATING"] == "Y" && strlen($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"]) > 0 && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["RATING"] = CRatings::GetRatingVoteResult($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]);
}
return $arEvent["FIELDS_FORMATTED"];
}
示例14: array
}
// avatars
if ($arResult['TASK']["CREATED_BY_PHOTO"] > 0) {
$imageFile = CFile::GetFileArray($arResult['TASK']["CREATED_BY_PHOTO"]);
if ($imageFile !== false) {
$arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 58, "height" => 58), BX_RESIZE_IMAGE_EXACT, false);
$arResult['TASK']["CREATED_BY_PHOTO"] = $arFileTmp["src"];
} else {
$arResult['TASK']["CREATED_BY_PHOTO"] = false;
}
}
if ($arResult['TASK']["RESPONSIBLE_PHOTO"] > 0) {
$imageFile = CFile::GetFileArray($arResult['TASK']["RESPONSIBLE_PHOTO"]);
if ($imageFile !== false) {
$arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 58, "height" => 58), BX_RESIZE_IMAGE_EXACT, false);
$arResult['TASK']["RESPONSIBLE_PHOTO"] = $arFileTmp["src"];
} else {
$arResult['TASK']["RESPONSIBLE_PHOTO"] = false;
}
}
// for buttons only
if (isset($arParams['TASK_ID']) && in_array('buttons', $arResult['BLOCKS'])) {
// ratings
if (intval($arResult['TASK']['ID'])) {
$arResult["RATING"] = CRatings::GetRatingVoteResult("TASK", $arResult['TASK']['ID']);
}
}
} catch (Exception $e) {
return false;
}
$this->IncludeComponentTemplate();
示例15: array_keys
else
{
$GLOBALS["NavNum"]++;
if ($arAllow["VIDEO"] == "Y")
{
foreach ($arMessages as $key => $res):
$arAllow["SMILES"] = ($res["USE_SMILES"] == "Y" ? $arResult["FORUM"]["ALLOW_SMILES"] : "N");
$arMessages[$key]["POST_MESSAGE_TEXT"] = $parser->convert($res["~POST_MESSAGE_TEXT"], $arAllow);
endforeach;
}
}
/************** Rating ****************************************/
if ($arParams["SHOW_RATING"] == "Y")
{
$arMessageIDs = array_keys($arMessages);
$arRatings = CRatings::GetRatingVoteResult('FORUM_POST', $arMessageIDs);
if ($arRatings)
foreach($arRatings as $messageID => $arRating)
$arMessages[$messageID]['RATING'] = $arRating;
}
$arResult["MESSAGES"] = $arMessages;
// Link to forum
$arResult["read"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"],
array("FID" => $arParams["FORUM_ID"], "TID" => $arResult["FORUM_TOPIC_ID"], "TITLE_SEO" => $arResult["FORUM_TOPIC_ID"], "MID" => "s",
"PARAM1" => "IB", "PARAM2" => $arParams["ELEMENT_ID"]));
}
/************** 5. Show post form **********************************/
$arResult["SHOW_POST_FORM"] = (($arResult["USER"]["PERMISSION"] >= "M" || ($arResult["USER"]["PERMISSION"] >= "I" && !empty($arResult["MESSAGES"]))) ? "Y" : "N");
if ($arResult["SHOW_POST_FORM"] == "Y")
{