Bitrix Site Manager

CFormStatus::GetList

CDBResult
CFormStatus::GetList(
 int form_id,
 string &by = "s_sort",
 string &order = "asc",
 array filter = array(),
 bool &is_filtered
)

The method GetList returns a list of statuses as a CDBResult instance.

Parameters

form_id The web form ID.
by Reference to the variable containing the field used to sort the result list. The following values are possible:
  • s_id - the status ID;
  • s_sort - sort index;
  • s_timestamp - the time the status was last modified;
  • s_active - active state flag;
  • s_default - flag indicating the status is default;
  • s_title - title;
  • s_description - description;
  • s_results - number of results in this status.
order Reference to the variable containing the sort order. The following values are possible:
  • asc - ascending;
  • desc - descending.
filter An array used to filter values. The following keys are possible:
  • ID* - the status ID (by default the method accepts only the exact matches);
  • ID_EXACT_MATCH - if "N", the method performs loose searches (entry is sufficient) when filtering by ID;
  • ACTIVE - active state flag. The following values are possible:
  • TITLE* - status title (the method performs loose searches by default);
  • TITLE_EXACT_MATCH - set to "Y" for exact match searches when filtering by TITLE;
  • DESCRIPTION* - status description (the method performs loose searches by default);
  • DESCRIPTION_EXACT_MATCH - set to "Y" for exact match searches when filtering by DESCRIPTION.
* - complex logic allowed
is_filtered Reference to the variable containing true if the returned list is filtered, or false if the returned list is not filtered.

See Also

Example



<?
$FORM_ID = 4; // The web form ID

// build the filter array
$arFilter = Array(
    "ID"                       => "1 | 4",           // status ID=1 or ID=4
    "ID_EXACT_MATCH"           => "Y",               // we need the ID to match exactly
    "ACTIVE"                   => "Y",               // active state flag
    "TITLE"                    => "published",       // title
    "TITLE_EXACT_MATCH"        => "N",               // we need the TITLE to match exactly
    "DESCRIPTION"              => "final status",    // description
    "DESCRIPTION_EXACT_MATCH"  => "N",               // we need the DESCRIPTION to match exactly
);

// obtain the list of all answers to the question #143
$rsStatuses = CFormStatus::GetList(
    $FORM_ID, 
    $by="s_id", 
    $order="desc", 
    $arFilter, 
    $is_filtered
    );
while ($arStatus = $rsStatuses->Fetch())
{
    echo "<pre>"; print_r($arStatus); echo "</pre>";
}
?>