Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72017

API: Generic filtering in Moodle

    XMLWordPrintable

Details

    • Epic
    • Resolution: Unresolved
    • Minor
    • None
    • 3.11
    • Other
    • None
    • MOODLE_311_STABLE
    • API : Generic filtering in Moodle

    Description

      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 ?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lmdavid Laurent DAVID
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.