Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250605) (9223e346c3e)
qbank_managecategories\category_condition Class Reference
Inheritance diagram for qbank_managecategories\category_condition:
core_question\local\bank\condition mod_quiz\question\bank\filter\custom_category_condition

Public Member Functions

 __construct (?view $qbank=null)
 Constructor to initialize the category filter condition.
 
 allow_custom ()
 Whether customisation is allowed.
 
 allow_empty ()
 Whether empty value is allowed.
 
 allow_multiple ()
 Whether multiple values are allowed .
 
 display_options ()
 
 display_options_adv ()
 
 filter_invalid_values (array $filterconditions)
 Method to be overridden in condition classes to filter out anything invalid from the filterconditions array.
 
 get_condition_class ()
 Return this condition class.
 
 get_course_id ()
 Returns course id.
 
 get_default_category ()
 Return default category.
 
 get_filter_class ()
 Return the Javascript filter class to provide the UI for this condition.
 
 get_filteroptions ()
 Extra data specific to this condition.
 
 get_initial_values ()
 Initial values of the condition.
 
 get_join_list ()
 Get the list of available joins for the filter.
 
 get_title ()
 Return title of the condition.
 
 is_required ()
 Whether this filter is required - if so it cannot be removed from the list of filters.
 
 params ()
 Return parameters to be bound to the above WHERE clause fragment.
 
 where ()
 Return an SQL fragment to be ANDed into the WHERE clause to filter which questions are shown.
 

Static Public Member Functions

static build_query_from_filter (array $filter)
 Return the SQL WHERE condition and parameters to be ANDed with other filter conditions.
 
static get_category_record ($categoryid, $contextid)
 Fetch the question category record matching the provided category and context IDs.
 
static get_condition_key ()
 Each condition will need a unique key to be identified and sequenced by the api.
 
static get_current_category ($categoryandcontext)
 
static get_filter_from_list (array $filters)
 Given an array of filters, pick the entry that matches the condition key and return it.
 
static print_choose_category_message ()
 
static validate_category_param (string $categoryandcontext)
 Return category and context ID from compound parameter.
 

Public Attributes

array array $filter
 Filter properties for this condition.
 
bool $includesubcategories
 Include questions in subcategories of the specified category?
 
int $maxinfolength
 The maximum displayed length of the category info.
 
int const JOINTYPE_DEFAULT = datafilter::JOINTYPE_ANY
 The default filter type.
 

Protected Member Functions

 display_category_form ($contexts, $pageurl, $current)
 
 print_category_info ($category)
 

Protected Attributes

string $cat
 categoryID,contextID as used with question_bank_view->display().
 
stdClass $category
 The category record.
 
stdClass stdClass $cm
 The course_modules record.
 
array $contexts
 of contexts.
 
stdClass $course
 The course record.
 
array array $params = []
 query param used in where.
 
string string $where = ''
 SQL fragment to add to the where clause.
 

Constructor & Destructor Documentation

◆ __construct()

qbank_managecategories\category_condition::__construct ( ?view $qbank = null)

Constructor to initialize the category filter condition.

Parameters
view$qbankqbank view

Reimplemented from core_question\local\bank\condition.

Member Function Documentation

◆ allow_custom()

qbank_managecategories\category_condition::allow_custom ( )

Whether customisation is allowed.

Return values
bool

Reimplemented from core_question\local\bank\condition.

◆ allow_empty()

qbank_managecategories\category_condition::allow_empty ( )

Whether empty value is allowed.

Return values
bool

Reimplemented from core_question\local\bank\condition.

◆ allow_multiple()

qbank_managecategories\category_condition::allow_multiple ( )

Whether multiple values are allowed .

Return values
bool

Reimplemented from core_question\local\bank\condition.

◆ build_query_from_filter()

static qbank_managecategories\category_condition::build_query_from_filter ( array $filter)
static

Return the SQL WHERE condition and parameters to be ANDed with other filter conditions.

The $filter parameter recieves an array with a 'values' key, containing an array of the filter values selected, and a 'jointype' key containing the selected join type.

Parameters
array$filterfilter properties
Return values
array['SQL where condition', ['param1' => 'value1', 'param2' => 'value2', ...]]

Reimplemented from core_question\local\bank\condition.

◆ display_category_form()

qbank_managecategories\category_condition::display_category_form ( $contexts,
$pageurl,
$current )
protected
Deprecated
since Moodle 4.3

◆ display_options()

qbank_managecategories\category_condition::display_options ( )
Deprecated
since Moodle 4.3 MDL-72321 - please do not use this function any more.

