This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The FileList class provides an object-oriented way to search files. Since it extends the DatabaseItemList, it also provides pagination and sorting.

Instantiating the FileList object

	Loader::model('file_list'); 	$fl = new FileList();

Methods Available

$fl->filterByExtension($extension)

Filters a list by extension. Do not include a period in the $extension string.

$fl->filterByType($fileType)

Filters by type of file. $fileType should be one of the following constants, which are defined in concrete/libraries/file/types.php

	FileType::T_IMAGE 	FileType::T_VIDEO 	FileType::T_TEXT 	FileType::T_AUDIO 	FileType::T_DOCUMENT 	FileType::T_APPLICATION 	FileType::T_UNKNOWN

$fl->filterByKeywords($keywords)

Filters files by keywords, which searches

  1. filename
  2. title
  3. tags
  4. username of uploader
  5. Any file attributes marked as being included in the search index.

$fl->filterBySet(FileSet $fs)

Only display files that are in a given FileSet.

$fl->filterBySize($from, $to)

Filters the file list by file size (in kilobytes).

$fl->filterByDateAdded($date, $comparison = '=')

Filters by date. Allows all MySQL comparison symbols (greather than, less than, etc...)

$fl->filterByTag($tag)

Filters by tag.

$ul->filterByAttribute($attributeKeyHandle, $value, $comparison = '=')

Filters by a user attribute key handle.

$files = $fl->get($itemsToGet = 100, $offset = 0)

Gets all files who fit the criteria.

$fl->getPage($page = false)

Gets a page of files (taking into account $itemsPerPage, current page, etc...)

Pagination and Sorting

For more information on how to paginate and sort the results of FileList query, check out the Searching and Sorting in the System section (link)

Loading Conversation