CChapter::GetList
CDBResult CChapter::GetList( array arOrder = Array("TIMESTAMP_X"=>"DESC"), array arFilter = Array(), bool bIncCnt = false );
The GetList method returns the list of chapters filtered by arFilter and sorted in the arOrder order. The current user access permissions are considered.
Parameters
Parameter | Description |
---|---|
arOrder |
An array in the format array("filter field"=>"sort
order" [, ...]). The sorting field can have the following values:
|
arFilter |
An array in the format array("filtered
field"=>"filter value" [, ...]). The following
values are possible:
"filter values" is a single value or an array. Optional. By default, records are not filtered. |
bIncCnt | Defines whether the number of chapter lessons is to be returned in ELEMENT_CNT. Optional, false by default. |
Return Values
The method returns an instance of the CDBResult object.
See Also
Examples
<? if (CModule::IncludeModule("learning")) { $COURSE_ID = 97; $res = CChapter::GetList( Array("SORT"=>"ASC"), Array("ACTIVE" => "Y", "COURSE_ID" => $COURSE_ID, "CNT_ACTIVE" => "Y"), true ); while ($arChapter = $res->GetNext()) { echo "Chapter name: ".$arChapter["NAME"]."<br>"; echo "Active lessons: ".$arChapter["ELEMENT_CNT"]."<br><br>"; } } ?>
<? if (CModule::IncludeModule("learning")) { $res = CChapter::GetList( Array("SORT"=>"ASC"), Array("?NAME" => "Site") ); while ($arChapter = $res->GetNext()) { echo "Chapter name: ".$arChapter["NAME"]."<br>"; } } ?>
<? if (CModule::IncludeModule("learning")) { $COURSE_ID = 97; $res = CChapter::GetList( Array("NAME" => "ASC", "SORT"=>"ASC"), Array("COURSE_ID" => $COURSE_ID) ); while ($arChapter = $res->GetNext()) { echo "Chapter name: ".$arChapter["NAME"]."<br>"; } } ?>
<? if (CModule::IncludeModule("learning")) { $COURSE_ID = 97; $res = CChapter::GetList( Array("TIMESTAMP_X" => "ASC", "SORT"=>"ASC"), Array("CHECK_PERMISSIONS" => "N", "CHAPTER_ID" => "", "COURSE_ID" => $COURSE_ID) ); while ($arChapter = $res->GetNext()) { echo "Chapter name: ".$arChapter["NAME"]."<br>"; } } ?>
© «Bitrix24», 2001-2024