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


PHP CRatings类代码示例

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


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

示例1: CalcUserBonus

	function CalcUserBonus($arConfigs)
	{
		global $DB;

		$err_mess = (CRatings::err_mess())."<br>Function: CalcUserBonus<br>Line: ";

		$communityLastVisit = COption::GetOptionString("main", "rating_community_last_visit", '90');

		CRatings::AddComponentResults($arConfigs);

		$strSql = "DELETE FROM b_rating_component_results WHERE RATING_ID = '".IntVal($arConfigs['RATING_ID'])."' AND COMPLEX_NAME = '".$DB->ForSql($arConfigs['COMPLEX_NAME'])."'";
		$res = $DB->Query($strSql, false, $err_mess.__LINE__);

		$strSql = "INSERT INTO b_rating_component_results (RATING_ID, MODULE_ID, RATING_TYPE, NAME, COMPLEX_NAME, ENTITY_ID, ENTITY_TYPE_ID, CURRENT_VALUE)
					SELECT
						'".IntVal($arConfigs['RATING_ID'])."'  RATING_ID,
						'".$DB->ForSql($arConfigs['MODULE_ID'])."'  MODULE_ID,
						'".$DB->ForSql($arConfigs['RATING_TYPE'])."'  RATING_TYPE,
						'".$DB->ForSql($arConfigs['NAME'])."'  NAME,
						'".$DB->ForSql($arConfigs['COMPLEX_NAME'])."'  COMPLEX_NAME,
						RB.ENTITY_ID as ENTITY_ID,
						'".$DB->ForSql($arConfigs['ENTITY_ID'])."'  ENTITY_TYPE_ID,
						RB.BONUS*".floatval($arConfigs['CONFIG']['COEFFICIENT'])."  CURRENT_VALUE
					FROM
						b_rating_user RB
						LEFT JOIN b_user U ON U.ID = RB.ENTITY_ID AND U.ACTIVE = 'Y' AND U.LAST_LOGIN > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
					WHERE
						RB.RATING_ID = ".IntVal($arConfigs['RATING_ID'])."
						AND U.ID IS NOT NULL
					";
		$res = $DB->Query($strSql, false, $err_mess.__LINE__);

		return true;
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:34,代码来源:ratings_components.php

示例2: subordinateCheck

 function subordinateCheck($arConfigs)
 {
     global $DB, $USER_FIELD_MANAGER;
     $err_mess = "File: " . __FILE__ . "<br>Function: subordinateCheck<br>Line: ";
     $ratingId = CRatings::GetAuthorityRating();
     if ($ratingId == 0) {
         return true;
     }
     $maxVotes = $arConfigs['CONDITION_CONFIG']['SUBORDINATE']['MAX_VOTES'];
     $type = $arConfigs['CONDITION_CONFIG']['SUBORDINATE']['TYPE'];
     $iblockId = COption::GetOptionInt('intranet', 'iblock_structure', 0);
     global $DB;
     $table = 'b_utm_user';
     $columns = array('FIELD_ID', 'VALUE_INT', 'VALUE_ID');
     if (!$DB->IndexExists($table, $columns)) {
         $DB->Query("create index " . substr("ix_" . mt_rand(0, 1000000) . "_" . $table . "_" . implode("_", $columns), 0, 30) . " on " . $table . "(" . implode(", ", $columns) . ")", true);
     }
     $table = 'b_uts_iblock_' . $iblockId . '_section';
     $columns = array('UF_HEAD');
     if (!$DB->IndexExists($table, $columns)) {
         $DB->Query("create index " . substr("ix_" . mt_rand(0, 1000000) . "_" . $table . "_" . implode("_", $columns), 0, 30) . " on " . $table . "(" . implode(", ", $columns) . ")", true);
     }
     $fieldId = 0;
     $arUserFields = $USER_FIELD_MANAGER->GetUserFields("USER");
     if (isset($arUserFields["UF_DEPARTMENT"]["ID"])) {
         $fieldId = intval($arUserFields["UF_DEPARTMENT"]["ID"]);
     }
     if ($iblockId > 0 && $fieldId > 0) {
         // truncate table first
         $DB->Query("TRUNCATE TABLE b_rating_subordinate", false, $err_mess . __LINE__);
         $squery = "\n\t\t\t\tINSERT INTO b_rating_subordinate (RATING_ID, ENTITY_ID, VOTES)\n\t\t\t\tSELECT '" . intval($ratingId) . "' RATING_ID, U2U.USER_ID ENTITY_ID, (case when U2U.ID > 0 then SUM(" . $DB->IsNull("RU.BONUS", "RUS.BONUS") . ") else RUS.BONUS end) VOTES\n\t\t\t\tFROM\n\t\t\t\t(\n\t\t\t\t\tSELECT DISTINCT U.ID USER_ID, UP.VALUE_ID SUBORDINATE_ID, UD.ID\n\t\t\t\t\tFROM\n\t\t\t\t\tb_user U\n\t\t\t\t\tLEFT JOIN b_utm_user UD ON UD.VALUE_ID = U.ID AND UD.FIELD_ID = " . $fieldId . "\n\t\t\t\t\tLEFT JOIN b_uts_iblock_" . $iblockId . "_section BSSV on BSSV.UF_HEAD = U.ID\n\t\t\t\t\tLEFT JOIN b_iblock_section BS ON BS.ID = BSSV.VALUE_ID\n\t\t\t\t\tLEFT JOIN b_iblock_section BsubS on BsubS.IBLOCK_ID = BS.IBLOCK_ID AND BsubS.LEFT_MARGIN >= BS.LEFT_MARGIN AND BsubS.RIGHT_MARGIN <= BS.RIGHT_MARGIN\n\t\t\t\t\tLEFT JOIN b_uts_iblock_" . $iblockId . "_section NACH_PODOTD on NACH_PODOTD.VALUE_ID = BsubS.ID\n\t\t\t\t\tLEFT JOIN b_utm_user UP on (UP.VALUE_INT = BsubS.ID) OR (UP.VALUE_ID = NACH_PODOTD.UF_HEAD) AND UP.FIELD_ID = " . $fieldId . "\n\t\t\t\t\tLEFT JOIN b_user U2 on U2.ID = UP.VALUE_ID\n\t\t\t\t\tWHERE (U2.ACTIVE = 'Y' OR U2.ID IS NULL) AND U.ACTIVE = 'Y'\n\t\t\t\t) U2U\n\t\t\t\tLEFT JOIN b_rating_user RU on RU.RATING_ID = " . intval($ratingId) . " and RU.ENTITY_ID = U2U.SUBORDINATE_ID\n\t\t\t\tLEFT JOIN b_rating_user RUS on RUS.RATING_ID = " . intval($ratingId) . " and RUS.ENTITY_ID = U2U.USER_ID\n\t\t\t\tGROUP BY U2U.USER_ID, U2U.ID, RU.BONUS, RUS.BONUS";
         $DB->Query($squery, false, $err_mess . __LINE__);
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:35,代码来源:rating_rules.php

示例3: 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;
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:ratings.php

示例4: voteCheck

 function voteCheck($arConfigs)
 {
     global $DB;
     $err_mess = "File: " . __FILE__ . "<br>Function: voteCheck<br>Line: ";
     $ratingId = CRatings::GetAuthorityRating();
     if ($ratingId == 0) {
         return true;
     }
     // 1. UPDATE OLD VOTE (< 90 day)
     $strSql = "\n\t\t\tUPDATE\n\t\t\t\tb_rating_vote\n\t\t\tSET\n\t\t\t\tACTIVE = 'N',\n\t\t\t\tUSER_ID = 0\n\t\t\tWHERE \n\t\t\t\tENTITY_TYPE_ID = 'USER' and CREATED < DATE_SUB(NOW(), INTERVAL " . intval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_LIMIT']) . " DAY)\n\t\t";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     // 2. INSERT NEW VOTE FOR AUTHORITY
     $sRatingUser = "";
     $sRatingWeightType = COption::GetOptionString("main", "rating_weight_type", "auto");
     if ($sRatingWeightType == 'auto') {
         $sRatingAuthrorityWeight = COption::GetOptionString("main", "rating_authority_weight_formula", 'Y');
         if ($sRatingAuthrorityWeight == 'Y') {
             $communitySize = COption::GetOptionString("main", "rating_community_size", 1);
             $communityAuthority = COption::GetOptionString("main", "rating_community_authority", 1);
             $voteWeight = COption::GetOptionString("main", "rating_vote_weight", 1);
             $sValue = "({$communitySize}*(RR.VOTE_WEIGHT/" . round($voteWeight, 4) . ")/" . round($communityAuthority) . ") as VALUE";
             $ratingId = CRatings::GetAuthorityRating();
             $sRatingUser = "LEFT JOIN b_rating_user RR ON RR.RATING_ID = " . intval($ratingId) . " AND RR.ENTITY_ID = RV.USER_ID";
         } else {
             $sValue = "1 as VALUE";
         }
     } else {
         $ratingId = CRatings::GetAuthorityRating();
         $sRatingUser = "LEFT JOIN b_rating_user RR ON RR.RATING_ID = " . intval($ratingId) . " AND RR.ENTITY_ID = RV.USER_ID";
         $sValue = "RR.VOTE_WEIGHT as VALUE";
     }
     $strSql = "\n\t\t\tINSERT INTO b_rating_vote (RATING_VOTING_ID, VALUE, ACTIVE, CREATED, USER_ID, USER_IP, ENTITY_TYPE_ID, ENTITY_ID, OWNER_ID)\n\t\t\tSELECT \n\t\t\t\t0 as RATING_VOTING_ID,\n\t\t\t   {$sValue},\n\t\t\t\t'N' as ACTIVE,\n\t\t   \t" . $DB->GetNowFunction() . " as CREATED,\n\t\t\t\tRV.USER_ID, \n\t\t\t\t'auto' as USER_IP, \n\t\t\t\t'USER' as ENTITY_TYPE_ID,\n\t\t\t\tRV.OWNER_ID as ENTITY_ID, \n\t\t\t\tRV.OWNER_ID\n\t\t\tFROM  \n\t\t\t\tb_rating_vote RV \n\t\t\t\t{$sRatingUser}\n\t\t\t\tLEFT JOIN b_rating_vote RV2 ON RV2.USER_ID = RV.USER_ID AND RV2.ENTITY_TYPE_ID = 'USER' AND RV2.ENTITY_ID = RV.OWNER_ID\n\t\t\tWHERE \n\t\t\t\tRV.CREATED > DATE_SUB(NOW(), INTERVAL " . intval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_LIMIT']) . " DAY)\n\t\t\tand RV.VALUE > 0 and RV2.VALUE IS NULL and RV.OWNER_ID > 0\n\t\t\tGROUP BY RV.USER_ID, RV.OWNER_ID\n\t\t\tHAVING \n\t\t\t\tSUM(case\n\t\t\t\t\twhen RV.ENTITY_TYPE_ID = 'FORUM_TOPIC' then " . floatval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_FORUM_TOPIC']) . "\n\t\t\t\t\twhen RV.ENTITY_TYPE_ID = 'FORUM_POST' then " . floatval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_FORUM_POST']) . "\n\t\t\t\t\twhen RV.ENTITY_TYPE_ID = 'BLOG_POST' then " . floatval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_BLOG_POST']) . "\n\t\t\t\t\twhen RV.ENTITY_TYPE_ID = 'BLOG_COMMENT' then " . floatval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_BLOG_COMMENT']) . "\n\t\t\t\telse 0 end) >= " . floatval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_RESULT']) . "\n\t\t";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     // 3.INSERT NEW VOTING GROUP (FROM STEP 2)
     $strSql = "\n\t\t\tINSERT INTO b_rating_voting (ENTITY_TYPE_ID, ENTITY_ID, ACTIVE, CREATED, LAST_CALCULATED, TOTAL_VALUE, TOTAL_VOTES, TOTAL_POSITIVE_VOTES, TOTAL_NEGATIVE_VOTES, OWNER_ID)\n\t\t\tSELECT \n\t\t\t\tRV.ENTITY_TYPE_ID, \n\t\t\t\tRV.ENTITY_ID,\n\t\t\t\t'Y' as ACTIVE,\n\t\t\t\t" . $DB->GetNowFunction() . " as CREATED,\n\t\t\t\t" . $DB->GetNowFunction() . " as LAST_CALCULATED,  \n\t\t\t\tSUM(VALUE) as TOTAL_VALUE,\n\t\t\t\tSUM(1) as TOTAL_VOTES,\n\t\t\t\tSUM(case when RV.VALUE > '0' then 1 else 0 end) as TOTAL_POSITIVE_VOTES, \t\n\t\t\t\tSUM(case when RV.VALUE > '0' then 0 else 1 end) as TOTAL_NEGATIVE_VOTES, \t\t\n\t\t\t\tRV.ENTITY_ID as OWNER_ID\n\t\t\tFROM  \n\t\t\t\tb_rating_vote RV \n\t\t\t\tLEFT JOIN b_rating_voting RVG ON RVG.ENTITY_TYPE_ID = RV.ENTITY_TYPE_ID AND RVG.ENTITY_ID = RV.ENTITY_ID\n\t\t\tWHERE \n\t\t\t\tRATING_VOTING_ID = 0\n\t\t\tand RV.CREATED > DATE_SUB(NOW(), INTERVAL " . intval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_LIMIT']) . " DAY)\n\t\t\tand RVG.ID IS NULL and RV.OWNER_ID > 0\n\t\t\tGROUP BY RV.ENTITY_TYPE_ID, RV.ENTITY_ID\n\t\t";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     // 4 UPDATE FIELD RATING_VOTE_ID (FROM STEP 3)
     $strSql = "\n\t\t\tUPDATE\n\t\t\t\tb_rating_vote RV,\n\t\t\t\tb_rating_voting RVG\n\t\t\tSET\n\t\t\t\tRV.RATING_VOTING_ID = RVG.ID,\n\t\t\t\tRV.ACTIVE = 'Y'\n\t\t\tWHERE \n\t\t\t\tRV.ENTITY_TYPE_ID = RVG.ENTITY_TYPE_ID\n\t\t\tand RV.ENTITY_ID = RVG.ENTITY_ID\n\t\t\tand RV.RATING_VOTING_ID = 0";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     // 5 INSERT TEMP TABLE VOTE RESULTS
     $DB->Query("TRUNCATE b_rating_voting_prepare", false, $err_mess . __LINE__);
     $strSql = "\n\t\t\tINSERT INTO b_rating_voting_prepare (RATING_VOTING_ID, TOTAL_VALUE, TOTAL_VOTES, TOTAL_POSITIVE_VOTES, TOTAL_NEGATIVE_VOTES)\n\t\t\tSELECT \t\t\t\t\n\t\t\t\tRV.RATING_VOTING_ID,\n\t\t\t\tSUM(RV.VALUE) as TOTAL_VALUE,\n\t\t\t\tSUM(1) as TOTAL_VOTES,\n\t\t\t\tSUM(case when RV.VALUE > '0' then 1 else 0 end) as TOTAL_POSITIVE_VOTES, \t\n\t\t\t\tSUM(case when RV.VALUE > '0' then 0 else 1 end) as TOTAL_NEGATIVE_VOTES \t\t\n\t\t\tFROM  \n\t\t\t\tb_rating_vote RV \n\t\t\tWHERE \n\t\t\t\tRV.RATING_VOTING_ID IN (SELECT DISTINCT RV0.RATING_VOTING_ID FROM b_rating_vote RV0 WHERE RV0.ACTIVE='N')\n\t\t\tand RV.USER_ID > 0\n\t\t\tGROUP BY RV.RATING_VOTING_ID";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     // 6 UPDATE VOTE_RESULTS FROM TEMP TABLE
     $strSql = "\n\t\t\tUPDATE\n\t\t\t\tb_rating_voting RVG,\n\t\t\t\tb_rating_voting_prepare RVG0\n\t\t\tSET\n\t\t\t\tRVG.TOTAL_VALUE = RVG0.TOTAL_VALUE,\n\t\t\t\tRVG.TOTAL_VOTES = RVG0.TOTAL_VOTES,\n\t\t\t\tRVG.TOTAL_POSITIVE_VOTES = RVG0.TOTAL_POSITIVE_VOTES,\n\t\t\t\tRVG.TOTAL_NEGATIVE_VOTES = RVG0.TOTAL_NEGATIVE_VOTES\n\t\t\tWHERE \n\t\t\t\tRVG.ID = RVG0.RATING_VOTING_ID";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     // 7 DELETE OLD POST
     $strSql = "DELETE FROM b_rating_vote WHERE ENTITY_TYPE_ID = 'USER' and CREATED < DATE_SUB(NOW(), INTERVAL " . intval($arConfigs['CONDITION_CONFIG']['VOTE']['VOTE_LIMIT']) . " DAY)";
     $DB->Query($strSql, false, $err_mess . __LINE__);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:rating_rules.php

