CDBResult CFile::GetList( array arOrder = array(),
array arFilter = array()
The method returns a filtered and sorted selection of registered files as an object of CDBResult class. Static method.
Note: Same filter fields (SUBDIR, FILE_NAME) and sorting are processed starting from version 10.0.6 of main module.
|arOrder||Array, containing sorting attribute as "fields"=>"direction" pairs. The following fields are supported: ID, TIMESTAMP_X, MODULE_ID, HEIGHT, WIDTH, FILE_SIZE, CONTENT_TYPE, SUBDIR, FILE_NAME, ORIGINAL_NAME. Sorting direction can have the following values: "ASC", "DESC". If the parameter is empty, the selection will be sorted by the ID field in ascension.|
|arFilter||Array, containing filter as "field"=>"value" pairs. The following filter fields are supported: MODULE_ID, ID, SUBDIR, FILE_NAME, ORIGINAL_NAME, CONTENT_TYPE. If the @ symbol is specified at the beginning of the field, several comma-separated values can be passed (IN operator is applied), for example: "@ID"=>"1,2,3,4,5".
CDBResult object type.
Examples of use
//find the largest kernel files
$res = CFile::GetList(array("FILE_SIZE"=>"desc"), array("MODULE_ID"=>"main"));
while($res_arr = $res->GetNext())
echo $res_arr["SUBDIR"]."/".$res_arr["FILE_NAME"]." = ".$res_arr["FILE_SIZE"]."<br>";
Get a file list by the filter. At the moment, filtering and sorting only by ID and MODULE is available.
CFile::GetList($arOrder = Array(), $arFilter = Array(), $arParams = Array())
When sorting by ID either only one ID can be passed:
$arFilter = Array("ID" => 123);
or an array ID ('@' is added to the key and separated by commas):
$arFilter = Array("@ID" => "123,124,125");
The $arParamsfunction parameter is available, but presently is not used at all in the operation of the function.