-
Improvement
-
Resolution: Fixed
-
Critical
-
3.9
-
MOODLE_39_STABLE
-
MOODLE_39_STABLE
-
MDL-67913-master -
-
4
-
International 3.9 - Sprint 5, International 3.9 - Sprint 6, International 3.9 - Sprint 7
Currently table_sql and its derivatives are entirely configured via their constructor and one-off endpoints (e.g. /user/index.php).
I am proposing the following changes:
- Update lib/components.json to define the existing "table" subsystem in "lib\/table"
- create a new interface \core_table\dynamic (or similar) in lib/table/classes/dynamic.php. Can be initially empty while we work the full details out
- have our existing user class implement the new interface (\core_user\participants_table)
- move all logic from the current constructor of the participants table to the new argument processing system, and update the calls to it in user/index.php
- create a new web service to fetch a table_sql view;
Interface and implementation in participants table
- Will need functions including:
- get_unique_id_from_argument(string $argument): string; (discussed below);
- get_base_url(): \moodle_url;
- process_arguments: void
Webservice
- Will have a WS name like 'core_table_dynamic' and be located in \core\table\external\dynamic (lib/table/classes/external/dynamic.php)
- Should take arguments:
- handler - the auto-loadable class name of a class extending table_sql and implementing \core_table\dynamic
- uniqueid - the unique id of the table:
- This is typically done in the class extending table_sql. e.g in \core_user\participants_table we call parent::__construct('user-index-participants-' . $courseid) - so the unique id is user-index-participants-[\d+]
- We may wish to create a static function on the interface + implementation like get_unique_id_from_argument(string $argument): string;
- We can then create an implementation in the participants table like:
public static function get_unique_id_from_argument(string $argument): string {
return "user-index-participants-{$argument}";
}
And in our WS we can use it like:
if (!class_exists($handler) || !is_subclass_of($handler, \core_table\dynamic::class)) {
throw new \Exception('Not supported');
}
$instance = new $handler($handler::get_unique_id_from_argument($uniqueid));
- filters - the list of filters to the table. This is essentially the extra arguments currently provided to the constructor.
- We probably want to make this a list of key/value pairs or a JSON string that we can decode and pass to the instantiated class
- We will return:
- list of data attributes which correlates to the input received
- Raw HTML raw
- In future we will update the table_sql and flexible_table classes to make use of a set of templates, and we can then return the template name, and a data structure
- blocks
-
MDL-67914 Update table_sql to support dynamic sorting
- Closed
-
MDL-67915 Update table_sql to support dynamic show/hide of columns
- Closed
-
MDL-67764 Move participant page refresh to fragments web service
- Closed
- caused a regression
-
MDL-68225 Participants page groups filter is broken
- Closed
- has a non-specific relationship to
-
MDL-67976 Create filter classes
- Closed