Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

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: 182 lines (7 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
No description

params()   X-Ref
No description

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.