GetList
CDBResult CUserFieldEnum::GetList( array aSort = array(),
array aFilter = array()
)
The method returns list values of user field as an CDBResult object class. Sorting by SORT field is default for aSort parameter. Additional sorting is by ascending ID. Non-static method.
Parameters
Parameter | Description |
---|---|
aSort | Array for value sorting. The following keys are available in the array:
|
aFilter | Array for value filtration. The following keys are available in the array:
|
See Also
Examples
<?
//User property is defined for users
// list type with ID of UF_GENDER. Print the value for
// the current user.
//First, get user field value:
global $USER;
if(is_object($USER))
{
$rsUser = CUser::GetList($by, $order,
array(
"ID" => $USER->GetID(),
),
array(
"SELECT" => array(
"UF_GENDER",
),
)
);
if($arUser = $rsUser->Fetch())
{
$rsGender = CUserFieldEnum::GetList(array(), array(
"ID" => $arUser["UF_GENDER"],
));
if($arGender = $rsGender->GetNext())
echo $arGender["VALUE"];
}
}
?>
Example of getting the list by user field ID:
$obEnum = new \CUserFieldEnum; $rsEnum = $obEnum->GetList(array(), array("USER_FIELD_ID" => $arUserField["ID"])); $enum = array(); while($arEnum = $rsEnum->Fetch()) { $enum[$arEnum["ID"]] = $arEnum["VALUE"]; }
© «Bitrix24», 2001-2024