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 |
filter_condition_manager:: (4 methods):
extract_parameters_from_fragment_args()
get_condition_classes()
update_filter_param_to_category()
unpack_filteroptions_param()
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, ...]. |