Bitrix Site Manager

CForumNew::GetListEx

CDBResult
GetListEx(
 [array arOrder [,
 array arFilter]]
);

The method GetListEx returns an optionally filtered and sorted list of forums including all bound data.

Parameters

ParameterDescription
arOrder An array in the format Array(by1=>order1[, by2=>order2 [, ..]]), where:

by - the field by which the list is to be sorted. The following values are possible:
  • ID - the forum ID;
  • LID - the forum language;
  • NAME - the forum name;
  • ACTIVE - active state;
  • MODERATION - specifies the forum is moderated;
  • FORUM_GROUP_ID - the forum group ID;
  • TOPICS - number of threads in the forum;
  • POSTS - number of posts in the forum;
  • LAST_POST_DATE - the date the last post was created;
  • SORT - sort index;
order - sort order. The following values are possible:
  • ASC - ascending;
  • DESC - descending;
Optional. The default value is Array("SORT"=>"ASC")
arFilter An array of the format array("filtered field"=>"filter value" [, ...]).

This parameter is detailed in CForumNew::GetList.

Return Values

Returns an instance of the CDBResult class.

See Also

  • CDBResult
  • Forum fields

    Example


    
    <?
    // Display a list of forums the current user can at least read.
    // Group the list by forum groups.
    // First sort the list by sort index, then by the forum name
    $arFilter = array();
    if (!$USER->IsAdmin())
    {
      $arFilter["PERMS"] = array($USER->GetGroups(), 'A');
      $arFilter["ACTIVE"] = "Y";
    }
    $arOrder = array("SORT"=>"ASC", "NAME"=>"ASC");
    $db_Forum = CForumNew::GetListEx($arOrder, $arFilter);
    $currentGroupID = -1;
    while ($db_Forum->NavNext(true, "f_", false)):
      if ($currentGroupID != IntVal($f_FORUM_GROUP_ID))
      {
        if (IntVal($f_FORUM_GROUP_ID)>0)
        {
          $arCurForumGroup = CForumGroup::GetLangByID($f_FORUM_GROUP_ID, LANG);
          echo "<b>";
          echo htmlspecialcharsex($arCurForumGroup["NAME"]);
          echo "<b><br>";
        }
        $currentGroupID = IntVal($f_FORUM_GROUP_ID);
      }
      echo $f_NAME."<br>";
    endwhile;
    ?>