當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRatings::SetAuthorityDefaultValue方法代碼示例

本文整理匯總了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');
}
開發者ID:webgksupport,項目名稱:alpina,代碼行數:31,代碼來源:rating.php


注:本文中的CRatings::SetAuthorityDefaultValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。