Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
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 ()
 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.
 

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

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

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

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

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

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

Return default category.

Return values
stdClassdefault category

◆ get_filter_class()

qbank_managecategories\category_condition::get_filter_class ( )

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

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

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

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