Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402]

A search class to control from which category questions are listed.

Copyright: 2013 Ray Morris
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 202 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

category_condition:: (9 methods):
  __construct()
  init()
  where()
  params()
  display_options()
  display_options_adv()
  display_category_form()
  get_current_category()
  print_category_info()


Class: category_condition  - X-Ref

This class controls from which category questions are listed.

__construct($cat, $recurse, $contexts, $baseurl, $course, $maxinfolength = null)   X-Ref
Constructor

param: string     $cat           categoryID,contextID as used with question_bank_view->display()
param: bool       $recurse       Whether to include questions from sub-categories
param: array      $contexts      Context objects as used by question_category_options()
param: \moodle_url $baseurl       The URL the form is submitted to
param: \stdClass   $course        Course record
param: integer    $maxinfolength The maximum displayed length of the category info.

init()   X-Ref
Initialize the object so it will be ready to return where() and params()


where()   X-Ref
SQL fragment to add to the where clause.

return: string

params()   X-Ref
Return parameters to be bound to the above WHERE clause fragment.

return: array parameter name => value.

display_options()   X-Ref
Called by question_bank_view to display the GUI for selecting a category


display_options_adv()   X-Ref
Displays the recursion checkbox GUI.
question_bank_view places this within the section that is hidden by default


display_category_form($contexts, $pageurl, $current)   X-Ref
Display the drop down to select the category.

param: array $contexts of contexts that can be accessed from here.
param: \moodle_url $pageurl the URL of this page.
param: string $current 'categoryID,contextID'.

get_current_category($categoryandcontext)   X-Ref
Look up the category record based on cateogry ID and context

param: string $categoryandcontext categoryID,contextID as used with question_bank_view->display()
return: \stdClass The category record

print_category_info($category)   X-Ref
Print the category description

param: \stdClass $category the category information form the database.