示例5: CalcUserRatingForumActivity

 function CalcUserRatingForumActivity($arConfigs)
 {
     global $DB;
     $err_mess = CRatings::err_mess() . "<br>Function: CalcUserRatingForumActivity<br>Line: ";
     CRatings::AddComponentResults($arConfigs);
     $strSql = "DELETE FROM b_rating_component_results WHERE RATING_ID = '" . IntVal($arConfigs['RATING_ID']) . "' AND COMPLEX_NAME = '" . $DB->ForSql($arConfigs['COMPLEX_NAME']) . "'";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $sqlAllTopic = '';
     if (isset($arConfigs['CONFIG']['ALL_TOPIC_COEF']) && $arConfigs['CONFIG']['ALL_TOPIC_COEF'] != 0) {
         $sqlAllTopic = "\n\t\t\t\tSELECT\n\t\t\t\t\tUSER_START_ID as ENTITY_ID,\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['ALL_TOPIC_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_forum_topic\n\t\t\t\tWHERE START_DATE  < DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\tGROUP BY USER_START_ID\n\t\t\t\tUNION ALL ";
     }
     $sqlAllMessage = '';
     if (isset($arConfigs['CONFIG']['ALL_POST_COEF']) && $arConfigs['CONFIG']['ALL_POST_COEF'] != 0) {
         $sqlAllMessage = "\n\t\t\t\tSELECT\n\t\t\t\t\tAUTHOR_ID as ENTITY_ID,\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['ALL_POST_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_forum_message\n\t\t\t\tWHERE POST_DATE  < DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\tGROUP BY AUTHOR_ID\n\t\t\t\tUNION ALL ";
     }
     $strSql = "INSERT INTO b_rating_component_results (RATING_ID, MODULE_ID, RATING_TYPE, NAME, COMPLEX_NAME, ENTITY_ID, ENTITY_TYPE_ID, CURRENT_VALUE)\n\t\t\tSELECT\n\t\t\t\t'" . IntVal($arConfigs['RATING_ID']) . "' as RATING_ID,\n\t\t\t\t'" . $DB->ForSql($arConfigs['MODULE_ID']) . "' as MODULE_ID,\n\t\t\t\t'" . $DB->ForSql($arConfigs['RATING_TYPE']) . "' as RATING_TYPE,\n\t\t\t\t'" . $DB->ForSql($arConfigs['NAME']) . "' as NAME,\n\t\t\t\t'" . $DB->ForSql($arConfigs['COMPLEX_NAME']) . "' as COMPLEX_NAME,\n\t\t\t\tENTITY_ID,\n\t\t\t\t'" . $DB->ForSql($arConfigs['ENTITY_ID']) . "'  ENTITY_TYPE_ID,\n\t\t\t\tSUM(CURRENT_VALUE) CURRENT_VALUE\n\t\t\tFROM (\n\t\t\t\t" . $sqlAllMessage . "\n\n\t\t\t\tSELECT\n\t\t\t\t\tAUTHOR_ID as ENTITY_ID,\n\t\t\t\t\tSUM(IF(TO_DAYS(POST_DATE) > TO_DAYS(NOW())-1, 1, 0))*" . floatval($arConfigs['CONFIG']['TODAY_POST_COEF']) . " +\n\t\t\t\t\tSUM(IF(TO_DAYS(POST_DATE) > TO_DAYS(NOW())-7, 1, 0))*" . floatval($arConfigs['CONFIG']['WEEK_POST_COEF']) . "+\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['MONTH_POST_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_forum_message\n\t\t\t\tWHERE POST_DATE  > DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\tGROUP BY AUTHOR_ID\n\n\t\t\t\tUNION ALL\n\t\t\t\t" . $sqlAllTopic . "\n\n\t\t\t\tSELECT\n\t\t\t\t\tUSER_START_ID as ENTITY_ID,\n\t\t\t\t\tSUM(IF(TO_DAYS(START_DATE) > TO_DAYS(NOW())-1, 1, 0))*" . floatval($arConfigs['CONFIG']['TODAY_TOPIC_COEF']) . " +\n\t\t\t\t\tSUM(IF(TO_DAYS(START_DATE) > TO_DAYS(NOW())-7, 1, 0))*" . floatval($arConfigs['CONFIG']['WEEK_TOPIC_COEF']) . " +\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['MONTH_TOPIC_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_forum_topic\n\t\t\t\tWHERE START_DATE  > DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\tGROUP BY USER_START_ID\n\t\t\t) q\n\t\t\tWHERE ENTITY_ID > 0\n\t\t\tGROUP BY ENTITY_ID";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:ratings_components.php

示例6: CalcActivity

 public static function CalcActivity($arConfigs)
 {
     global $DB;
     $err_mess = CRatings::err_mess() . "<br>Function: CRatingsComponentsBlog::CalcActivity<br>Line: ";
     CRatings::AddComponentResults($arConfigs);
     $strSql = "DELETE FROM b_rating_component_results WHERE RATING_ID = '" . IntVal($arConfigs['RATING_ID']) . "' AND COMPLEX_NAME = '" . $DB->ForSql($arConfigs['COMPLEX_NAME']) . "'";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $sqlAllPost = '';
     if (isset($arConfigs['CONFIG']['ALL_POST_COEF']) && $arConfigs['CONFIG']['ALL_POST_COEF'] != 0) {
         $sqlAllPost = "\n\t\t\t\tSELECT\n\t\t\t\t\tAUTHOR_ID as ENTITY_ID,\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['ALL_POST_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_blog_post\n\t\t\t\tWHERE DATE_PUBLISH < DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\t\t\tAND PUBLISH_STATUS = '" . BLOG_PUBLISH_STATUS_PUBLISH . "'\n\t\t\t\tGROUP BY AUTHOR_ID\n\t\t\t\tUNION ALL ";
     }
     $sqlAllComment = '';
     if (isset($arConfigs['CONFIG']['ALL_COMMENT_COEF']) && $arConfigs['CONFIG']['ALL_COMMENT_COEF'] != 0) {
         $sqlAllComment = "\n\t\t\t\tSELECT\n\t\t\t\t\tAUTHOR_ID as ENTITY_ID,\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['ALL_COMMENT_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_blog_comment\n\t\t\t\tWHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\t\tAND PUBLISH_STATUS = '" . BLOG_PUBLISH_STATUS_PUBLISH . "'\n\t\t\t\tGROUP BY AUTHOR_ID\n\t\t\t\tUNION ALL ";
     }
     $strSql = "INSERT INTO b_rating_component_results (RATING_ID, MODULE_ID, RATING_TYPE, NAME, COMPLEX_NAME, ENTITY_ID, ENTITY_TYPE_ID, CURRENT_VALUE)\n\t\t\tSELECT\n\t\t\t\t'" . IntVal($arConfigs['RATING_ID']) . "' as RATING_ID,\n\t\t\t\t'" . $DB->ForSql($arConfigs['MODULE_ID']) . "' as MODULE_ID,\n\t\t\t\t'" . $DB->ForSql($arConfigs['RATING_TYPE']) . "' as RATING_TYPE,\n\t\t\t\t'" . $DB->ForSql($arConfigs['NAME']) . "' as NAME,\n\t\t\t\t'" . $DB->ForSql($arConfigs['COMPLEX_NAME']) . "' as COMPLEX_NAME,\n\t\t\t\tENTITY_ID,\n\t\t\t\t'" . $DB->ForSql($arConfigs['ENTITY_ID']) . "'  ENTITY_TYPE_ID,\n\t\t\t\tSUM(CURRENT_VALUE) CURRENT_VALUE\n\t\t\tFROM (\n\t\t\t\t" . $sqlAllPost . "\n\t\t\t\tSELECT\n\t\t\t\t\tAUTHOR_ID as ENTITY_ID,\n\t\t\t\t\tSUM(IF(TO_DAYS(DATE_PUBLISH) > TO_DAYS(NOW())-1, 1, 0))*" . floatval($arConfigs['CONFIG']['TODAY_POST_COEF']) . " +\n\t\t\t\t\tSUM(IF(TO_DAYS(DATE_PUBLISH) > TO_DAYS(NOW())-7, 1, 0))*" . floatval($arConfigs['CONFIG']['WEEK_POST_COEF']) . "+\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['MONTH_POST_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_blog_post\n\t\t\t\tWHERE DATE_PUBLISH  > DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\t\t\tAND PUBLISH_STATUS = '" . BLOG_PUBLISH_STATUS_PUBLISH . "'\n\t\t\t\tGROUP BY AUTHOR_ID\n\n\t\t\t\tUNION ALL\n\t\t\t\t" . $sqlAllComment . "\n\t\t\t\tSELECT\n\t\t\t\t\tAUTHOR_ID as ENTITY_ID,\n\t\t\t\t\tSUM(IF(TO_DAYS(DATE_CREATE) > TO_DAYS(NOW())-1, 1, 0))*" . floatval($arConfigs['CONFIG']['TODAY_COMMENT_COEF']) . " +\n\t\t\t\t\tSUM(IF(TO_DAYS(DATE_CREATE) > TO_DAYS(NOW())-7, 1, 0))*" . floatval($arConfigs['CONFIG']['WEEK_COMMENT_COEF']) . " +\n\t\t\t\t\tCOUNT(*)*" . floatval($arConfigs['CONFIG']['MONTH_COMMENT_COEF']) . " as CURRENT_VALUE\n\t\t\t\tFROM b_blog_comment\n\t\t\t\tWHERE DATE_CREATE  > DATE_SUB(NOW(), INTERVAL 30 DAY)\n\t\t\t\t\tAND PUBLISH_STATUS = '" . BLOG_PUBLISH_STATUS_PUBLISH . "'\n\t\t\t\tGROUP BY AUTHOR_ID\n\t\t\t) q\n\t\t\tWHERE ENTITY_ID > 0\n\t\t\tGROUP BY ENTITY_ID";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:19,代码来源:ratings_components.php

示例7: ratingCheckInterval

 function ratingCheckInterval($arConfigs)
 {
     global $DB;
     $err_mess = "File: " . __FILE__ . "<br>Function: ratingCheckInterval<br>Line: ";
     $ruleId = IntVal($arConfigs['ID']);
     if (isset($arConfigs['CONDITION_CONFIG']['RATING_INTERVAL'])) {
         $ratingValueFrom = IntVal($arConfigs['CONDITION_CONFIG']['RATING_INTERVAL']['RATING_VALUE_FROM']);
         $ratingValueTo = IntVal($arConfigs['CONDITION_CONFIG']['RATING_INTERVAL']['RATING_VALUE_TO']);
         $ratingId = IntVal($arConfigs['CONDITION_CONFIG']['RATING_INTERVAL']['RATING_ID']);
     } else {
         $ratingVoteWeight = COption::GetOptionString("main", "rating_vote_weight", 1);
         $ratingValueFrom = IntVal($arConfigs['CONDITION_CONFIG']['AUTHORITY_INTERVAL']['RATING_VALUE_FROM']) * $ratingVoteWeight;
         $ratingValueTo = IntVal($arConfigs['CONDITION_CONFIG']['AUTHORITY_INTERVAL']['RATING_VALUE_TO']) * $ratingVoteWeight;
         $ratingId = CRatings::GetAuthorityRating();
     }
     $strSql = "INSERT INTO b_rating_rule_vetting (RULE_ID, ENTITY_TYPE_ID, ENTITY_ID)\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t'{$ruleId}' as RULE_ID,\n\t\t\t\t\t\trr.ENTITY_TYPE_ID as ENTITY_TYPE_ID,\n\t\t\t\t\t\trr.ENTITY_ID as ENTITY_ID\n\t\t\t\t\tFROM b_rating_results rr\n\t\t\t\t\tWHERE rr.RATING_ID = {$ratingId}\n\t\t\t\t\t  AND rr.CURRENT_VALUE BETWEEN {$ratingValueFrom} AND {$ratingValueTo}";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:rating_rules.php

示例8: 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);
}
开发者ID:webgksupport,项目名称:alpina,代码行数:20,代码来源:vote.ajax.php

示例9: array

        if ($arRes['ACTIVE'] == 'N') {
            CRatings::Delete($arRes['ID']);
        } else {
            $authorityId = $arRes['ID'];
        }
    }
    if ($authorityId == false) {
        $arConfig = array();
        $arConfig['MAIN'] = array('VOTE' => array('USER' => array('ACTIVE' => 'Y', 'COEFFICIENT' => '1', 'LIMIT' => '30')), 'RATING' => array('BONUS' => array('ACTIVE' => 'Y', 'COEFFICIENT' => '1')));
        $arAddRating = array('ACTIVE' => 'Y', 'NAME' => GetMessage('MAIN_RATING_AUTHORITY'), 'ENTITY_ID' => 'USER', 'CALCULATION_METHOD' => 'SUM', 'POSITION' => 'Y', 'AUTHORITY' => 'Y', 'CONFIGS' => $arConfig);
        $authorityId = CRatings::Add($arAddRating);
    }
    $strSql = "\n\t\t\tINSERT INTO b_rating_user (ENTITY_ID, RATING_ID)\n\t\t\tSELECT \n\t\t\t\tu.ID, '{$authorityId}'\n\t\t\tFROM \n\t\t\t\tb_user u \n\t\t\t\tLEFT JOIN b_rating_user ru ON ru.RATING_ID = {$authorityId} AND ru.ENTITY_ID = u.ID \n\t\t\tWHERE \n\t\t\t\tru.ENTITY_ID IS NULL";
    $DB->Query($strSql, false, $err_mess . __LINE__);
    $arParams = array();
    $arParams['DEFAULT_CONFIG_NEW_USER'] = 'Y';
    CRatings::SetAuthorityDefaultValue($arParams);
    CRatings::Calculate($authorityId, true);
    CRatings::Calculate($ratingId, true);
    $ratingArray = 'array(1 => "' . $ratingId . '", 2 => "' . $authorityId . '")';
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/forum/index.php", array("SHOW_RATING" => 'Y'));
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/forum/index.php", array("RATING_ID" => $ratingArray));
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/people/index.php", array("RATING_ID" => $ratingId));
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/people/user.php", array("RATING_ID" => $ratingArray));
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/groups/group.php", array("RATING_ID" => $ratingId));
    COption::SetOptionString("socialnetwork", "tooltip_rating_id", serialize(array($ratingId, $authorityId)), "", WIZARD_SITE_ID);
    COption::SetOptionString("socialnetwork", "tooltip_show_rating", "Y", "", WIZARD_SITE_ID);
    COption::SetOptionString("main", "rating_normalization", 10);
    COption::SetOptionString("forum", "SHOW_VOTES", "N");
    COption::SetOptionString("main", "rating_vote_type", 'like');
}
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:rating.php

