CDBResult
CUser::GetList(
string &by = "timestamp_x",
string &order = "desc",
array filter
)
The method GetList returns a list of users as the
CDBResult class instance.
Parameters
Parameter | Description |
by |
Reference to the variable with the name of the sorting field. Can have the following values:
- id - user ID ;
- active - the user is active;
- last_login - last authorization date;
- login - login name;
- email - e-mail address;
- name - first name;
- last_name - last name;
- timestamp_x - modification date;
- date_register - registration date;
- personal_profession - position;
- personal_www - web page;
- personal_icq - ICQ number;
- personal_gender - sex ("M" - male; "F" - female);
- personal_birthday - date of birth;
- personal_photo - ID of the photo image;
- personal_phone - phone number;
- personal_fax - fax number;
- personal_mobile - mobile number;
- personal_pager - pager number;
- personal_street - street;
- personal_mailbox - mailbox;
- personal_city - city;
- personal_state - state or region;
- personal_zip - zip code;
- personal_country - country code;
- personal_notes - additional comments ;
- work_company - company name;
- work_department - department;
- work_position - position/job;
- work_www - company web site;
- work_phone - work phone;
- work_fax - work fax;
- work_pager - pager number;
- work_street - company street;
- work_mailbox - company mailbox;
- work_city - company city;
- work_state - company state or region;
- work_zip - company zip code;
- work_country - company country code;
- work_profile - company profile;
- work_notes - additional company comments;
- admin_notes - administrator comments.
|
order |
Reference to the variable containing the sort order; can have the following values:
- asc - ascending;
- desc - descending.
|
filter |
An array used by the method to filter users. The following entry names are possible:
- 1ID - by user ID;
- TIMESTAMP_1 - lower bound of the modification date range ("from");
- TIMESTAMP_2 - upper bound of the modification date range ("till");
- LAST_LOGIN_1 - lower bound of the last login date range ("from");
- LAST_LOGIN_2 - upper bound of the last login date range ("till");
- ACTIVE - active state flag (Y|N);
- 1LOGIN_EQUAL - login (strict match);
- 1LOGIN - login (loose match - substring);
- 1NAME - first and last names;
- 1EMAIL - e-mail address;
- 1COUNTRY_ID - country ID;
- GROUPS_ID - by groups (array of user group ID's);
- PERSONAL_BIRTHDAY_1 - lower bound of the birth date range ("from");
- PERSONAL_BIRTHDAY_1 - upper bound of the birth date range ("till");
- 1KEYWORDS - by the following fields (marked with *);
- 1* PERSONAL_PROFESSION - position;
- 1* PERSONAL_WWW - web site;
- 1* PERSONAL_ICQ - ICQ number;
- 1* PERSONAL_GENDER - sex ("M" - male; "F" - female);
- 1* PERSONAL_PHOTO - ID of the photo image (table b_file);
- 1* PERSONAL_PHONE - phone number;
- 1* PERSONAL_FAX - fax number;
- 1* PERSONAL_MOBILE - mobile number;
- 1* PERSONAL_PAGER - pager;
- 1* PERSONAL_STREET - street;
- 1* PERSONAL_MAILBOX - mailbox;
- 1* PERSONAL_CITY - city;
- 1* PERSONAL_STATE - state or region;
- 1* PERSONAL_ZIP - zip code;
- 1* PERSONAL_COUNTRY - country code (stored in files \bitrix\modules\main\lang/en\tools.php, \bitrix\modules\main\lang\en\tools.php);
- 1* PERSONAL_NOTES - additional notes;
- 1* WORK_COMPANY - company name;
- 1* WORK_DEPARTMENT - department;
- 1* WORK_POSITION - position;
- 1* WORK_WWW - company web site;
- 1* WORK_PHONE - work phone;
- 1* WORK_FAX - work fax;
- 1* WORK_PAGER - work pager;
- 1* WORK_STREET - company street;
- 1* WORK_MAILBOX - company mailbox;
- 1* WORK_CITY - company city;
- 1* WORK_STATE - company state or region;
- 1* WORK_ZIP - company zip code;
- 1* WORK_COUNTRY - company country code (stored in files \bitrix\modules\main\lang/en\tools.php, \bitrix\modules\main\lang\en\tools.php);
- 1* WORK_PROFILE - company profile;
- 1* WORK_NOTES - additional comments on company;
- 1* ADMIN_NOTES - administrator comments (available for viewing and editing for the site administrator only).
1 - allows complex logic * - search by "KEYWORDS" is in fact search by fields marked with "*".
|
See Also
Example
<?
$filter = Array
(
"ID" => "1 | 2",
// in the format of the current site
"TIMESTAMP_1" => "04.02.2004",
"TIMESTAMP_2" => "04.02.2005",
"LAST_LOGIN_1" => "01.02.2004",
"ACTIVE" => "Y",
"LOGIN" => "nessy | admin",
"NAME => "John & Smith",
"EMAIL" => "nessy@bitrix.com | admin@bitrix.com",
"KEYWORDS" => "www.bitrix.com",
"PERSONAL_PROFESSION" => "system engineer",
"PERSONAL_GENDER" => "M",
"PERSONAL_COUNTRY" => "4 | 1", // Belorussia or Russia
"ADMIN_NOTES" => "\"UID = 145\"",
"GROUPS_ID" => Array(1,4,10)
);
$rsUsers = CUser::GetList(($by="personal_country"),
($order="desc"),
$filter); // select users
$is_filtered = $rsUsers->is_filtered; // selection filtered ?
$rsUsers->NavStart(50); // paginate by 50 records
// display paginated output
echo $rsUsers->NavPrint(GetMessage("PAGES"));
while($rsUsers->NavNext(true, "f_")) :
echo "[".$f_ID."] (".$f_LOGIN.") ".$f_NAME." ".$f_LAST_NAME."<br>";
endwhile;
?>