• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/ratings.php
  • Класс: CAllRatings
  • Вызов: CAllRatings::SetWeight
static function SetWeight($arConfigs)
{
	global $DB;
	$err_mess = (CRatings::err_mess())."
Function: SetWeight
Line: "; usort($arConfigs, array('CRatings', '__SortWeight')); // prepare insert $arAdd = array(); foreach($arConfigs as $key => $arConfig) { //If the first condition is restricted to the bottom, otherwise we take the previous high value if ($key == 0) $arConfig['RATING_FROM'] = -1000000; else $arConfig['RATING_FROM'] = (float)$arConfigs[$key - 1]['RATING_TO'] +0.0001; // If this last condition is restricted to the top if (!array_key_exists('RATING_TO', $arConfig)) $arConfig['RATING_TO'] = 1000000; elseif ($arConfig['RATING_TO'] > 1000000) $arConfig['RATING_TO'] = 1000000; $arAdd[$key]['RATING_FROM'] = (float)$arConfig['RATING_FROM']; $arAdd[$key]['RATING_TO'] = (float)$arConfig['RATING_TO']; $arAdd[$key]['WEIGHT'] = (float)$arConfig['WEIGHT']; $arAdd[$key]['COUNT'] = (int)$arConfig['COUNT']; $arConfigs[$key] = $arAdd[$key]; } // insert $DB->Query("DELETE FROM b_rating_weight", false, $err_mess.__LINE__); foreach($arAdd as $key => $arFields) $DB->Insert("b_rating_weight", $arFields, $err_mess.__LINE__); return true; }