Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 204 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: filter  - X-Ref

Class filter.

__construct(int $courseid = 0, int $categoryid = 0, string $tab = '',int $page = 0, int $perpage = 0, string $url = '', string $target = '')   X-Ref
filter constructor.

param: int $courseid
param: int $categoryid
param: string $tab
param: int $page
param: int $perpage
param: string $url
param: string $target

get_course_sql(string $alias = '', bool $onlycondition = false)   X-Ref
Get any course and category sql fragment and parameters and return as an array for this filter. Return false if course
filters are invalid.

param: string $alias Optional field alias to prefix on the where condition.
param: bool $onlycondition Set to true if this is the only condition to be used in the SQL statement.
return: array|bool

validate_filters()   X-Ref
Validate the filters. Set an errormessage if invalid. No filters is also valid - in that case using entire system.

return: bool

has_course_filters()   X-Ref
Return true if filter has course filter data, and the data is valid. Note that the site uses courseid 1.

return: bool

can_access(\context $context = null, string $capability = '')   X-Ref
Check whether the user has appropriate permissions on the supplied context. Determine the capability to check by the filters
that are set.

param: \context|null $context The context being viewed (e.g. system, course category, course).
param: string $capability An optional capability to check.
return: bool

has_capability_in_context(string $capability, \context $context = null)   X-Ref
Check the specified capability against the filter's context, or the specified context with the filter's information.

param: string $capability
param: null $context
return: bool

get_errormessage()   X-Ref
Return the error message data.

return: mixed