Bitrix Site Manager

CGroup::GetList

CDBResult
CGroup::GetList(
 string &by = "c_sort",
 string &order = "asc",
 array filter,
 string get_users_amount = "N"
)

The method GetList returns a list of groups as an instance of CDBResult class.

Parameters

ParameterDescription
by Reference to the variable containing the sorting field. The following values are possilble:
  • id - group ID;
  • timestamp_x - date of modification;
  • name - name;
  • active - active state;
  • c_sort - sort order;
  • description - description;
  • users - number of users in a group.
Órder Reference to the variable containing the sort order. The following values are possible:
  • asc - ascending;
  • desc - descending.
filter An array used to filter users. The following keys are possible:
  • ID - group ID (complex logic allowed);
  • TIMESTAMP_1 - lower bound of the settings modification date range ("from");
  • TIMESTAMP_2 - upper bound of the settings modification date range ("till");
  • ACTIVE - filter by active state (Y|N);
  • ADMIN - filter by group type ("Y" - administrators| "N" - not administrators);
  • NAME - by name (complex logic allowed);
  • DESCRIPTION - by description (complex logic allowed);
  • USERS_1 - lower bound of the number of users ("from");
  • USERS_2 - upper bound of the number of users ("to").
get_users_amount If set to "Y", the selection will include the field "USERS" containing the number of users in the group; if set to "N", the selection will not include such field (default behaviour).

See Also

Example



<?
$filter = Array
(
    "ID"             => "1 | 2",
    "TIMESTAMP_1"    => "04.02.2004", // in the format of the current site
    "TIMESTAMP_2"    => "04.02.2005",
    "ACTIVE"         => "Y",
    "NAME                 => "Techsupport",
    "DESCRITION"     => "special | support",
    "USERS_1"        => "2", // from 2 users 
    "USERS_2"        => "10" // to 10 users 
);
$rsGroups = CGroup::GetList(($by="c_sort"), ($order="desc"), $filter); // select groups
$is_filtered = $rsGroups->is_filtered; // whether the selection is filtered
$rsGroups->NavStart(50); // paginate by 50 records
echo $rsGroups->NavPrint(GetMessage("PAGES")); // display per page navigation
while($rsGroups->NavNext(true, "f_")) :
	echo "[".$f_ID."] ".$f_NAME." ".$f_DESCRIPTION."<br>";	
endwhile;
?>