Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_quiz\question\bank\filter\custom_category_condition Class Reference
Inheritance diagram for mod_quiz\question\bank\filter\custom_category_condition:
qbank_managecategories\category_condition core_question\local\bank\condition

Public Member Functions

 allow_custom ()
 Whether customisation is allowed.
 
 allow_empty ()
 Whether empty value is allowed.
 
 allow_multiple ()
 Whether multiple values are allowed .
 
 display_options ()
 Called by question_bank_view to display the GUI for selecting a category.
 
 display_options_adv ()
 Displays the recursion checkbox GUI.
 
 get_condition_class ()
 Return this condition class.
 
 get_course_id ()
 Returns course id.
 
 get_default_category ()
 Return default category.
 
 get_filter_class ()
 Return filter class associated with 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)
 Build query from filter value.
 
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)
 Look up the category record based on category ID and context.
 
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 ()
 Print the text if category id not available.
 
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)
 Display the drop down to select the category.
 
 print_category_info ($category)
 Print the category description.
 

Protected Attributes

string $cat
 categoryID,contextID as used with question_bank_view->display().
 
stdClass $category
 The category 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.
 

Detailed Description

Author
Safat Shahin safat.nosp@m.shah.nosp@m.in@ca.nosp@m.taly.nosp@m.st-au.nosp@m..net
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ allow_custom()

qbank_managecategories\category_condition::allow_custom ( )
inherited

Whether customisation is allowed.

Return values
bool

Reimplemented from core_question\local\bank\condition.

◆ allow_empty()

qbank_managecategories\category_condition::allow_empty ( )
inherited

Whether empty value is allowed.

Return values
bool

Reimplemented from core_question\local\bank\condition.

◆ allow_multiple()

qbank_managecategories\category_condition::allow_multiple ( )
inherited

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)
staticinherited

Build query from filter value.

Parameters
array$filterfilter properties
Return values
arraywhere sql and params

Reimplemented from core_question\local\bank\condition.

◆ display_category_form()

qbank_managecategories\category_condition::display_category_form ( $contexts,
$pageurl,
$current )
protectedinherited

Display the drop down to select the category.

Parameters
array$contextsof contexts that can be accessed from here.
moodle_url$pageurlthe URL of this page.
string$current'categoryID,contextID'.
Deprecated
since Moodle 4.3
Todo
Final deprecation on Moodle 4.7 MDL-78090

◆ display_options()

qbank_managecategories\category_condition::display_options ( )
inherited

Called by question_bank_view to display the GUI for selecting a category.

Deprecated
since Moodle 4.3 MDL-72321 - please do not use this function any more.
Todo
Final deprecation on Moodle 4.7 MDL-78090

Reimplemented from core_question\local\bank\condition.

◆ display_options_adv()

qbank_managecategories\category_condition::display_options_adv ( )
inherited

Displays the recursion checkbox GUI.

question_bank_view places this within the section that is hidden by default

Deprecated
since Moodle 4.3 MDL-72321 - please do not use this function any more.
Todo
Final deprecation on Moodle 4.7 MDL-78090

Reimplemented from core_question\local\bank\condition.

◆ get_category_record()

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

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 ( )
staticinherited

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 ( )
inherited

Returns course id.

Return values
stringCourse id.

◆ get_current_category()

static qbank_managecategories\category_condition::get_current_category ( $categoryandcontext)
staticinherited

Look up the category record based on category ID and context.

Parameters
string$categoryandcontextcategoryID,contextID as used with question_bank_view->display()
Return values
stdClassThe category record
Deprecated
since Moodle 4.3
Todo
Final deprecation in Moodle 4.7 MDL-78090

◆ get_default_category()

qbank_managecategories\category_condition::get_default_category ( )
inherited

Return default category.

Return values
stdClassdefault category

◆ get_filter_class()

qbank_managecategories\category_condition::get_filter_class ( )
inherited

Return filter class associated with this condition.

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 ( )
inherited

Extra data specific to this condition.

Return values
stdClass

Reimplemented from core_question\local\bank\condition.

◆ get_initial_values()

mod_quiz\question\bank\filter\custom_category_condition::get_initial_values ( )

Initial values of the condition.

Return values
array

Reimplemented from qbank_managecategories\category_condition.

◆ get_join_list()

qbank_managecategories\category_condition::get_join_list ( )
inherited

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 ( )
inherited

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 ( )
inherited

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)
protectedinherited

Print the category description.

Parameters
stdClass$categorythe category information form the database.
Deprecated
since Moodle 4.3 MDL-72321 - please do not use this function any more.
Todo
Final deprecation on Moodle 4.7 MDL-78090

◆ print_choose_category_message()

static qbank_managecategories\category_condition::print_choose_category_message ( )
staticinherited

Print the text if category id not available.

Deprecated
since Moodle 4.3
Todo
Final deprecation in Moodle 4.7 MDL-78090

◆ validate_category_param()

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

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: