本文整理汇总了PHP中CRatings::SetAuthorityDefaultValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CRatings::SetAuthorityDefaultValue方法的具体用法?PHP CRatings::SetAuthorityDefaultValue怎么用?PHP CRatings::SetAuthorityDefaultValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRatings
的用法示例。
在下文中一共展示了CRatings::SetAuthorityDefaultValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}