CCourse::GetCourseContent
CDBResult CCourse::GetCourseContent( int COURSE_ID, array arAddSelectFileds = Array("DETAIL_TEXT", "DETAIL_TEXT_TYPE", "DETAIL_PICTURE") );
The GetCourseContent method returns a list of active chapters and lessons sorted in the ascending order.
Remarks
Fields in the returned list have the same names as the course's chapters and lessons. The required fields are:- ID - the lesson or chapter ID;
- NAME - the lesson or chapter name;
- CHAPTER_ID - the parent chapter ID;
- SORT - sort index;
- DEPTH_LEVEL - required nesting level;
- TYPE - type of the required object ("LE" - lesson, "CH" - chapter).
To obtain other fields, use the arAddSelectFileds array. The method returns the course tree. If "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "DETAIL_PICTURE" are not used, you are recommended to pass an empty arAddSelectFileds (arAddSelectFileds = Array()).
Parameters
Parameter | Description |
---|---|
COURSE_ID | The course ID. |
arAddSelectFileds | An array of additional fields. Possible fields are:
By default, the following array is passed: arAddSelectFileds = Array("DETAIL_TEXT", "DETAIL_TEXT_TYPE", "DETAIL_PICTURE") |
Return Values
The method returns an instance of the CDBResult object.
See Also
CLesson::GetList
CChapter::GetList
CChapter::GetTreeList
Example
<? if (CModule::IncludeModule("learning")) { $res = CCourse::GetCourseContent($COURSE_ID = 105, Array()); while ($arContent = $res->GetNext()) { echo str_repeat(" ", $arContent["DEPTH_LEVEL"]); echo ($arContent["TYPE"]=="CH" ? "+": "-").$arContent["NAME"]."<br>"; } /* The above example will output something similar to: +Chapter 1 +Chapter 1.1 -Lesson 1.1.1 +Chapter 1.2 +Chapter 2 -Lesson 2 +Chapter 3 +Chapter 3.1 -Lesson 3.1.1 -Lesson 3.1.2 +Chapter 3.1.1 */ } ?>
© «Bitrix24», 2001-2024