-
Epic
-
Resolution: Won't Do
-
Minor
-
None
-
3.11
-
None
-
MOODLE_311_STABLE
-
API : Generic filtering in Moodle
Filtering data is quite widely used in some area of Moodle:
- "Dynamic tables"
- Users (list of users, etc...)
In many cases the implementation differs slightly resulting in an impossibility to find a unified approach.
I have worked on two projects that were either using filters for searching (a course catalog: https://github.com/call-learning/moodle-local_resourcelibrary) or filtering a table (a spin off the dynamic table using a js library that is called tabulator (https://github.com/call-learning/moodle-local_cltools/tree/dev-tabulator).
Basically the two projects (the dynamic table with tabulator and the catalog) have something in common: how to declare and set up filters that will then issue the related SQL query.
I looked at the dynamic_table/table library in 3.9 and although it works well in most cases, it lacks some features, and especially regarding filters. For example all the filtering is done in the user/participant classes and is not done in a generic way, so if you want filters in your project, you need to reimplement them from scratch.
For my own needs, I ended up created a series of classes very similar to the ones inspired from the dynamic table, but I am not entirely satisfied with it:
The result is here: https://github.com/call-learning/moodle-local_cltools/tree/dev-tabulator/classes/local/filter
There are some sort of convergence in Moodle toward a "persistent object", "dynamic tables" and so on but it might it still lacks a more "generic" approach to the problem. I guess that this the kind of issue is maybe already resolved by most framework out there (Symphony, or more generally any framework that abstracts the database layer), but would need to be refined in Moodle.
I a nutshell, I would like to explore :
- a "standardisation" of filters (i.e. a numeric filter, a string filter, a multiple choice filter), that could be used in multiple locations such as the participant page, user list, dynamic tables, ...but also for third party developers like me implementing specific pages.
- Different solutions for this (using existing framework or not) and best practices.
Anyone interested ?
- has a non-specific relationship to
-
MDL-70343 Integrate Moodle Workplace Report builder for Moodle 4.0
- Closed