Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core_question\bank\search\category_condition Class Reference

This class controls from which category questions are listed. More...

Inheritance diagram for core_question\bank\search\category_condition:
core_question\bank\search\condition

Public Member Functions

 __construct ($cat=null, $recurse=false, $contexts, $baseurl, $course, $maxinfolength=null)
 Constructor. More...
 
 display_options ()
 Called by question_bank_view to display the GUI for selecting a category.
 
 display_options_adv ()
 Displays the recursion checkbox GUI. More...
 
 params ()
 Return parameters to be bound to the above WHERE clause fragment. More...
 
 where ()
 Return an SQL fragment to be ANDed into the WHERE clause to filter which questions are shown. More...
 

Protected Member Functions

 display_category_form ($contexts, $pageurl, $current)
 Display the drop down to select the category. More...
 
 get_current_category ($categoryandcontext)
 Look up the category record based on cateogry ID and context. More...
 
 print_category_info ($category)
 Print the category description. More...
 

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.
 
int $maxinfolength
 The maximum displayed length of the category info.
 
array $params
 query param used in where.
 
bool $recurse
 Whether to include questions from sub-categories.
 
string $where
 SQL fragment to add to the where clause.
 

Detailed Description

This class controls from which category questions are listed.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_question\bank\search\category_condition::__construct (   $cat = null,
  $recurse = false,
  $contexts,
  $baseurl,
  $course,
  $maxinfolength = null 
)

Constructor.

Parameters
string$catcategoryID,contextID as used with question_bank_view->display()
bool$recurseWhether to include questions from sub-categories
array$contextsContext objects as used by question_category_options()
moodle_url$baseurlThe URL the form is submitted to
stdClass$courseCourse record
integer$maxinfolengthThe maximum displayed length of the category info.

Member Function Documentation

◆ display_category_form()

core_question\bank\search\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'.

◆ display_options_adv()

core_question\bank\search\category_condition::display_options_adv ( )

Displays the recursion checkbox GUI.

question_bank_view places this within the section that is hidden by default

Reimplemented from core_question\bank\search\condition.

◆ get_current_category()

core_question\bank\search\category_condition::get_current_category (   $categoryandcontext)
protected

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

Parameters
string$categoryandcontextcategoryID,contextID as used with question_bank_view->display()
Return values
stdClassThe category record

◆ params()

core_question\bank\search\category_condition::params ( )

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

Return values
arrayparameter name => value.

Reimplemented from core_question\bank\search\condition.

◆ print_category_info()

core_question\bank\search\category_condition::print_category_info (   $category)
protected

Print the category description.

Parameters
stdClass$categorythe category information form the database.

◆ where()

core_question\bank\search\category_condition::where ( )

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.

Reimplemented from core_question\bank\search\condition.


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