Documentation

GetList

CDBResult
CBlogImage::GetList(
 array arOrder = Array("ID"=>"DESC"),
 array arFilter = Array(),
 bool  arGroupBy = false,
 bool  arNavStartParams = false,
 array arSelectFields = Array()
);

Returns list of images by the arFilter, sorted in the arOrder. Static method.

Method parameters

ParameterDescription
arOrder The array for sorting of result. Array of the array("sorting field"=>"sorting direction" [, ...]) type Field for sorting can have the following values:
  • ID - image ID;
  • FILE_ID - file ID;
  • BLOG_ID - blog ID;
  • POST_ID - blog post ID;
  • USER_ID - user ID;
  • TIMESTAMP_X - time when blog post was created;
  • TITLE - image title;
  • IMAGE_SIZE - image size in bytes;
  • IS_COMMENT - flag that specifies whether image is attached to the comment;
  • COMMENT_ID - ID of the comment to which the image is attached.
Optional parameter. By default, it is filtered by descending image ID.
arFilter Array of the array("filtered field"=>"filter value" [, ...]) type. Filtered field can have the following values:
  • ID - image ID;
  • FILE_ID - file ID;
  • BLOG_ID - blog ID;
  • POST_ID - blog post ID;
  • USER_ID - user ID;
  • TIMESTAMP_X - time when blog post is created;
  • TITLE - image title;
  • IMAGE_SIZE - image size in bytes;
  • IS_COMMENT - flag that specifies whether image is attached to the comment or not;
  • COMMENT_ID - ID of the comment to which the image is attached.
Type of filtration can be specified in front of the filtered field:
  • "!" - not equal
  • "<" - less
  • "<=" - less or equal
  • ">" - more
  • ">=" - more or equal

"filter value" - single value or the array.

Optional parameter. By default, records are not filtered.
arGroupBy Array of fields, by which the records are grouped. The array has the following structure:
array("field_name1",
       "aggregate_function2" => "field_name2", ...)
Any field can be specified as "field_nameN". The following can be specified as aggregate function:
  • COUNT - number count;
  • AVG - average value calculation;
  • MIN - minimal value calculation;
  • MAX - maximum value calculation;
  • SUM - sum calculation.
If the array is empty, the array will return the number of records, satisfying the filter.

Optional. By default - false - means that the result will not be grouped.
arNavStartParams Array of selection parameters. Can contain the following keys:
  • "nTopCount" - number of records returned by the method will be limited from above by the value of this key
  • any key, accepted by the CDBResult::NavQuery method as the third parameter.
Optional. By default - false - means that there are no sample parameters.
arSelectFields Array of records, which will be returned by the method. Only those fields that are needed can be specified. If there is a "*" value in the array - all available fields will be returned.

Optional. By default - empty array() - means that all fields of the request's main table will be returned.

Returned value

CDBResult object is returned.

Examples of use

For images, attached to the blog post with identifier 2, retrieving image ID and file ID:

$res = CBlogImage::GetList(
	$arOrder = Array("POST_ID" => "DESC"), 
	$arFilter = Array("POST_ID" => "2", "IS_COMMENT" => "Y"), 
	$arGroupBy = false, 
	$arNavStartParams = false, 
	$arSelectFields = array("ID", "FILE_ID",)
);

while($image = $res->Fetch())
	print_r($image);


© «Bitrix24», 2001-2024
Up