Documentation

GetList

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

Returns list of blogs by the arFilter, sorted in the arOrder. Non-static method.

Method parameters

ParameterDescription
arOrder Array for sorting of result. Array of the array("sorting field"=>"sorting direction"[, ...]) type Sorting field can have the following values:
  • ID - blog ID;
  • NAME - Blog name;
  • DATE_CREATE - date when blog is created;
  • DATE_UPDATE - date when blog is modified;
  • ACTIVE - blog activity status;
  • OWNER_ID - blog owner ID;
  • URL - blog address;
  • GROUP_ID - blog group ID;
  • GROUP_NAME - blog group name;
  • GROUP_SITE_ID - blog group site ID;
  • LAST_POST_ID - Last blog post ID;
  • LAST_POST_DATE - Last blog post date;
  • OWNER_LOGIN - blog owner's login;
  • OWNER_NAME - blog owner's name;
  • OWNER_LAST_NAME - blog owner last name;
  • OWNER_EMAIL - blog owner email;
  • BLOG_USER_ALIAS - blog owner alias;
Optional. By default, filtering is performed by descension of the blog ID.
arFilter Array of the array("filtered field"=>"filter value" [, ...]) type. Filtered field can have the following values:
  • ID - blog ID;
  • NAME - blog name;
  • DATE_CREATE - date when blog was created;
  • DATE_UPDATE - date when blog was modified;
  • ACTIVE - blog activity status;
  • OWNER_ID - blog oner ID;
  • URL - blog address;
  • GROUP_ID - blog group ID;
  • GROUP_NAME - blog group ID;
  • GROUP_SITE_ID - blog group site ID;
  • ENABLE_COMMENTS - specifies whether comments are enabled for the blog;
  • ENABLE_IMG_VERIF - specifies whether CAPTCHA is enabled for comments in the blog;
  • EMAIL_NOTIFY - specifies whether notification via Email is enabled for the blog;
  • ENABLE_RSS - specifies whether export to the blog RSS is enabled;
  • LAST_POST_ID - last blog post ID;
  • LAST_POST_DATE - date of the last blog post;
  • OWNER_LOGIN - blog owner login;
  • OWNER_NAME - blog owner name;
  • OWNER_LAST_NAME - blog owner last name;
  • OWNER_EMAIL - blog owner email;
  • BLOG_USER_ALIAS - blog owner alias;
Type of filtration can be specified in front of the filtered field name:
  • "!" - not equal
  • "<" - less
  • "<=" - less or equal
  • ">" - more
  • ">=" - more or equal

"filter value" - single value or an array.

Optional. By default, records are not filtered.
arGroupBy Array of fileds, per which the records are grouped. Array is as follows:
array("field_name1",
      "aggregate_function2" => "field_name2", ...)
Any field can be specified as "field_nameN". The following can be specified as the aggregate function:
  • COUNT - quantity 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 sample 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.

See Also

Examples of use

<?
// select all active blogs, attached to the current site.
// result will be sorted first by the creation date, then - by the blog name
// only the fields, needed for us will be returned: blog identifier, blog name, blog address,
// Blog owner ID and Blog creation date
$SORT = Array("DATE_CREATE" => "DESC", "NAME" => "ASC");
$arFilter = Array(
        "ACTIVE" => "Y",
        "GROUP_SITE_ID" => SITE_ID
    );	
$arSelectedFields = array("ID", "NAME", "DESCRIPTION", "URL", "OWNER_ID", "DATE_CREATE");

$dbBlogs = CBlog::GetList(
        $SORT,
        $arFilter,
        false,
        false,
        $arSelectedFields
    );

while ($arBlog = $dbBlogs->Fetch())
{
    print_r($arBlog);
}
?>


© «Bitrix24», 2001-2024
Up