From c43bdf5e13d67a2f526040c4c8a63eccf0ffb11c Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 21 Feb 2020 08:48:03 +0800 Subject: [PATCH] MDL-67913 user: Add participants table filterset --- user/classes/table/participants_filterset.php | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 user/classes/table/participants_filterset.php diff --git a/user/classes/table/participants_filterset.php b/user/classes/table/participants_filterset.php new file mode 100644 index 00000000000..e0d0efe0658 --- /dev/null +++ b/user/classes/table/participants_filterset.php @@ -0,0 +1,79 @@ +. + +/** + * Participants table filterset. + * + * @package core + * @category table + * @copyright 2020 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +declare(strict_types=1); + +namespace core_user\table; + +use core_table\local\filter\boolean_filter; +use core_table\local\filter\filterset; +use core_table\local\filter\integer_filter; +use core_table\local\filter\string_filter; + +/** + * Participants table filterset. + * + * @package core + * @copyright 2020 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class participants_filterset extends filterset { + /** + * Get the required filters. + * + * The only required filter is the courseid filter. + * + * @return array. + */ + public function get_required_filters(): array { + return [ + 'courseid' => integer_filter::class, + ]; + } + + /** + * Get the optional filters. + * + * These are: + * - accesssince; + * - enrolments; + * - groups; + * - keywords; + * - roles; and + * - status. + * + * @return array + */ + public function get_optional_filters(): array { + return [ + 'accesssince' => integer_filter::class, + 'enrolments' => integer_filter::class, + 'groups' => integer_filter::class, + 'keywords' => string_filter::class, + 'roles' => integer_filter::class, + 'status' => integer_filter::class, + ]; + } +}