Documentation

GetList

Description and parameters

CDBResult
CPosting::GetList(
$aSort = Array(),
$arFilter = Array(),
$arSelect = Array(),
$arNavStartParams = false
);

Method returns list of posts by filters. Non-static method.

Parameters

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

Field name can have the following value:
  • ID - post ID;
  • TIMESTAMP - date of edit;
  • SUBJECT - text subject;
  • BODY_TYPE - text type;
  • STATUS - post status;
  • DATE_SENT - post sent date;
  • AUTO_SEND_TIME - time when post will be sent automatically;
Sorting direction can have the following value:
  • ASC - by ascension;
  • DESC - by descension .
Example:
array("STATUS"=>"ASC",
            
"DATE_SENT"=>"DESC")
arFilter Array, containing filter as a set of "field name"=>"filter value".

Field name can have the following value:
  • ID - post ID (complex conditions are available);
  • TIMESTAMP_1 - date of edit (period start);
  • TIMESTAMP_2 - date of edit (period end);
  • DATE_SENT_1 - date of dispatch (period start);
  • DATE_SENT_2 - date of dispatch (period end);
  • AUTO_SEND_TIME_1 - date and time of automatic dispatch (period start);
  • AUTO_SEND_TIME_2 - date or time of automatic dispatch (period end);
  • STATUS - status for string dispatch (complex conditions are available);
  • STATUS_ID - character status for post (complex conditions are available);
  • SUBJECT - message subject (complex conditions are available);
  • FROM - "from" message field (complex conditions are available);
  • TO - to attribute (complex conditions are available);
  • BODY_TYPE - message text type ;
  • BODY - message text (complex conditions are available);
  • RUB_ID - array with email campaign IDs, associated with the post;
  • MSG_CHARSET - post encoding (precise match).
Example:
array("SUBJECT"=>"test | test",
            
"TO"=>"@bitrixsoft.com")
arSelectArray, containing the list of [link=17038943]CPostingGeneral fields[/link].
arNavStartParamsOptional. By default, false - do not limit the printed elements. Passes array with keys to limit printed elements:
  • nTopCount - limit top count;
  • bShowAll - allow to print all element with page-by-page navigation;
  • iNumPage - number of page with page-by-page navigation;
  • nPageSize - number of elements at the page with page-by-page navigation.

Passing an empty array to the parameter arNavStartParams, sets the value to 10 of displayed/printed elements.

Returned values

Returns the result of CDBResult type. Upon retrieval from the result by the methods of CDBResult class - now [link=17038943]"Post" object fields[/link] become available, with exception of 'text' fields.

When filter fields contain an error, the class variable LAST_ERROR contains an error message.

Examples

$cPosting = new CPosting;
$arFilter = Array(
"ID" => $find_id,
"TIMESTAMP_1" => $find_timestamp_1,
"TIMESTAMP_2" => $find_timestamp_2,
"DATE_SENT_1" => $find_date_sent_1,
"DATE_SENT_2" => $find_date_sent_2,
"STATUS" => $find_status,
"STATUS_ID" => $find_status_id,
"SUBJECT" => $find_subject,
"FROM" => $find_from,
"TO" => $find_to,
"BODY" => $find_body,
"BODY_TYPE" => $find_body_type
);
$rsPosting = $cPosting->GetList(array($by=>$order), $arFilter);
$strError .= $cPosting->LAST_ERROR;

$rsPosting->NavStart(50);
echo $rsPosting->NavPrint("Issues");
while($rsPosting->NavNext(true, "f_"))
{
//...
}

© «Bitrix24», 2001-2024