CDBResult
CCourse::GetList(
array arOrder = Array("TIMESTAMP_X"=>"DESC"),
array arFilter = Array(),
bool bIncCnt = false
);
The GetList method returns the list of courses filtered by arFilter and sorted in the arOrder order. The current user access permissions are considered.
| 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 course lessons is to be returned in ELEMENT_CNT. Optional, false by default. |
The method returns an instance of the CDBResult object.
lt;?
if (CModule::IncludeModule("learning"))
{
$res = CCourse::GetList(
Array("SORT"=>"ASC"),
Array("ACTIVE" => "Y", "CNT_ACTIVE" => "Y"),
$bIncCnt = true
);
while ($arCourse = $res->GetNext())
{
echo "Course name: ".$arCourse["NAME"]."<br>";
echo "Active lessons: ".$arCourse["ELEMENT_CNT"]."<br><br>";
}
}
?>
<?
if (CModule::IncludeModule("learning"))
{
$res = CCourse::GetList(
Array("SORT"=>"ASC"),
Array("?NAME" => "Site")
);
while ($arCourse = $res->GetNext())
{
echo "Course name: ".$arCourse["NAME"]."<br>";
}
}
?>
<?
if (CModule::IncludeModule("learning"))
{
$res = CCourse::GetList(
Array("NAME" => "ASC", "SORT"=>"ASC"),
Array("CHECK_PERMISSIONS" => "N")
);
while ($arCourse = $res->GetNext())
{
echo "Course name: ".$arCourse["NAME"]."<br>";
}
}
?>
<?
if(CModule::IncludeModule("learning")):
$res = CCourse::GetList(Array("SORT" => "DESC"),
Array("ACTIVE" => "Y",
"ACTIVE_DATE" => "Y",
"SITE_ID" => LANG));
while ($arElement = $res->GetNext()):?>
<font class="text">
<?if ($arElement["PREVIEW_PICTURE"]):?>
<table cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
<td><?echo ShowImage($arElement["PREVIEW_PICTURE"],
200, 200,
"hspace='0' vspace='2' align='left' border='0'",
"", true);?></td>
<td valign="top" width="0%">
<img src="/bitrix/images/1.gif" width="10" height="1">
</td>
</tr>
</table>
<?endif;?>
<a target="blank_" href="
<?=$COURSE_URL?>?COURSE_ID=<?=$arElement["ID"]?>"><?=$arElement["NAME"]?></a>
<?=(strlen($arElement["PREVIEW_TEXT"])>0 ? "<br>".$arElement["PREVIEW_TEXT"]: "")?>
</font><br clear="all"><br>
<?endwhile?>
<?endif?>
?>| © 2001-2007 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |