Documentation

GetGroupList

Description and parameters

CDBResult
CPosting::GetGroupList(
 int ID
);

Method returns a selected of user groups to receive a post. Static method.

Parameters

ParameterDescriptionAvailable from version
ID Post ID.

Return value

Returns query result of CDBResult. "Group": ID, NAME. object fields become available upon retrieval from the result by the methods of class CDBResult.

Example

<?
//show user groups and check selected for the issue
$aPostGrp = array();
if($ID>0)
{
    $post_grp = CPosting::GetGroupList($ID);
    while($post_grp_arr = $post_grp->Fetch())
        $aPostGrp[] = $post_grp_arr["ID"];
}
$group = CGroup::GetList(($by="name"), ($order="asc"));
while($group->ExtractFields("g_")):
?>
<input type="checkbox" name="GROUP_ID[]" value="<?echo $g_ID?>"<?if(in_array($g_ID, $aPostGrp)) echo " checked"?>>
<?echo $g_NAME?><br>
<?
endwhile;
?>


© «Bitrix24», 2001-2024