示例10: BuildRSS


//.........这里部分代码省略.........
						$arImages = Array();
						$dbImages = CBlogImage::GetList(Array(), Array("BLOG_ID" => $blogID, "POST_ID" => $postID, "IS_COMMENT" => "Y", "!COMMENT_ID" => false));
						while($arI = $dbImages->Fetch())
							$arImages[$arI["ID"]] = $arI["FILE_ID"];

						while ($arComments = $dbComments->Fetch())
						{
							$arDate = ParseDateTime($arComments["DATE_CREATE"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
							$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));

							if(strpos($url, "?") !== false)
								$url1 = $url."&amp;";
							else
								$url1 = $url."?";
							$url1 .= "commentId=".$arComments["ID"]."#".$arComments["ID"];

							$authorURL = "";
							if(IntVal($arComments["AUTHOR_ID"]) > 0)
							{
								$author = CBlogUser::GetUserName($arComments["BLOG_USER_ALIAS"], $arComments["USER_NAME"], $arComments["USER_LAST_NAME"], $arComments["USER_LOGIN"], $arComments["USER_SECOND_NAME"]);
								if(strLen($arPathTemplate["PATH_TO_USER"])>0)
									$authorURL = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arComments["AUTHOR_ID"])));
								else
									$authorURL = htmlspecialcharsbx("http://".$serverName.CBlogUser::PreparePath($arComments["AUTHOR_ID"], $arGroup["SITE_ID"]));
							}
							else
								$author = $arComments["AUTHOR_NAME"];
							$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "N");
							if($arPathTemplate["NO_URL_IN_COMMENTS"] == "L" || (IntVal($arComments["AUTHOR_ID"]) <= 0  && $arPathTemplate["NO_URL_IN_COMMENTS"] == "A"))
								$arAllow["CUT_ANCHOR"] = "Y";

							if($arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY_CHECK"] == "Y" && $arAllow["CUT_ANCHOR"] != "Y" && IntVal($arComments["AUTHOR_ID"]) > 0)
							{
								$authorityRatingId = CRatings::GetAuthorityRating();
								$arRatingResult = CRatings::GetRatingResult($authorityRatingId, $arComments["AUTHOR_ID"]);
								if($arRatingResult["CURRENT_VALUE"] < $arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY"])
									$arAllow["CUT_ANCHOR"] = "Y";
							}

							$text = $parser->convert_to_rss($arComments["POST_TEXT"], $arImages, $arAllow, false, $arParserParams);

							$title = GetMessage("BLG_GCM_COMMENT_TITLE", Array("#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"]), "#COMMENT_AUTHOR#" => htmlspecialcharsEx($author)));
							/*$title = str_replace(
								array("&", "<", ">", "\""),
								array("&amp;", "&lt;", "&gt;", "&quot;"),
								$title);
							*/
							//$text1 = HTMLToTxt($text, "", Array("\&nbsp;"), 60);
							$text = "<![CDATA[".$text."]]>";


							if ($type == "rss.92")
							{
								$rssText .= "    <item>\n";
								$rssText .= "      <title>".$title."</title>\n";
								$rssText .= "      <description>".$text."</description>\n";
								$rssText .= "      <link>".$url1."</link>\n";
								$rssText .= "    </item>\n";
								$rssText .= "\n";
							}
							elseif ($type == "rss2.0")
							{
								$rssText .= "    <item>\n";
								$rssText .= "      <title>".$title."</title>\n";
								$rssText .= "      <description>".$text."</description>\n";
								$rssText .= "      <link>".$url1."</link>\n";
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:blog_comment.php

示例11: GetMessage

                            }
                        }
                    }
                    if (IntVal($v["AUTHOR_ID"]) > 0) {
                        if ($v["AUTHOR_ID"] == $user_id || $blogModulePermissions >= "W" && $arResult["IDEA_MODERATOR"]) {
                            $arResult["Comments"][$v["ID"]]["CAN_EDIT"] = "Y";
                        }
                    } else {
                        if ($blogModulePermissions >= "W") {
                            $arResult["Comments"][$v["ID"]]["CAN_EDIT"] = "Y";
                        }
                    }
                }
            }
            if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["IDS"])) {
                $arResult['RATING'] = CRatings::GetRatingVoteResult('BLOG_COMMENT', $arResult["IDS"]);
            }
        }
        if ($USER->IsAuthorized()) {
            if (IntVal($commentUrlID) > 0 && empty($arResult["Comments"][$commentUrlID])) {
                $arComment = CBlogComment::GetByID($commentUrlID);
                if ($arComment["AUTHOR_ID"] == $user_id && $arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_READY) {
                    $arResult["MESSAGE"] = GetMessage("B_B_PC_HIDDEN_POSTED");
                }
            }
        }
        $this->IncludeComponentTemplate();
    }
}
if (!is_array($arResult["CommentsResult"][0])) {
    return 0;
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例12: 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")
{
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:component.php

示例13: floatval

$arResult['USER_VOTE'] = floatval($arParams['USER_VOTE']);
$arResult['ALLOW_VOTE'] = $arAllowVote;
$arResult['PATH_TO_USER_PROFILE'] = $arParams['PATH_TO_USER_PROFILE'];

$isLikeTemplate = in_array($sRatingTemplate, array("like", "like_graphic", "mobile_like"));
if ($isLikeTemplate)
	$arResult['TOTAL_VOTES'] = IntVal($arParams['TOTAL_POSITIVE_VOTES']);

if (!array_key_exists('TOTAL_VALUE', $arParams) ||
	!array_key_exists('TOTAL_VOTES', $arParams) ||
	!array_key_exists('TOTAL_POSITIVE_VOTES', $arParams) ||
	!array_key_exists('TOTAL_NEGATIVE_VOTES', $arParams) ||
	!array_key_exists('USER_HAS_VOTED', $arParams) ||
	!array_key_exists('USER_VOTE', $arParams))
{
	$arComponentVoteResult  = CRatings::GetRatingVoteResult($arResult['ENTITY_TYPE_ID'], $arResult['ENTITY_ID']);
	if (!empty($arComponentVoteResult))
	{
		$arResult['TOTAL_VALUE'] = $arComponentVoteResult['TOTAL_VALUE'];
		$arResult['TOTAL_VOTES'] = $arComponentVoteResult['TOTAL_VOTES'];
		$arResult['TOTAL_POSITIVE_VOTES'] = $arComponentVoteResult['TOTAL_POSITIVE_VOTES'];
		$arResult['TOTAL_NEGATIVE_VOTES'] = $arComponentVoteResult['TOTAL_NEGATIVE_VOTES'];
		$arResult['USER_VOTE'] = $arComponentVoteResult['USER_VOTE'];
		$arResult['USER_HAS_VOTED'] = $arComponentVoteResult['USER_HAS_VOTED'];

		if (in_array($sRatingTemplate, array("like", "like_graphic", "mobile_like")))
			$arResult['TOTAL_VOTES'] = $arComponentVoteResult['TOTAL_POSITIVE_VOTES'];
	}
}

$arResult['VOTE_BUTTON'] = $arResult['USER_HAS_VOTED'] == 'Y'? ($arResult['USER_VOTE'] > 0? 'PLUS': 'MINUS'): 'NONE';
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:component.php

示例14: array

    try {
        $arPermissionsParams = array('COURSE_ID' => $arParams['COURSE_ID'], 'LESSON_ID' => $arParams['CHAPTER_ID']);
        $isAccessible = CLearnAccessMacroses::CanUserViewLessonAsPublic($arPermissionsParams);
    } catch (Exception $e) {
        $isAccessible = false;
        // access denied
    }
    if (!$isAccessible) {
        ShowError(GetMessage('LEARNING_COURSE_DENIED'));
        return;
        exit;
    }
}
$ratingTransistor = '';
if ($arParams['CHAPTER_ID'] > 0) {
    $arRatingData = CRatings::GetRatingVoteResult('LEARN_LESSON', $arParams['CHAPTER_ID']);
    $ratingTransistor = serialize($arRatingData);
}
$lastDirtyCacheTS = COption::GetOptionString('learning', CLearnCacheOfLessonTreeComponent::OPTION_TS, time());
// was: if($this->StartResultCache(false, $USER->GetGroups()))
$additionalCacheID = CLearnAccess::GetAccessSymbolsHashForSiteUser() . '|' . $ratingTransistor . '|' . $lastDirtyCacheTS;
if ($this->StartResultCache(false, $additionalCacheID)) {
    //Module
    if (!CModule::IncludeModule("learning")) {
        $this->AbortResultCache();
        ShowError(GetMessage("LEARNING_MODULE_NOT_FOUND"));
        return;
    }
    //Course
    $rsCourse = CCourse::GetList(array(), array("ID" => $arParams["COURSE_ID"], "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "SITE_ID" => LANG, "CHECK_PERMISSIONS" => 'N'));
    if (!($arCourse = $rsCourse->GetNext())) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例15: array

}
if (!isset($arParams["CACHE_TIME"])) {
    $arParams["CACHE_TIME"] = 36000000;
}
//SELECT
$arSelect = array("ID", "NAME", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_TEXT_TYPE", "PREVIEW_TEXT", "DETAIL_TEXT_TYPE", "DETAIL_TEXT", "CREATED_BY");
//WHERE
$arFilter = array('IBLOCK_ID' => $arParams["IBLOCK_ID"], 'ACTIVE' => 'Y', 'IBLOCK_ACTIVE' => 'Y', 'SECTION_ID' => $arParams["SECTION_ID"], 'ID' => $arParams["ELEMENT_ID"]);
//ORDER BY
$arOrder = array('SORT' => 'ASC', 'ID' => 'DESC');
$arAddCacheParams = array("MODE" => $_REQUEST['bitrix_show_mode'] ? $_REQUEST['bitrix_show_mode'] : 'view', "SESS_MODE" => $_SESSION['SESS_PUBLIC_SHOW_MODE'] ? $_SESSION['SESS_PUBLIC_SHOW_MODE'] : 'view');
//**work body**//
if ($this->StartResultCache(false, array($arParams["CACHE_GROUPS"] === "N" ? false : $USER->GetGroups(), $arFilter, $arAddCacheParams))) {
    $arItem = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect);
    if ($arResItem = $arItem->Fetch()) {
        $arResult['ITEM'] = $arResItem;
    }
    if (!isset($arResult['ITEM'])) {
        $this->AbortResultCache();
        @define("ERROR_404", "Y");
        return;
    }
    $this->EndResultCache();
}
// activation rating
CRatingsComponentsMain::GetShowRating($arParams);
if ($arParams['SHOW_RATING'] == 'Y' && $arResult['ITEM'] > 0) {
    $arResult['RATING'] = CRatings::GetRatingVoteResult('IBLOCK_ELEMENT', $arResult['ITEM']);
}
//include template
$this->IncludeComponentTemplate();
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php


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