Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Functions for managing and manipulating question filter conditions

Author: Mark Johnson <mark.johnson@catalyst-eu.net>
Copyright: 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 120 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: filter_condition_manager  - X-Ref

Static methods for parsing and formatting data related to filter conditions.

extract_parameters_from_fragment_args(array $args)   X-Ref
Extract parameters from args list.

param: array $args
return: array the param and extra param

get_condition_classes()   X-Ref
List of condition classes

return: condition[] condition classes: [condition_key] = class

update_filter_param_to_category(string $filterparam, int $newcategoryid)   X-Ref
Given a JSON-encoded "filter" URL param, create or replace the category filter with the provided category.

param: string $filterparam The json-encoded filter param from the URL, containing the list of filters.
param: int $newcategoryid The new ID to set for the "category" filter condition's value.
return: string JSON-encoded filter param with the new category.

unpack_filteroptions_param(array $filters)   X-Ref
Unpack filteroptions passed in a request's filter param if required.

Filteroptions are passed via AJAX as an array of {name:, value:} pairs for compatibility with external functions.

param: array $filters List of filters, each optionally including an array of filteroptions.
return: array The input array, with filteroptions unpacked from [{name:, value:}, ...] to [name => value, ...].