Reimplemented from core_question\local\bank\condition.

◆ display_options_adv()

qbank_managecategories\category_condition::display_options_adv ( )
Deprecated
since Moodle 4.3 MDL-72321 - please do not use this function any more.

Reimplemented from core_question\local\bank\condition.

◆ filter_invalid_values()

qbank_managecategories\category_condition::filter_invalid_values ( array $filterconditions)

Method to be overridden in condition classes to filter out anything invalid from the filterconditions array.

This can be applied anywhere where the $filterconditions array exists, to let condition plugins remove elements from the array, based on their own internal logic/validation. For example, this is used on the /mod/quiz/editrandom.php page to filter out question categories which no longer exist, which previously broke the editrandom page.

Parameters
array$filterconditions
Return values
array

Reimplemented from core_question\local\bank\condition.

◆ get_category_record()

static qbank_managecategories\category_condition::get_category_record ( $categoryid,
$contextid )
static

Fetch the question category record matching the provided category and context IDs.

Parameters
int$categoryid
int$contextid
Return values
stdClass
Exceptions
dml_exception

◆ get_condition_class()

core_question\local\bank\condition::get_condition_class ( )
inherited

Return this condition class.

Return values
string

◆ get_condition_key()

static qbank_managecategories\category_condition::get_condition_key ( )
static

Each condition will need a unique key to be identified and sequenced by the api.

Use a unique string for the condition identifier, use string directly, dont need to use language pack. Using language pack might break the filter object for multilingual support.

Return values
string

Reimplemented from core_question\local\bank\condition.

◆ get_course_id()

qbank_managecategories\category_condition::get_course_id ( )

Returns course id.

Return values
stringCourse id.

◆ get_current_category()

static qbank_managecategories\category_condition::get_current_category ( $categoryandcontext)
static
Deprecated
since Moodle 4.3

◆ get_default_category()

qbank_managecategories\category_condition::get_default_category ( )

Return default category.

Return values
stdClassdefault category

◆ get_filter_class()

qbank_managecategories\category_condition::get_filter_class ( )

Return the Javascript filter class to provide the UI for this condition.

If left as null, this will use the default core/datafilter/filtertype class. Otherwise, override it to return the full path to the Javascript module path for the class.

Return values
?stringfilter class

Reimplemented from core_question\local\bank\condition.

◆ get_filter_from_list()

static core_question\local\bank\condition::get_filter_from_list ( array $filters)
staticinherited

Given an array of filters, pick the entry that matches the condition key and return it.

Parameters
array$filtersArray of filters, keyed by condition.
Return values
?arrayThe filter that matches this condition

◆ get_filteroptions()

qbank_managecategories\category_condition::get_filteroptions ( )

Extra data specific to this condition.

Return values
stdClass

Reimplemented from core_question\local\bank\condition.

◆ get_initial_values()

qbank_managecategories\category_condition::get_initial_values ( )

Initial values of the condition.

Return values
array

Reimplemented from core_question\local\bank\condition.

Reimplemented in mod_quiz\question\bank\filter\custom_category_condition.

◆ get_join_list()

qbank_managecategories\category_condition::get_join_list ( )

Get the list of available joins for the filter.

Return values
array

Reimplemented from core_question\local\bank\condition.

◆ get_title()

qbank_managecategories\category_condition::get_title ( )

Return title of the condition.

Return values
stringtitle of the condition

Reimplemented from core_question\local\bank\condition.

◆ is_required()

qbank_managecategories\category_condition::is_required ( )

Whether this filter is required - if so it cannot be removed from the list of filters.

Return values
bool

Reimplemented from core_question\local\bank\condition.

◆ params()

core_question\local\bank\condition::params ( )
inherited

Return parameters to be bound to the above WHERE clause fragment.

Return values
arrayparameter name => value.

◆ print_category_info()

qbank_managecategories\category_condition::print_category_info ( $category)
protected
Deprecated
since Moodle 4.3 MDL-72321 - please do not use this function any more.

◆ print_choose_category_message()

static qbank_managecategories\category_condition::print_choose_category_message ( )
static
Deprecated
since Moodle 4.3

◆ validate_category_param()

static qbank_managecategories\category_condition::validate_category_param ( string $categoryandcontext)
static

Return category and context ID from compound parameter.

Parameters
string$categoryandcontextComma-separated list of category and context IDs.
Return values
int[]|null[]

◆ where()

core_question\local\bank\condition::where ( )
inherited

Return an SQL fragment to be ANDed into the WHERE clause to filter which questions are shown.

Return values
stringSQL fragment. Must use named parameters.

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