Add
int CRatings::Add( array fields, );
The method adds a new rating. Non-static method.
Method parameters
Parameter | Description |
---|---|
fields | Array of parameter values. The following values are available as the keys for this array:
|
See Also
Examples of use
<? // create rating with criteria from the blog and forum modules // consider only the rating votes, without the active status $arConfig = array(); $arConfig['FORUM'] = array( 'VOTE' => array( 'TOPIC' => array( 'ACTIVE' => 'Y', 'COEFFICIENT' => '1', ), 'POST' => array( 'ACTIVE' => 'Y', 'COEFFICIENT' => '1', ), ), 'RATING' => array( 'ACTIVITY' => array( 'ACTIVE' => 'N', 'TODAY_TOPIC_COEF' => '20', 'WEEK_TOPIC_COEF' => '10', 'MONTH_TOPIC_COEF' => '5', 'TODAY_POST_COEF' => '0.4', 'WEEK_POST_COEF' => '0.2', 'MONTH_POST_COEF' => '0.1', ), ), ); $arConfig['BLOG'] = array( 'VOTE' => array( 'POST' => array( 'ACTIVE' => 'Y', 'COEFFICIENT' => '1', ), 'COMMENT' => array( 'ACTIVE' => 'Y', 'COEFFICIENT' => '1', ), ), 'RATING' => array( 'ACTIVITY' => array( 'ACTIVE' => 'N', 'TODAY_POST_COEF' => '20', 'WEEK_POST_COEF' => '10', 'MONTH_POST_COEF' => '5', 'TODAY_COMMENT_COEF' => '0.4', 'WEEK_COMMENT_COEF' => '0.2', 'MONTH_COMMENT_COEF' => '0.1', ), ), ); $arAddRating = array( 'ACTIVE' => 'Y', 'NAME' => 'Rating created via the API', 'ENTITY_ID' => 'USER', 'CALCULATION_METHOD' => 'SUM', 'CONFIGS' => $arConfig ); $ratingId = CRatings::Add($arAddRating); if (intval($ratingId) > 0) echo "Rating is added successfully."; ?>
© «Bitrix24», 2001-2024