Documentation

CChapter::GetTreeList

CDBResult
CChapter::GetTreeList(
 int COURSE_ID
);

The GetTreeList method returns a sorted list of chapters as a fully expanded tree.

Parameters

ParameterDescription
COURSE_ID The course ID.

Return Values

The method returns an instance of the CDBResult object.

See Also

  • CDBResult
  • CChapter::GetByID
  • CChapter::GetList
  • CCourse::GetCourseContent
  • Chapter fields

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $res = CChapter::GetTreeList($COURSE_ID = 105);
    
        while ($arChapter = $res->GetNext())
        {
            echo str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $arChapter["DEPTH_LEVEL"]);
            echo "+".$arChapter["NAME"]."<br>";
        }
    
        /*
        The above example will output something similar to:
        +Chapter 1
          +Chapter 1.1
          +Chapter 1.2
        +Chapter 2
        +Chapter 3
          +Chapter 3.1
            +Chapter 3.1.1
        */
    }
    ?>
  • © «Bitrix24», 2001-2024
    Up