Documentation

GetList

Description and parameters

CDBResult
CSubscription::GetList(
    array aSort = Array(),
    array arFilter = Array(),
   array arNavStartParams = false
);

Method selects list of subscriptions (subscribers) by filter. Static method.

In case aFilter parameter is not specified, the sorting will be performed by descending ID field.

Parameters

ParameterDescription Available from version
aSort Array, containing sorting attribute as sets "field name"=>"direction".

Field name can have the following value:
  • ID - subscription ID;
  • DATE_INSERT - date when added;
  • DATE_UPDATE - date when updated;
  • DATE_CONFIRM - confirmation date;
  • ACT - active flag;
  • CONF - confirmation flag;
  • EMAIL - subscription address;
  • FMT - subscription format;
  • USER - user identifier.
  • CONFIRM_CODE - subscription confirmation code.
  • Sorting direction can have the following value:
  • ASC - by ascension;
  • DESC - by descension.
For example: array("EMAIL"=>"ASC", "ACT"=>"DESC")
arFilter Array, containing filter as set of "field name"=>"filter value".

Field name can have the following value:
  • 1ID - subscription ID;
  • 1EMAIL - address;
  • UPDATE_1 - date when modified (period start);
  • UPDATE_2 - date when modified (period end);
  • INSERT_1 - date when added (начало периода);
  • INSERT_2 - date when added (конец периода);
  • 2USER - user;
  • 1USER_ID - user identifier;
  • ANONYMOUS - flag sets subscription as anonymous;
  • CONFIRMED - flag confirms subscription;
  • ACTIVE - flag for active subscription;
  • FORMAT - subscription format;
  • RUBRIC - subscription rubrics/categories as an array with IDs or a string , generated by filter logic rules.
Example: array("CONFIRMED"=>"Y", "ACTIVE"=>"Y")
1 - complex conditions allowed
2 - complex conditions allowed by user ID, LOGIN, NAME, LAST_NAME
arNavStartParamsParameters for page navigation and limiting of printed items. Array type - "Parameter name"=>"Value", where parameter name

"bShowAll" - allow showing all items at page navigation
"iNumPage" - page number at page navigation
"nPageSize" - number items on a page at page navigation

Optional. False by default - do not limit selection.

Returned values

Returns CDBResult query result. [link=91205]"Subscription" object fields[/link] become available upon fetching from result by CDBResult methods.

Example

//which rubrics to send
$aPostRub = array();
$post_rub = CPosting::GetRubricList($post_arr["ID"]);
while($post_rub_arr = $post_rub->Fetch())
$aPostRub[] = $post_rub_arr["ID"];

//active and confirmed addresses, subscribed to rubrics
$subscr = CSubscription::GetList(
array("ID"=>"ASC"),
array("RUBRIC"=>$aPostRub, "CONFIRMED"=>"Y", "ACTIVE"=>"Y",
"FORMAT"=>$post_arr["SUBSCR_FORMAT"], "EMAIL"=>$post_arr["EMAIL_FILTER"])
);
while(($subscr_arr = $subscr->Fetch()))
$aEmail[] = $subscr_arr["EMAIL"];


© «Bitrix24», 2001-2024