Documentation

GetList

Description and parameters

CDBResult
CRubric::GetList(
    array aSort = Array(),
    array aFilter = Array()
);

Method returns list of newsletters by filter. Static method.

Parameters

ParameterDescriptionAvailable from version
aSort Array, containing sorting attribute as set of values "field name"=>"direction".

Field name can received the following value:
  • NAME - newsletter name;
  • LID - site ID;
  • ACT - newsletter active status;
  • SORT - sorting in list;
  • ID - newsletter ID;
  • AUTO - generating flag;
  • VISIBLE - newsletter public status;
  • LAST_EXECUTED - last generated flag.
Sorting direction can have the following value:
  • ASC - by ascension;
  • DESC - by descension.
Example:
array("LID"=>"ASC", "NAME"=>"DESC")
aFilter Array, containing filter as as set of values "field name"=>"filter value".

Field name can have the following value:
  • LID - site ID;
  • ACTIVE - newsletter active status;
  • AUTO - generating flag;
  • VISIBLE - newsletter public status;
  • ID - newsletter ID.
  • NAME - newsletter name.
Example:
array("LID"=>SITE_ID, "ACTIVE"=>"Y")

Returned values

Returns a CDBResult result. "Newsletter" field objects become available when retrieving via CDBResult class methods from the result.

Example

<?
//get site's newsletter categories
$rub = CRubric::GetList(array("SORT"=>"ASC", "NAME"=>"ASC"), array("ACTIVE"=>"Y", "LID"=>LANG));
while($rub->ExtractFields("r_")):
?>
    <input type="checkbox" name="sf_RUB_ID[]" value="<?echo $r_ID?>"><?echo $r_NAME?><br>
<?
endwhile;
?>
<?
// You can show categories via the following method
$arOrder = Array("SORT"=>"ASC", "NAME"=>"ASC"); 
$arFilter = Array("ACTIVE"=>"Y", "LID"=>LANG); 
$rsRubric = CRubric::GetList($arOrder, $arFilter); 
$arRubrics = array(); 
while($arRubric = $rsRubric->GetNext()) 
{ 
 $arResult["RUBRIC_LIST"][] = $arRubric; 
} 
?>

© «Bitrix24», 2001-2024
Up