Documentation

CForumPoints::GetListEx

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

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

Parameters

Parameter Description
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:
  • LID - the language ID (required);
  • 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.
LID The language ID.
NAME Name of the rating in LID.

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("LID"=>"ru", ">=MIN_POINTS"=>50);

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