Documentation

CForumPoints::GetList

CDBResult
CForumPoints::GetList(
 array arOrder = array("MIN_POINTS"=>"ASC"), 
 array arFilter = array()
);

The method GetList returns an optionally sorted and filtered list of forum ratings.

Parameters

ParameterDescription
arOrder An array in the format Array(by1=>order1[, by2=>order2 [, ..]]), where:
  • by - name of the field by which the sorting is to be performed:
    • ID - the rating ID;
    • CODE - mnemonic code;
    • VOTES - number of votes a user can give;
    • MIN_NUM_POSTS - minimum number of messages for this rating;
  • order - sort order:
    • ASC - ascending;
    • DESC - descending.
arFilter An array in the format Array("filter field"=>"condition" [, ...]).

"Filter field" can be the following:
  • ID - the rating ID;
  • CODE - mnemonic code;
  • MIN_NUM_POSTS - minimum number of messages for this rating.

Return Values

Returns an instance of the CDBResult class containing arrays with the following keys.

Key Value
ID The rating ID
MIN_POINTS Number of points required to obtain this rating.
CODE Mnemonic code.
VOTES Number of votes that a user with this rating can give.

Example



// Sort by the number of votes in asc. order
// if equal, sort by ID
$arOrder = array("VOTES"=>"DESC", "ID"=>"ASC");

// Filter to select ratings with a minimum of 50 points
$arFilter = array(">=MIN_POINTS"=>50);

$db_res = CForumPoints::GetList($arOrder, $arFilter);
while ($ar_res = $db_res->Fetch())
{
   echo $ar_res["ID"]."-".$ar_res["VOTES"]."<br>";
}
© «Bitrix24», 2001-2024
Up