Beispiel #1
0


CJSCore::Init("jquery");

if ($this->StartResultCache(false, $cache_id, $cache_path))
{
	// caching
	$CACHE_MANAGER->StartTagCache($cache_path);
	$CACHE_MANAGER->RegisterTag("prmedia_treelike_comments_" . $arParams["OBJECT_ID"]);
	$arResult['GROUPS'] = $comment->IsModerator();
	getComments(false, 0, $comments, $left_margin, $arResult['DATE_FORMAT'], $userlink, $commentLink, $max_depth_level, $arResult['ASNAME'], $arIDs, $templateFolder, $arResult['CAN_MODIFY']);
	if (!empty($arIDs))
	{
		// @todo create method for below calculation in some class
		$resVoteIDs = $comment->GetVotedIDs($arIDs);
		while ($arIDs = $resVoteIDs->GetNext())
		{
			if ($arIDs["VOTE_TYPE"] == "UP")
			{
				if ($arIDs["COUNT"] > 0)
				{
					$comments[$arIDs["COMMENT_ID"]]["VoteUp"] = $arIDs["COUNT"];
				} else
				{
					$comments[$arIDs["COMMENT_ID"]]["VoteUp"] = 0;
				}
			}
			if ($arIDs["VOTE_TYPE"] == "DOWN")
			{
				if ($arIDs["COUNT"] > 0)
Beispiel #2
0
	$arFilter = array(
		"OBJECT_ID_NUMBER" => $arParams["OBJECT_ID"],
		"SITE_ID" => SITE_ID,
	);

	$resComm = CTreelikeComments::GetList(array(), $arFilter);
	while($arComm = $resComm->GetNext()):
		$arIDs[] = $arComm["ID"];
		$arItems[$arComm["ID"]] = $arComm;
		$arItems[$arComm["ID"]]["COMMENT"] = $arComm["~COMMENT"];
	endwhile;

	// Count votes
	if(!empty($arIDs))
	{
		$resVoteIDs = CTreelikeComments::GetVotedIDs($arIDs);
		$allbestCommentsCount = 0; // corresponding to the condition

		while($arIDs = $resVoteIDs->GetNext()):
			if($arIDs["VOTE_TYPE"] == "UP")
			{
				if($arIDs["COUNT"] > 0)
					$arItems[$arIDs["COMMENT_ID"]]["VoteUp"] = $arIDs["COUNT"];
				else
					$arItems[$arIDs["COMMENT_ID"]]["VoteUp"] = 0;
			}
			if($arIDs["VOTE_TYPE"] == "DOWN")
			{
				if($arIDs["COUNT"] > 0)
					$arItems[$arIDs["COMMENT_ID"]]["VoteDown"] = $arIDs["COUNT"];
				else