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.
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()).
| 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")
|
The method returns an instance of the CDBResult object.
<?
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
*/
}
?>| © 2001-2007 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |