Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Deferred
-
3.9
-
None
-
MOODLE_39_STABLE
-
MDL-67976-master
-
0
-
International 3.9 - Sprint 6, International 3.9 - Sprint 7
Description
Rather than passing in arbitrary strings, arrays, ints, and other values into tablelib to describe filter values, it would be beneficial to describe possible values more accurately.
I would like to propose that we implement a set of value classes for filtering.
abstract class filterset {
|
public function __construct(filter[], int $jointype): void;
|
public function add_filter(string $name, filter $filter): self;
|
public function validate(): bool {
|
// Ensure that only specified filter types are here.
|
// Use a new function to get the description of those - e.g. $this->get_valid_filtertypes();
|
}
|
}
|
abstract class filter {
|
const JOINTYPE_NONE = 0;
|
const JOINTYPE_ANY = 1;
|
const JOINTYPE_ALL = 2;
|
|
public function __construct(int $jointype, array $values): void;
|
public function add_value($value): self;
|
}
|
class group extends filter {
|
public function add_value(int $value): self {
|
$this->values[] = $value;
|
}
|
|
public function validate(?int $courseid): bool {
|
// Check that they're all valid groups in the (optionally-specified) course.
|
}
|
}
|
Attachments
Issue Links
- has been marked as being related by
-
MDL-67913 Update table_sql to support a generic web service
-
- Closed
-