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

Create filter classes

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Deferred
    • 3.9
    • None
    • Course
    • 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

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 3 hours, 22 minutes
                  2d 3h 22m