Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
tool_brickfield\local\tool\filter Class Reference

Public Member Functions

 __construct (int $courseid=0, int $categoryid=0, string $tab='', int $page=0, int $perpage=0, string $url='', string $target='')
 filter constructor.
 
 can_access (\context $context=null, string $capability='')
 Check whether the user has appropriate permissions on the supplied context.
 
 get_course_sql (string $alias='', bool $onlycondition=false)
 Get any course and category sql fragment and parameters and return as an array for this filter.
 
 get_errormessage ()
 Return the error message data.
 
 has_capability_in_context (string $capability, context $context=null)
 Check the specified capability against the filter's context, or the specified context with the filter's information.
 
 has_course_filters ()
 Return true if filter has course filter data, and the data is valid.
 
 validate_filters ()
 Validate the filters.
 

Public Attributes

int $categoryid
 Possible category id being filtered.
 
int $courseid
 Possible course id being filtered.
 
array $courseids
 Array of filtered course ids if more than one.
 
int $page
 The page number if multiple pages.
 
int $perpage
 Number of items per page for multiple pages.
 
string $tab
 The tab (page) being accessed.
 
string $target
 The output target.
 
string $url
 The url of the page being accessed.
 

Protected Attributes

string $errormessage
 Any error message if present.
 

Constructor & Destructor Documentation

◆ __construct()

tool_brickfield\local\tool\filter::__construct ( int $courseid = 0,
int $categoryid = 0,
string $tab = '',
int $page = 0,
int $perpage = 0,
string $url = '',
string $target = '' )

filter constructor.

Parameters
int$courseid
int$categoryid
string$tab
int$page
int$perpage
string$url
string$target

Member Function Documentation

◆ can_access()

tool_brickfield\local\tool\filter::can_access ( \context $context = null,
string $capability = '' )

Check whether the user has appropriate permissions on the supplied context.

Determine the capability to check by the filters that are set.

Parameters
context | null$contextThe context being viewed (e.g. system, course category, course).
string$capabilityAn optional capability to check.
Return values
bool
Exceptions
coding_exception
dml_exception

◆ get_course_sql()

tool_brickfield\local\tool\filter::get_course_sql ( string $alias = '',
bool $onlycondition = false )

Get any course and category sql fragment and parameters and return as an array for this filter.

Return false if course filters are invalid.

Parameters
string$aliasOptional field alias to prefix on the where condition.
bool$onlyconditionSet to true if this is the only condition to be used in the SQL statement.
Return values
array|bool
Exceptions
coding_exception
dml_exception

◆ get_errormessage()

tool_brickfield\local\tool\filter::get_errormessage ( )

Return the error message data.

Return values
mixed

◆ has_capability_in_context()

tool_brickfield\local\tool\filter::has_capability_in_context ( string $capability,
context $context = null )

Check the specified capability against the filter's context, or the specified context with the filter's information.

Parameters
string$capability
null$context
Return values
bool
Exceptions
coding_exception
dml_exception

◆ has_course_filters()

tool_brickfield\local\tool\filter::has_course_filters ( )

Return true if filter has course filter data, and the data is valid.

Note that the site uses courseid 1.

Return values
bool
Exceptions
coding_exception
dml_exception

◆ validate_filters()

tool_brickfield\local\tool\filter::validate_filters ( )

Validate the filters.

Set an errormessage if invalid. No filters is also valid - in that case using entire system.

Return values
bool
Exceptions
coding_exception
dml_exception

The documentation for this class was generated from the following file: